-
Notifications
You must be signed in to change notification settings - Fork 880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add datadog metric provider. Fixes #702 #705
Conversation
c9f5710
to
815d4c2
Compare
Codecov Report
@@ Coverage Diff @@
## master #705 +/- ##
==========================================
- Coverage 84.51% 82.88% -1.63%
==========================================
Files 95 96 +1
Lines 8988 8034 -954
==========================================
- Hits 7596 6659 -937
+ Misses 983 964 -19
- Partials 409 411 +2
Continue to review full report at Codecov.
|
I think we need to treat DataDog API Keys and App Keys more first class in the metric provider spec. For reference, this is how we do something similar wavefront: I've read through https://docs.datadoghq.com/account_management/api-app-keys/, but I still have some questions on where would be an appropriate place to configure API keys and app keys. With Wavefront, a single API token can be specified for an entire domain, e.g. Since I don't understand DataDog, can you answer some questions about it:
|
Hi @jessesuen I'll make those changes over the weekend, but to answer your questions around DataDog: I wasn't aware of the 5-API key limit. Our organisation is a heavy datadog user and we appear to have had that limit waivered as we have over 200 API keys (each team has a key per environment, and some are using different keys for different servcies). In our org each team is encouraged to create their own API & App keys, but not through DataDog directly (presumably because only admins can create API keys) Application keys are tied to a user, so I imagine even in other organisations they are creating app keys per service. Just checking the issues, I think @johnkost & @ozooxo might be using DataDog - I don't know if they want to weigh in here. |
We use DataDog as well and haven't had any issues with the 5-API key limit (roughly same setup as @stephen-harris). I think it makes sense to have this setup similarly at the controller level as Argo-Rollouts is an application, just like any of the other apps we have. |
If anyone wants to try this out, I've published an image which forks off of 0.9.0: https://hub.docker.com/layers/stephenharris13/argo-rollouts/0.9.0-datadog-bbf9c9b/images/sha256-8151ef6208e792eacd19d476f238c0ed605a8c250f75faea1e4d766c993d91bc?context=explore |
docs/features/analysis.md
Outdated
name: wavefront-api-tokens | ||
type: Opaque | ||
data: | ||
api-key: <datadog-api-key> | ||
app-key: <datadog-app-key> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- docs still say "wavefront-api-tokens". I think this should be
datadog-auth-keys
- don't we need to allow multiple API/APP keys to be configured?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) - oops! It should be datadog
. Fixed now
(2) - I don't thinks so. All key pairs are assigned to the organisation, and using them you can pull any metrics from your organisation. Our organisation encourages teams to own their own keys, but team a can use its keys to access metrics reported by team b. We could make the secret name configurable, and you specify it as an AnalysisTemplate parameter, but I don't see the value in doing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I'll take your word for it, but I'll also pose the question in #argo-rollouts slack in case there's users who may need to configure multiple, in case there's something we're missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear:
With the proposed spec, we allow the DataDog address
to be specified in the metric (so it can vary between AnalysisTemplates), but API/APP keys are configured centrally in the controller. This presumes that the same API/APP key can be used for different DataDog URLs. This may very well be possible with DataDog (I don't know the answer to this), but I wanted to call that out as a potential flaw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. No API/APP keys are not cross-site. In fact I believe an organisation is in either the EU or US site. Although not a secret, for ease of configuration we could move these to the datadog
secret (alongside app_key
and api_key
). What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I agree we should make the address and api/app keys centrally configured, and remove the address
field from the metric. I'm thinking the Secret should look something like:
data:
default: |
address: https://api.datadoghq.com
api-key: igq7imbxlm97vnlw61bo
app-key: 35bu8ofvc0osyjmqxtgi
This also leaves the door open so if in the future, multiple addresses and/or app keys could to be specified in the same cluster. e.g.:
data:
us-app1: |
address: https://api.datadoghq.com
api-key: igq7imbxlm97vnlw61bo
app-key: 35bu8ofvc0osyjmqxtgi
us-app2: |
address: https://api.datadoghq.com
api-key: igq7imbxlm97vnlw61bo
app-key: cb7ehxo1jwagyceth8v8
eu: |
address: https://api.datadoghq.eu
api-key: cb7ehxo1jwagyceth8v8
app-key: timk0do15pafuvmfwimg
And the names us-app1
and us-app2
could be referenced in the metric.
But for MVP, for simplicity, we can go out with a single configured DataDog region and single api/app key combination.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've implemented this, though I'm starting to think perhaps we should have just one level (e.g. a secret per app/region), and then reference the name of the secret in the metric.
apiVersion: v1
kind: Secret
metadata:
name: datadog
data:
address: https://api.datadoghq.com
api-key: igq7imbxlm97vnlw61bo
app-key: 35bu8ofvc0osyjmqxtgi
---
apiVersion: v1
kind: Secret
metadata:
name: datadog-app2
data:
address: https://api.datadoghq.eu
api-key: cb7ehxo1jwagyceth8v8
app-key: timk0do15pafuvmfwimg
Not too fussed though; I think in most use cases organisations will only have one region, and will only have key pair used by rollouts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though I'm starting to think perhaps we should have just one level (e.g. a secret per app/region), and then reference the name of the secret in the metric.
Actually I agree with you. A secret per app/region sounds better as it doesn't put a special datastructure in the secret payload. Then things like kustomize patching the secret will just work. Let's go with your suggestion, but we don't have to do anything yet with regards to referencing until someone has a need to reference multiple regions.
3ed3178
to
e7b5bae
Compare
metricproviders/datadog/datadog.go
Outdated
|
||
func NewDatadogProvider(logCtx log.Entry, kubeclientset kubernetes.Interface) (*Provider, error) { | ||
ns := Namespace() | ||
secret, err := kubeclientset.CoreV1().Secrets(ns).Get(DatadogTokensSecretName, metav1.GetOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I updated the k8s libraries from underneath you, which now require context objects passed into every call. You can just use context.TODO() for now.
3d77904
to
6f2c557
Compare
…f multiple key pairs
Codecov Report
@@ Coverage Diff @@
## master #705 +/- ##
==========================================
- Coverage 82.66% 82.56% -0.11%
==========================================
Files 95 96 +1
Lines 8071 8162 +91
==========================================
+ Hits 6672 6739 +67
- Misses 997 1013 +16
- Partials 402 410 +8
Continue to review full report at Codecov.
|
6f2c557
to
f42d41e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.