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-client): provide builder APIs similar to PrometheusLayer #5043

Conversation

koushiro
Copy link
Member

Which issue does this PR close?

No

Rationale for this change

provide similar APIs like PrometheusLayer

What changes are included in this PR?

  • add builder pattern APIs

Are there any user-facing changes?

  • add builder APIs
    • PrometheusClientLayer::builder

@koushiro koushiro marked this pull request as ready for review August 24, 2024 12:12
@koushiro koushiro requested a review from Xuanwo as a code owner August 24, 2024 12:12
}

/// Create a [`PrometheusClientLayerBuilder`].
pub fn builder() -> PrometheusClientLayerBuilder {
Copy link
Member

Choose a reason for hiding this comment

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

Hi, we usually avoid providing too many structures at the layer level. How about just exposing the API at the PrometheusClientLayer level?

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.

The design of the prometheus library and the prometheus-client library is quite different.

For prometheus-client library, we have to accept the &mut Registry type to register our configured metrics.
If we want to provide some configurable methods similar to the PrometheusLayer, it seems that we have to construct the configuration through an additional type.

Do you have any other good ideas?

BTW, for prometheus library, we could expose the configurable APIs at the PrometheusLayer level.

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