Skip to content

feat: add support for UTF-8 and new UTF-8 related validators - #96

Open
FUSAKLA wants to merge 2 commits into
masterfrom
fus-marine-shrimp
Open

feat: add support for UTF-8 and new UTF-8 related validators#96
FUSAKLA wants to merge 2 commits into
masterfrom
fus-marine-shrimp

Conversation

@FUSAKLA

@FUSAKLA FUSAKLA commented Oct 31, 2024

Copy link
Copy Markdown
Owner

fixes #88

  • enable UTF-8 support in label and metric names by default
  • add validator to disallow using the UTF-8 (this should be used as a default for now, UTF-8 support is still in early stages in Prometheus)

this change will probably result into new major version, since the UTF-8 support might be breaking

Signed-off-by: Martin Chodur [email protected]

@FUSAKLA

FUSAKLA commented Oct 31, 2024

Copy link
Copy Markdown
Owner Author

@jmichalek132 would you give it a try? 🙏

Signed-off-by: Martin Chodur <[email protected]>
@jmichalek132

Copy link
Copy Markdown
Contributor

FYI with Prometheus 3.X UTF-8 support is enabled by default, but some backends like Mimir / Cortex / Thanos might not support it yet.

Comment thread CHANGELOG.md
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Change: :warning: Enable UTF-8 support in metic and label names by default. To disallow usage of UTF-8 characters in metric and label names use the new validator [`doesNotUseUTF8`](./docs/validations.md#doesnotuseutf8).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Change: :warning: Enable UTF-8 support in metic and label names by default. To disallow usage of UTF-8 characters in metric and label names use the new validator [`doesNotUseUTF8`](./docs/validations.md#doesnotuseutf8).
- Change: :warning: Enable UTF-8 support in metric and label names by default. To disallow usage of UTF-8 characters in metric and label names use the new validator [`doesNotUseUTF8`](./docs/validations.md#doesnotuseutf8).

@jmichalek132 jmichalek132 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, 2 small comments left.

@jmichalek132

Copy link
Copy Markdown
Contributor

Given the UTF-8 support was added to better support OTEL metrics, and the only character that was not allowed in Prometheus but is commonly used in OTEL is dot, it might be worth considering adding a validation that allows Prometheus charset + dot, without allowing other UTF-8 characters.

Comment thread CHANGELOG.md

## [Unreleased]
- Change: :warning: Enable UTF-8 support in metic and label names by default. To disallow usage of UTF-8 characters in metric and label names use the new validator [`doesNotUseUTF8`](./docs/validations.md#doesnotuseutf8).
- Added: new validator [`doesNotUseUTF8`](./docs/validations.md#doesnotuseemoji) to check if the metric and label names do not use UTF-8 characters.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to add this specific type of utf8 character as opposed to any of the other blocks? It seems arbitrary. (Why not also exclude arrows or other symbols?)

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.

Add support for utf-8 🎉🎉🎉🎉🎉

3 participants