Skip to content

metrics-generator: truncate label names and values exceeding a configurable length#1897

Merged
yvrhdn merged 3 commits intografana:mainfrom
yvrhdn:kvrhdn/metrics-generator-truncate-label-value
Nov 17, 2022
Merged

metrics-generator: truncate label names and values exceeding a configurable length#1897
yvrhdn merged 3 commits intografana:mainfrom
yvrhdn:kvrhdn/metrics-generator-truncate-label-value

Conversation

@yvrhdn
Copy link
Copy Markdown
Contributor

@yvrhdn yvrhdn commented Nov 17, 2022

What this PR does:
Metrics backends will often enforce a maximum label name and label value length to protect their inner working. E.g. for label values Prometheus has label_value_length_limit (default = 0), Mimir has max_label_value_length (default = 2048).

This PR adds configuration parameters max_label_name_legnth (defaults to 1024) and max_label_value_length (defaults to 2048) to optionally truncate label names and values. The defaults match the defaults from Mimir (Prometheus validation is disabled by default).

Which issue(s) this PR fixes:
Fixes #1804

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@yvrhdn yvrhdn changed the title metrics-generator: truncate label values exceeding a configurable length metrics-generator: truncate label names and values exceeding a configurable length Nov 17, 2022
Copy link
Copy Markdown
Contributor

@mapno mapno left a comment

Choose a reason for hiding this comment

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

LGTM

@yvrhdn yvrhdn merged commit ee97e3f into grafana:main Nov 17, 2022
@yvrhdn yvrhdn deleted the kvrhdn/metrics-generator-truncate-label-value branch November 17, 2022 12:35
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.

[Feature] Configurable max label key/value length in metrics generator

2 participants