Add Splunk as a metrics provider#1733
Conversation
6bdcfb0 to
a4bb1cb
Compare
aryan9600
left a comment
There was a problem hiding this comment.
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.
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.
could you add some context here?
There was a problem hiding this comment.
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.
could you specify the purpose of this?
There was a problem hiding this comment.
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.
This should be Copyright 2024 in all new files added in this PR
| 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.
@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 |
Signed-off-by: kane8n <takumi.kaneda@zozo.com>
d0a0852 to
d4bd0f2
Compare
done! |
This PullRequest adds Splunk as a metrics provider.
It has been tested on my cluster.