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

Allow customizing PrometheusProperties via PrometheusConfig #4921

Merged

Conversation

jonatan-ivanov
Copy link
Member

No description provided.

@jonatan-ivanov jonatan-ivanov added the enhancement A general enhancement label Apr 4, 2024
@jonatan-ivanov jonatan-ivanov added this to the 1.13.0-RC1 milestone Apr 4, 2024
@jonatan-ivanov jonatan-ivanov added the registry: prometheus A Prometheus Registry related issue label Apr 4, 2024
@Nullable
default Properties prometheusProperties() {
Properties properties = new Properties();
properties.setProperty("io.prometheus.exporter.exemplarsOnAllMetricTypes", "true");
Copy link
Member Author

Choose a reason for hiding this comment

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

We enable exemplars by default.
If somebody overrides this method, they can do this to reuse the Micrometer defaults but also define their own (see the tests):

@Override
public Properties prometheusProperties() {
    Properties properties = new Properties();
    properties.putAll(PrometheusConfig.super.prometheusProperties());
    properties.setProperty("io.prometheus.exemplars.sampleIntervalMilliseconds", "42");
    return properties;
}

@jonatan-ivanov jonatan-ivanov linked an issue Apr 5, 2024 that may be closed by this pull request
@jonatan-ivanov jonatan-ivanov removed this from the 1.13.0-RC1 milestone Apr 5, 2024
@jonatan-ivanov jonatan-ivanov removed enhancement A general enhancement registry: prometheus A Prometheus Registry related issue labels Apr 5, 2024
Copy link
Member

@shakuzen shakuzen left a comment

Choose a reason for hiding this comment

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

Looks good. I left some feedback we can consider in a follow-up if we want to pursue it.

@shakuzen shakuzen changed the title Integrate with PrometheusProperties Allow customizing PrometheusProperties via PrometheusConfig Apr 5, 2024
@shakuzen shakuzen merged commit 7f2936a into micrometer-metrics:main Apr 5, 2024
6 checks passed
@jonatan-ivanov jonatan-ivanov deleted the prometheus-properties branch April 5, 2024 06:17
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.

Allow customizing PrometheusProperties via PrometheusConfig
2 participants