Skip to content

Duplicate type or unit suffixes when utf8 is allowed #44

@dashpole

Description

@dashpole

Context: open-telemetry/opentelemetry-go#7044

When UTF8Allowed=true,

otlptranslator.Metric{
    Name: "foo.seconds"
    Type: otlptranslator.MetricTypeMonotonicCounter
    Unit: "s"
}

becomes foo.seconds_seconds_total. Expected: foo.seconds_total.

otlptranslator.Metric{
    Name: "foo.total"
    Type: otlptranslator.MetricTypeMonotonicCounter
    Unit: "s"
}

becomes foo.total_seconds_total. Expected: foo_seconds_total.

It looks like we simply append suffixes when UTF8 is allowed:

name += "_total"

But we have a more sophisticated strategy for making sure we don't get duplicate suffixes when UFF8 is not allowed:

nameTokens = append(removeItem(nameTokens, "total"), "total")

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