[exporter/bmchelix] Enrich metric names with datapoint attributes#46771
Open
NassimBtk wants to merge 5 commits intoopen-telemetry:mainfrom
Open
Conversation
…utes Developed createEnrichedMetricWithDpAttributes to enrich metric names with datapoint attribute Added normalize_metric_name, normalize_label_value and normalize_entity_value to normalize metric names, label values and entity values respectively.
Contributor
MovieStoreGuy
left a comment
There was a problem hiding this comment.
Look at the code, this should be configurable since you're now increasing the cardinality of data being sent.
| for k, v := range dpAttributes { | ||
| stringMetricAttrs[k] = fmt.Sprintf("%v", v) | ||
| labels[k] = fmt.Sprintf("%v", v) | ||
| normalizedValue := NormalizeLabelValue(fmt.Sprintf("%v", v)) |
Contributor
There was a problem hiding this comment.
In this case, you can just call fmt.Sprint, no need for the formatting
Contributor
Author
There was a problem hiding this comment.
Good catch! Thank you! I have fixed two other fmt.Sprintf BTW.
- Added a new configuration option
`enrich_metric_with_attributes`. This option
allows users to control whether metric names
should be enriched with attributes from the data
points
- Updated the README.md file to include
information about the new configuration option
- Replaced fmt.Sprintf("%v", value) with
fmt.Sprint(value)
- Updated unit tests to cover the new feature.
Fixed BHOM link in README.md
Fixed AIOPS BHOM link in README.md
Fixed config.schema.yaml and config.go Authentication key for external integration link updated in README.md
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request enhances the BMC Helix exporter to ensure metric names are uniquely identifiable in BMC Helix Operations Management by enriching them with datapoint attributes and applying normalization for compatibility. It also improves label handling, removes legacy enrichment logic, and updates tests to validate the new enrichment approach and normalization rules.
Metric enrichment and normalization:
exporter/bmchelixexporter/internal/operationsmanagement/metrics_producer.go, [1] [2] [3]entityTypeId,entityName) and metric names are normalized to remove invalid characters (e.g., colons) and conform to required patterns. Label values are also normalized (e.g., commas replaced with whitespace). (exporter/bmchelixexporter/internal/operationsmanagement/metrics_producer.go, [1] [2] [3]Codebase simplification and removal of legacy logic:
enrichMetricNamesWithAttributesfunction is removed, replaced by the newcreateEnrichedMetricWithDpAttributesapproach for metric enrichment. (exporter/bmchelixexporter/internal/operationsmanagement/metrics_producer.go, [1] [2]Link to tracking issue
Fixes #46558
Testing
exporter/bmchelixexporter/internal/operationsmanagement/metrics_producer_test.go, [1] [2]host.nameto resource attributes, reflecting real-world usage. (exporter/bmchelixexporter/internal/operationsmanagement/metrics_producer_test.go, [1] [2] [3]Documentation
.chloggen/bmchelix-enrich-metric-names.yaml, .chloggen/bmchelix-enrich-metric-names.yamlR1-R31)