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

[PLUGIN REPORTS] - Micrometer Plugin #268

Open
songxychn opened this issue May 24, 2024 · 0 comments
Open

[PLUGIN REPORTS] - Micrometer Plugin #268

songxychn opened this issue May 24, 2024 · 0 comments

Comments

@songxychn
Copy link

the document of Micrometer Plugin is outdated.
i'm configuring prometheus for my javalin app. the versions are below:

<dependency>
    <groupId>io.javalin</groupId>
    <artifactId>javalin</artifactId>
    <version>6.1.4</version>
</dependency>
<dependency>
    <groupId>io.javalin</groupId>
    <artifactId>javalin-micrometer</artifactId>
    <version>6.1.3</version>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
    <version>1.12.5</version>
</dependency>

the code in document can't be compiled correctly. the code below works:

PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
Javalin.create(config -> {
            config.registerPlugin(new MicrometerPlugin(micrometerPluginConfig -> {
                micrometerPluginConfig.registry = registry;
            }));
        })
        .get("/prometheus", context -> context.contentType(TextFormat.CONTENT_TYPE_004).result(registry.scrape()))
        .start(7000);
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

No branches or pull requests

1 participant