-
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 New Relic metricprovider #772
Conversation
@@ -130,6 +130,8 @@ type MetricProvider struct { | |||
Web *WebMetric `json:"web,omitempty"` | |||
// Wavefront specifies the wavefront metric to query | |||
Wavefront *WavefrontMetric `json:"wavefront,omitempty"` | |||
// NewRelic specifies the newrelic metric to query | |||
NewRelic *NewRelicMetric `json:"newrelic,omitempty"` |
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.
The API violation in violation_exceptions.list
is complaining that NewRelic
has the R
in the field name uppercased, but the JSON tag is all lowercase. The json tag should be newRelic
to avoid the violation.
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.
Thanks I'll get that fixed up!
docs/features/analysis.md
Outdated
region: "us" | ||
accountID: 1234 |
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 have some questions about the appropriate level of where region and accountID should be configured. i.e. could/should this be configuration at the controller level vs. AnalysisTemplate level? Maybe these clarifying questions would help me better understand:
-
can the same account ID be used in different regions? If not, then I think we should eliminate
region
from the analysis spec, and configure the region centrally (same place where the accountID api-key is specified). -
is it common to have multiple accountIDs in the same organization? If most organizations use a single accountID, I would propose to make their experience better / less configuration by not require accountID to be specified in the AnalysisTemplate, and provide a way where a single accountID could be configured centrally. Then AnalysisTemplates would only need to specify
query
and nothing else.
If there is a need / use case to support multiple accountIDs within the same cluster/organization, I think accountID could still be made an optional field in the analysis spec, but when omitted, the controller could either use a designated "default" accountID / region, or infer the accountID/region/key if there is only a single accountID configured.
Note that a very similar discussion just happened with the Datadog provider:
#705 (comment)
With DataDog, it was decided that it would be uncommon for a single organization to configure multiple DataDog API/APP keys, so currently argo-rollouts will look to a single Datadog secret for its configuration:
apiVersion: v1
kind: Secret
metadata:
name: datadog
data:
address: https://api.datadoghq.com
api-key: igq7imbxlm97vnlw61bo
app-key: 35bu8ofvc0osyjmqxtgi
NOTE that this doesn't preclude the possibility in the future to support multiple Datadog secrets/api-keys in the same cluster, but it makes the default end-user/developer experience better since end-users do not need to concern themselves with specifying addresses/API/APP keys in the AnalysisTemplate.
Another example is with wavefront. With wavefront, it is common to use different wavefront hosts even within the same cluster. So, it's configuration looks like this:
Centrally configured mapping from Host-to-API tokens:
apiVersion: v1
kind: Secret
metadata:
name: wavefront-api-tokens
type: Opaque
data:
example1.wavefront.com: <token1>
example2.wavefront.com: <token2>
In the AnalysisTemplate, a reference to which host to use:
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: success-rate
spec:
args:
- name: service-name
metrics:
- name: success-rate
interval: 5m
successCondition: result >= 0.95
provider:
wavefront:
address: example.wavefront.com
Given the DataDog and Wavefront examples, which approach would NewRelic more closely follow?
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.
Thanks for the detailed feedback @jessesuen!
Based on your feedback I am working on updating this PR with changes that will more closely follow the pattern used by DataDog. New Relic API keys are specific to an account ID and accounts are specific to a region of New Relic. Given that, the model of putting all of the configuration into the secret to be a global config makes a lot more sense.
I am adding support for multiple secrets out of the gate because we have the need to support multiple accounts within a given cluster. It's fairly common for New Relic users to have primary accounts with sub-accounts that each have their own monitored applications and separate API keys.
8d1e1f9
to
2980062
Compare
Updated the New Relic configuration to more closely match other consumers of the newrelic-client-go library like the newrelic-cli which uses profiles for credentials.
|
Hey @jessesuen can you please give this another look when you get a chance? I'll try to clear the new merge conflicts as soon as possible. Thanks!! |
docs/features/analysis.md
Outdated
successCondition: result.successRate >= 0.95 | ||
provider: | ||
newRelic: | ||
profileSecretName: my-newrelic-secret # optional, defaults to 'newrelic' |
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 like the idea of profiles, which match the new relic CLI. However, I'd prefer to keep the fact that profiles are stored as secrets, an implementation detail from the spec. So can we rename this to just profile
?
@jwelch92 this looks just about ready to go. The only change I think needs to be done is renaming In the future, this would free us to change the implementation of how profiles are stored, and the spec would still make sense. For example, newrelic profiles could be changed to be configured in a central configmap, and reference arbitrarily named secrets. |
- Removed accountID and region fields from the NewRelic metric spec - Modified expected secret format to include account ID, region, and api key - added new field to metric spec to support multiple New Relic config secrets
2980062
to
444f2dc
Compare
@@ -5647,8 +5661,6 @@ spec: | |||
properties: | |||
datadog: | |||
properties: | |||
address: |
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.
Hmm not sure why this diff is showing for datadog. I rebased upstream master and ran codegen and rebuilt manifests.
Thanks again @jessesuen! Updated with your requested changes. |
Build failed on tests unrelated to my changes..is master broken right now? I rebased yesterday when I was fixing up my changes. |
Let me check. Heads up, I might commit to your fork/branch if it's something I can easily fix. |
Codecov Report
@@ Coverage Diff @@
## master #772 +/- ##
==========================================
+ Coverage 82.34% 82.37% +0.03%
==========================================
Files 96 97 +1
Lines 8202 8279 +77
==========================================
+ Hits 6754 6820 +66
- Misses 1037 1045 +8
- Partials 411 414 +3
Continue to review full report at Codecov.
|
Seems it just needed to resubmit and it passed. Great work! |
Closes #736
Due to the different result format for NRQL queries I had to deviate a bit from some of the common result representations in the other providers. I hope the documentation makes it clear how to use the results correctly.
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.