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

refactor(layers/prometheus): use the same metrics as prometheus-client layer and provide similar APIs #5042

Closed

Conversation

koushiro
Copy link
Member

Which issue does this PR close?

No

Rationale for this change

I would expect both layers (PrometheusLayer and PrometheusClientLayer) to export the same metrics and provide similar APIs, with the only difference being the different prometheus libraries they use.

What changes are included in this PR?

  • unify the metrics, same as PrometheusClientLayer
  • add builder pattern API for PrometheusLayer
  • refactor LayeredAccess impl

Are there any user-facing changes?

  • rename
    • PrometheusLayer::with_registry => PrometheusLayer::new
  • remove
    • requests_duration_seconds_buckets
    • bytes_total_buckets
    • enable_path_label
  • add builder API
    • PrometheusLayer::builder

}

/// [`PrometheusLayerBuilder`] is a config builder to build a [`PrometheusLayer`].
pub struct PrometheusLayerBuilder {
Copy link
Member Author

@koushiro koushiro Aug 24, 2024

Choose a reason for hiding this comment

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

I want to provide similar APIs for prometheus layer and prometheus-client layer,
however, the design of the prometheus library and the prometheus-client library is quite different, so I need to provide this builder pattern to construct a similar API.

prometheus-client layer: #5043

@Xuanwo
Copy link
Member

Xuanwo commented Aug 24, 2024

This PR makes think if we can reuse similar code in prometheus / prometheus_client / metrics layer.

@koushiro koushiro marked this pull request as draft August 24, 2024 15:41
@koushiro koushiro closed this Aug 28, 2024
@koushiro koushiro deleted the refactor-prometheus-layer branch August 28, 2024 13:05
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