Skip to content

fix(dropwizard5): use locale-independent placeholder keys in GraphiteNamePattern - #2619

Open
sharanggupta wants to merge 1 commit into
prometheus:mainfrom
sharanggupta:graphite-name-pattern-locale
Open

sharanggupta wants to merge 1 commit into
prometheus:mainfrom
sharanggupta:graphite-name-pattern-locale

Conversation

@sharanggupta

Copy link
Copy Markdown

GraphiteNamePattern.extractParameters builds its placeholder keys with String.format("${%d}", ...), so under a default locale with non-ASCII digits such as ar-EG the first key is ${٠} and CustomLabelMapper leaves ${0} in the mapped name and labels (app_requests_${0}_total instead of app_requests_get_total). This builds the keys with string concatenation, which does not depend on the locale, and also covers the dropwizard module since it uses the same mapper. The new GraphiteNamePatternTest case runs with ar-EG as the default locale and fails without the fix.

@zeitlinger

…NamePattern

extractParameters formatted the "${n}" keys with the default locale, so
under a locale such as ar-EG the keys used Arabic-Indic digits and
CustomLabelMapper left "${0}" unreplaced in mapped names and labels.
Build the keys with string concatenation instead.

Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>

This branch has not been deployed

No deployments
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.

1 participant