-
Notifications
You must be signed in to change notification settings - Fork 738
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: kane8n <[email protected]>
Signed-off-by: kane8n <[email protected]>
Signed-off-by: kane8n <[email protected]>
Signed-off-by: kane8n <[email protected]>
Signed-off-by: kane8n <[email protected]>
6bdcfb0
to
a4bb1cb
Compare
Signed-off-by: kane8n <[email protected]>
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.
return 0, fmt.Errorf("invalid response: %w", ErrNoValuesFound) | ||
} | ||
_payloads := slices.Clone(payloads) | ||
slices.SortFunc(_payloads, func(i, j messages.DataPayload) int { |
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.
some comments explaining this logic would be nice
Signed-off-by: kane8n <[email protected]>
@aryan9600 |
This PullRequest adds Splunk as a metrics provider.
It has been tested on my cluster.