Skip to content

Invalid unicode output #1576

@jonatan-ivanov

Description

@jonatan-ivanov

If I do this:

PrometheusRegistry registry = new PrometheusRegistry();
Counter.builder()
    .name("test_我喜欢茶")
    .labelNames("test")
    .register(registry)
    .labelValues("test_我喜欢茶").inc();
String accept = OpenMetricsTextFormatWriter.CONTENT_TYPE + "; escaping=allow-utf-8";
ExpositionFormats.init().findWriter(accept).write(System.out, registry.scrape(), EscapingScheme.fromAcceptHeader(accept));

I get this:

# TYPE "test_我喜欢茶" counter
{"test_我喜欢茶_total",test="test_我喜欢茶"} 1.0
# EOF

If I remove the non-ascii characters (still UTF-8 allowed), I get the usual output:

# TYPE test counter
test_total{test="test"} 1.0
# EOF

Is this expected?

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