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

inmem: allow streaming of metrics as intervals complete #125

Merged
merged 3 commits into from Jun 14, 2021

Conversation

dnephin
Copy link
Contributor

@dnephin dnephin commented Jun 10, 2021

Related to one of the items in hashicorp/consul#10320

We use the InMemSink to capture metrics for the debug archive, but the previous implementation resulted in us missing a lot of metrics because only 1/3 of the intervals were captured. Attempting to request the metrics at each interval is a challenge (maybe impossible), so instead this PR adds for an HTTP handler that sends metrics each time an interval completes.

inmem.go Show resolved Hide resolved
These functions were only called in a single place, and repeated some of the same logic.

This change is made in preparation for streaming metrics.
inmem_endpoint.go Outdated Show resolved Hide resolved
Copy link

@freddygv freddygv left a comment

Choose a reason for hiding this comment

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

Awesome, this is a big improvement

inmem.go Show resolved Hide resolved
inmem_endpoint_test.go Show resolved Hide resolved
Copy link
Member

@banks banks left a comment

Choose a reason for hiding this comment

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

This is a cool! One Q inline but I can merge this if it's not an issue!

inmem_endpoint.go Outdated Show resolved Hide resolved
inmem_endpoint.go Outdated Show resolved Hide resolved
This will allow `consul debug` to include all the metrics, instead of
missing many metrics.
Copy link
Member

@banks banks left a comment

Choose a reason for hiding this comment

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

LGTM as it is here.

Do you want to make the encoder passing change @dnephin? I'm happy to merge as-is but let me know if you want to get that in first.

@dnephin
Copy link
Contributor Author

dnephin commented Jun 14, 2021

I pushed another commit which reduces the interface that Stream uses. This should make it easier to integrate into an API handler. It would allow someone to customize the encoding and would also allow someone to use the method with a different type of API.

I think this is ready for merge now.

Copy link
Member

@banks banks left a comment

Choose a reason for hiding this comment

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

Nice. I like the interface.

@banks banks merged commit f792dbc into hashicorp:master Jun 14, 2021
@dnephin dnephin deleted the dnephin/stream-metrics branch June 14, 2021 19:43
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.

None yet

3 participants