Skip to content

[PLUGIN REPORTS] - Micrometer Plugin #268

@songxychn

Description

@songxychn

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions