Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump future metric name length to 128 #3335

Merged
merged 2 commits into from
Sep 20, 2023
Merged

Conversation

mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Sep 18, 2023

This is inline with the current restriction.

The previous 63 character one came from Otel, but with open-telemetry/opentelemetry-specification#3648 This has been bumped to 255.

Updates #3065

Changelog

breaking: future metric names will be limited to 128 instead of 63 characters

@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.17% 🎉

Comparison is base (1ff1717) 72.99% compared to head (6b37dff) 73.16%.

❗ Current head 6b37dff differs from pull request most recent head 8aa1c8f. Consider uploading reports for the commit 8aa1c8f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3335      +/-   ##
==========================================
+ Coverage   72.99%   73.16%   +0.17%     
==========================================
  Files         261      258       -3     
  Lines       19993    19912      -81     
==========================================
- Hits        14593    14568      -25     
+ Misses       4476     4420      -56     
  Partials      924      924              
Flag Coverage Δ
ubuntu 73.09% <100.00%> (+0.16%) ⬆️
windows 73.01% <100.00%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
js/bundle.go 85.90% <100.00%> (ø)

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codebien
Copy link
Contributor

Apparently, there is also:

Add "/" to valid characters for instrument names (open-telemetry/opentelemetry-specification#3684)

Are we going to include it?

@mstoykov
Copy link
Contributor Author

That is not allowed in prometheus - so no.

@@ -46,8 +46,8 @@ type Bundle struct {
// https://github.com/grafana/k6/issues/3065
func (b *Bundle) checkMetricNamesForPrometheusCompatibility() {
const (
nameRegexString = "^[a-zA-Z_][a-zA-Z0-9_]{1,63}$"
badNameWarning = "Metric name should only include ASCII letters, numbers and underscores. " +
nameRegexString = "^[a-zA-Z_][a-zA-Z0-9_]{1,128}$"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
nameRegexString = "^[a-zA-Z_][a-zA-Z0-9_]{1,128}$"
nameRegexString = "^[a-zA-Z_][a-zA-Z0-9_]{1,255}$"

Is there a specific reason behind it? If not then I would prefer if we could keep it aligned with OTel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that is the current limit in the registry. The place where this limit will go after this becomes an error instead of a warning.

Copy link
Contributor

Choose a reason for hiding this comment

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

My suggestion was about the size limit s/128/255/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is hte current limit - 128

const nameRegexString = "^[\\p{L}\\p{N}\\._ !\\?/&#\\(\\)<>%-]{1,128}$"

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, but I'm not still getting why we are not just bumping everything to 255. What is the reason to keep as 128? If there is one technical then I would like us adding a comment on the registry's regex explaining it. Prometheus doesn't have any limit and the OpenTelemetry limit is set to 255 so it sounds to me we should just match the OTel limit.

js/bundle.go Outdated Show resolved Hide resolved
olegbespalov
olegbespalov previously approved these changes Sep 19, 2023
@olegbespalov olegbespalov added the documentation-needed A PR which will need a separate PR for documentation label Sep 19, 2023
js/bundle.go Outdated Show resolved Hide resolved
olegbespalov
olegbespalov previously approved these changes Sep 19, 2023
cmd/tests/cmd_run_test.go Outdated Show resolved Hide resolved
This is inline with the current restriction.

The previous 63 character one came from Otel, but with
open-telemetry/opentelemetry-specification#3648
This has been bumped to 255.

Updates #3065
mstoykov added a commit to grafana/k6-docs that referenced this pull request Sep 20, 2023
@mstoykov
Copy link
Contributor Author

Docs updates in grafana/k6-docs#1331

@mstoykov mstoykov merged commit 3655065 into master Sep 20, 2023
22 checks passed
@mstoykov mstoykov deleted the bumpMetricNameLenRestriction branch September 20, 2023 14:08
mstoykov added a commit to grafana/k6-docs that referenced this pull request Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation-needed A PR which will need a separate PR for documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants