-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/translator/prometheus: Allow not translating UTF8-characters
Signed-off-by: Arthur Silva Sens <[email protected]>
- Loading branch information
1 parent
2797fa0
commit 3bfbc3c
Showing
12 changed files
with
320 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package prometheus // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus" | ||
|
||
import ( | ||
"github.com/prometheus/common/model" | ||
"go.opentelemetry.io/collector/featuregate" | ||
) | ||
|
||
var ( | ||
dropSanitizationGate = featuregate.GlobalRegistry().MustRegister( | ||
"pkg.translator.prometheus.PermissiveLabelSanitization", | ||
featuregate.StageAlpha, | ||
featuregate.WithRegisterDescription("Controls whether to change labels starting with '_' to 'key_'."), | ||
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/8950"), | ||
) | ||
|
||
normalizeNameGate = featuregate.GlobalRegistry().MustRegister( | ||
"pkg.translator.prometheus.NormalizeName", | ||
featuregate.StageBeta, | ||
featuregate.WithRegisterDescription("Controls whether metrics names are automatically normalized to follow Prometheus naming convention. Attention: if 'pkg.translator.prometheus.allowUTF8' is enabled, UTF-8 characters will not be normalized."), | ||
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/8950"), | ||
) | ||
|
||
allowUTF8FeatureGate = featuregate.GlobalRegistry().MustRegister( | ||
"pkg.translator.prometheus.allowUTF8", | ||
featuregate.StageAlpha, | ||
featuregate.WithRegisterDescription("When enabled, UTF-8 characters will not be translated to underscores."), | ||
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35459"), | ||
featuregate.WithRegisterFromVersion("v0.110.0"), | ||
) | ||
) | ||
|
||
func init() { | ||
if allowUTF8FeatureGate.IsEnabled() { | ||
model.NameValidationScheme = model.UTF8Validation | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.