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

support scraping additional metrics #100

Closed
wants to merge 1 commit into from

Conversation

cbodonnell
Copy link
Contributor

What this PR does / why we need it:

This PR adds support for an additionalMetricsEndpoint configuration value. When configured, the SDK will scrape the endpoint for additional metrics to be reported along with its standard heartbeat data. The endpoint should return a json payload containing key-value pairs in the format:

{
    "key": "value",
    ...
}

Which issue(s) this PR fixes:

https://app.shortcut.com/replicated/story/88175/add-a-helm-value-to-the-sdk-to-accept-an-endpoint-where-it-retrieves-additional-metrics-to-be-reported

Special notes for your reviewer:

Steps to reproduce

Does this PR introduce a user-facing change?


Does this PR require documentation?

@@ -56,3 +56,4 @@ isAirgap: false
userAgent: ""
replicatedID: ""
appID: ""
additionalMetricsEndpoint: ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on supporting multiple endpoints here? asking because it's what copilot kept trying to guide me towards :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's actually a good idea.

@cbodonnell cbodonnell requested a review from sgalsaleh October 10, 2023 14:45
if sdkStore.GetAdditionalMetricsEndpoint() != "" {
additionalMetrics, err := getAdditionalMetrics(sdkStore.GetAdditionalMetricsEndpoint(), sdkStore.GetLicense().Spec.LicenseID)
if err != nil {
logger.Errorf("failed to get additional metrics: %v", err.Error())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, only logging an error and continuing to report without the additional metrics can be problematic. let's discuss.

@cbodonnell cbodonnell closed this Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants