Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

kane8n
Copy link

@kane8n kane8n commented Nov 28, 2024

This PullRequest adds Splunk as a metrics provider.
It has been tested on my cluster.

@kane8n kane8n force-pushed the add-splunk-provider branch from 6bdcfb0 to a4bb1cb Compare November 28, 2024 12:42
Copy link
Member

@aryan9600 aryan9600 left a 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

flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
)

// https://docs.datadoghq.com/api/
Copy link
Member

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


sp := SplunkProvider{
timeout: 5 * time.Second,
metricsQueryEndpoint: strings.Replace(strings.Replace(address+signalFxSignalFlowApiPath, "http", "ws", 1), "api", "stream", 1),
Copy link
Member

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?

Copy link
Author

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
Copy link
Member

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?

Copy link
Author

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 {
Copy link
Member

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]>
@kane8n
Copy link
Author

kane8n commented Dec 1, 2024

@aryan9600
Thanks for the review!
I added some comments.

@kane8n kane8n requested a review from aryan9600 December 1, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants