-
Notifications
You must be signed in to change notification settings - Fork 740
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
Add Splunk as a metrics provider #1733
Conversation
6bdcfb0
to
a4bb1cb
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.
thanks for opening this PR! left a few comments
pkg/metrics/providers/splunk.go
Outdated
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1" | ||
) | ||
|
||
// https://docs.datadoghq.com/api/ |
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.
please change this to splunk's api docs
pkg/metrics/providers/splunk.go
Outdated
|
||
sp := SplunkProvider{ | ||
timeout: 5 * time.Second, | ||
metricsQueryEndpoint: strings.Replace(strings.Replace(address+signalFxSignalFlowApiPath, "http", "ws", 1), "api", "stream", 1), |
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.
could you add some context here?
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 library used to handle the signalflow api uses websockets to connect, so the address is converted.
I've added a COMMENT.
|
||
signalFxTokenHeaderKey = "X-SF-Token" | ||
|
||
signalFxFromDeltaMultiplierOnMetricInterval = 10 |
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.
could you specify the purpose of this?
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 referred to the datadog implementation.
In some cases, the splunk api could only acquire empty data if the specified period was short, so to ensure that data is acquired, a period 10 times longer than the set interval is used.
@aryan9600 |
Hi reviewer team @stefanprodan @aryan9600, |
pkg/metrics/providers/splunk.go
Outdated
@@ -0,0 +1,195 @@ | |||
/* | |||
Copyright 2020 The Flux authors |
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.
This should be Copyright 2024
in all new files added in this PR
docs/gitbook/usage/metrics.md
Outdated
query: | | ||
total = data('traces.count', filter=filter('sf_service', 'my-service-primary', 'my-service')).sum().publish(enable=False) | ||
success = data('traces.count', filter=filter('sf_service', 'my-service-primary', 'my-service') and filter('sf_error', 'false')).sum().publish(enable=False) | ||
((success/total) * 100).publish() |
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.
@kane8n did you tested this with Flagger? By the looks of it, this includes the primary service traces, but Flagger should look at the canary only. Also we should be using the template variables here.
@stefanprodan |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1733 +/- ##
==========================================
+ Coverage 35.08% 39.24% +4.15%
==========================================
Files 283 284 +1
Lines 24653 22354 -2299
==========================================
+ Hits 8650 8773 +123
+ Misses 15063 12634 -2429
- Partials 940 947 +7 ☔ View full report in Codecov by Sentry. |
@kane8n please squash all commits into one |
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.
lgtm! thanks @kane8n 🎖️
Signed-off-by: kane8n <[email protected]>
d0a0852
to
d4bd0f2
Compare
done! |
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.
LGTM
Thanks @kane8n
This PullRequest adds Splunk as a metrics provider.
It has been tested on my cluster.