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

feat: Add support for all Prometheus metric types + internal refactor. #80

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

bwplotka
Copy link
Member

@bwplotka bwplotka commented Sep 16, 2024

This PR refreshes avalanche binary, while adding support for all Prometheus metric type.

This should not break compatibility (even if we can), but I deprecate one flag.

Fixes #77

High level changes (as in the CHANGLOG):

  • add support for all metric types
  • deprecated --metric-count flag
  • --*-interval flags set to 0 means no change logic
  • added OpenMetrics support

Refactor:

  • Unglobalized flags and registry/metrics.
  • Moved trillion arguments to one config struct for metrics; moved flags next to config.
  • Use unchecked collector instead of unregistering metrics all the time
  • Add sigterm/interrupt catching
  • Updated tests

@bwplotka bwplotka force-pushed the distr branch 3 times, most recently from 0485fc3 to fcda049 Compare September 16, 2024 12:03
Copy link
Collaborator

@saswatamcode saswatamcode left a comment

Choose a reason for hiding this comment

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

Thanks a lot for doing this refactor and adding all types! Looks really neat! ❤️
Some small comments.

cfg := metrics.NewConfigFromFlags(kingpin.Flag)
port := kingpin.Flag("port", "Port to serve at").Default("9001").Int()
remoteURL := kingpin.Flag("remote-url", "URL to send samples via remote_write API.").URL()
// TODO(bwplotka): Kill pprof feature, you can install OSS continuous profiling easily instead.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree!

README.md Outdated Show resolved Hide resolved
metrics/serve.go Outdated Show resolved Hide resolved
metrics/write.go Show resolved Hide resolved
cmd/avalanche.go Show resolved Hide resolved
Delete(labels prometheus.Labels) bool
}

func deleteValues[T seriesDeleter](metrics []T, labelKeys, labelValues []string, seriesCount, seriesCycle int) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice use of generics!

Co-authored-by: Saswata Mukherjee <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
Copy link
Collaborator

@saswatamcode saswatamcode left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Big PR to review without much involvement in the project hehe

I've tried it by running and manually checking the /metrics endpoint, LGTM! This looks perfect for benchmarking our work with @Maniktherana in prometheus/prometheus. And if we implement PRWv2 it also looks perfect for the work we're doing with @jmichalek132 in the collector :)

cmd/avalanche.go Show resolved Hide resolved
metrics/serve.go Show resolved Hide resolved
@beorn7
Copy link

beorn7 commented Sep 17, 2024

Is there anything in particular I should review here? I don't think I will find time for a full review anytime soon. I don't even know this project.

@bwplotka
Copy link
Member Author

Is there anything in particular I should review here? I don't think I will find time for a full review anytime soon. I don't even know this project.

Yea don't worry - I didn't know this codebase yesterday either. But anyway, I am actually no longer sure why I pinged you, sorry for spam and considering 🙈

Since no objections I will allow myself to merge this, we can always revert. I pinged current maintainers and not sure if they are still active in this project, will try more and perhaps propose myself in the meantime here.

@bwplotka bwplotka merged commit 55ea55a into main Sep 18, 2024
7 checks passed
@bwplotka bwplotka deleted the distr branch September 18, 2024 07:48
prateeknayak pushed a commit to prateeknayak/avalanche that referenced this pull request Jan 2, 2025
prometheus-community#80)

* feat: Add support for all Prometheus metric types + internal refactor.

Fixes prometheus-community#77


* Apply suggestions from code review

Co-authored-by: Saswata Mukherjee <[email protected]>

---------

Co-authored-by: Saswata Mukherjee <[email protected]>
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.

Add healthy distribution for different metric types.
4 participants