Closed agardnerIT closed 8 months ago
@prateek041 is working on this. Github won't let me officially assign it to him yet.
He needs to comment on this issue, then we can assign him.
Please assign this issue to me @mowies @StackScribe
Some notes from the hands-on session at Kubecon to assist with this (@thisthat please validate my notes here as it was the end of a long week!)
Imagine you want to add a new metrics provider for a third party service called foobar
:
const FoobarProviderType = "foobar"
foobar
You must implement the EvaluateQuery
function. Note that metric
is a string for flexibility because some backends return things like 3m
which means 0.003
so we're providing that flexibility.
Don't forget to add test cases.
case
statement to this code section: case FoobarProviderType:
return &foobar.KeptnDataDogProvider{
Log: log,
HttpClient: http.Client{},
K8sClient: k8sClient,
}, nil
@thisthat I believe you mentioned that it's possible to code metrics providers in other languages (any other languages or only specific ones?). I think you mentioned TypeScript. Is there demo code / reference impl for this?
Hey @agardnerIT , your list of steps is perfect 💯
Yes, technically you could implement a task that does the metric retrieval and checks for some thresholds. We have an example for Prometheus here: https://github.com/keptn/lifecycle-toolkit/blob/main/functions-runtime/samples/ts/prometheus.ts However, I would not recommend this approach because you would bypass the metric-server and hence, the results will not be available to other tools via the K8s metric API
Hey @thisthat @agardnerIT
Since I am documenting the process, I would like to add a provider on my own so that I can go through the process/steps and write better documentation.
So, What more metrics provider is Keptn community planning to integrate ? So, maybe I can work on one.
Hey @prateek041 that's a great idea! At Kubecon, some folks talked about the need for metrics coming from cloud providers. Maybe AWS CloudWatch or GCP Metric
Hey, @prateek041! Actually, this idea of adding additional metric providers is also a GSOC project and maybe @sudiptob2 is applying under that project. So I think it would be a good idea to ask him beforehand which metric providers is he planning to integrate if he gets selected.
Thanks for the input @rakshitgondwal I totally forgot that it was also there for GSoC, but since organisation is deciding what provider to implement, there won't be any conflict (we can implement separate operators), but still I will definitely talk to him about it on slack. Also, I applied in GSoC for the Backstage plugin.
In the meanwhile, what do you suggest @thisthat should I go ahead with one of GCP metric/AWS cloudwatch ?
Hi, thanks @rakshitgondwal for mentioning me in; In my proposal I have proposed to implement around 4 providers. But the exact providers will be decided after discussing with the mentors (if my proposal get selected). I think @prateek041 can go ahead with his provider of choice at this point.
Hi, thanks @rakshitgondwal for mentioning me in; In my proposal I have proposed to implement around 4 providers. But the exact providers will be decided after discussing with the mentors (if my proposal get selected). I think @prateek041 can go ahead with his provider of choice at this point.
Amazing! All yours then @prateek041
Thanks to everyone :) @prateek041, you can choose the one that you're more familiar with - or both 😝
Perhaps a "dummy" provider (I know @thisthat mentioned this at kubecon but for the benefit of others on this thread).
Doing this and documenting how would (I believe) help explain the concept, without readers being scared by the possibility "oh, I don't know how (vendor X) works so I can't read this documentation". For example, "this page is based on AWS Cloudwatch and I don't know / use AWS so I can't follow it, so I won't bother".
My 2c.
Edit: This endpoint actually already exists: GET http://www.randomnumberapi.com/api/v1.0/random
so it's even easier now :)
@prateek041 If you want to go with one then you should go for aws as it is one of the most preferred choices for many developers. Since I have also applied for gsoc project for metric provider, I think aws will be a good choice.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This should be re-opened as it is absolutely necessary.
@prateek041 if you still wanna work on this, i'll gladly re-assign you :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi, Is this issue still open? I think I can contribute to this issue but I would need some help from experienced maintainers. Basically, last year I implemented the Datadog
provider so I have some experience in this. But to be honest, with a long gap, I forgot a lot of things.
I can start over and write the guide if no one is currently working on it.
This issue will be unassigned in 1 week if no further activity is seen. If you are active please provide an update on the status of the issue and if you would like to continue working on it.
Re-open as this is necessary. @sudiptob2 are you still able to work on this?
@agardnerIT, yes still interested in this one. However, occupied with another issue at this moment. If anyone else is available, feel free to work on it.
@mowies could you please assign this issue to me.
done! note, that somebody already started working on this but never finished, so there's an old and closed PR for this issue already that you could check out (#1382)
done! note, that somebody already started working on this but never finished, so there's an old and closed PR for this issue already that you could check out (#1382)
Alright thanks I will check it out.
Hi @mowies I'm facing some difficulties testing the dummy provider as the api am using is inconsistent with it output since it generating random number so therefore i want to change to something else let's say https://restcountries.com api that returns countries and information relating to them that way we have some consistency in the api output. cc @StackScribe
A different API is definitely fine, sure!
But keep in mind that the biggest part of this ticket should be documentation on how to implement a new provider, not necessarily a new provider in itself.
EDIT: I see you already added some docs, nice!
Currently,
prometheus
,datadog
,dynatrace
and (dynatrace)dql
are supportedKeptnMetricsProvider
s but it is expected that others will want to write new providers for other metric backends.The documentation should contain an explanation about how to achieve this goal.