Skip to content

signaltometricsconnector: support gauges #40113

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

Merged
merged 9 commits into from
May 23, 2025

Conversation

simitt
Copy link
Contributor

@simitt simitt commented May 16, 2025

Description

Add support for parsing gauges from any signal type with last value aggregation per batch.
For now only numerical values are supported. Parsing timestamps is not yet supported.

Link to tracking issue

Relates to #37093

Testing

Automated unit tests have been added.

Documentation

README was updated

Add support for gauges with last value aggregation.
relates to open-telemetry#37093
Copy link

linux-foundation-easycla bot commented May 16, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Member

@lahsivjar lahsivjar left a comment

Choose a reason for hiding this comment

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

Added a few discussion points on the supported return types for the value expression.

- allow for all signals
- only support numbers in OTTL expressions rather than Grok maps.
- move check into loop
@simitt
Copy link
Contributor Author

simitt commented May 16, 2025

@lahsivjar thanks for the initial round of feedback, moving this out of draft now after addressing your feedback.

@simitt simitt marked this pull request as ready for review May 16, 2025 13:08
@simitt simitt requested a review from a team as a code owner May 16, 2025 13:08
Copy link
Member

@lahsivjar lahsivjar left a comment

Choose a reason for hiding this comment

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

LGTM, a few minor README comments! Thanks for addressing all the review points.

Comment on lines 327 to 332
if strings.Contains(mi.Gauge.Value, "ExtractGrokPatterns") {
// Ensure a [key] selector is present after ExtractGrokPatterns
if !regexp.MustCompile(`ExtractGrokPatterns\([^)]*\)\s*\[[^\]]+\]`).MatchString(mi.Gauge.Value) {
return fmt.Errorf("ExtractGrokPatterns: a single key selector[key] is required for signal to gauge")
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This check would be true for all configured metric types so maybe in a follow-up PR we can generalize this as a common validation for ExtractGrokPatterns.

Copy link
Member

Choose a reason for hiding this comment

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

This is not that important though and we can just create an issue and leave it for future too as we might need to think about how to (or if to) handle config validation for all funcs that return map (or other non-primitives)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created #40118

@lahsivjar
Copy link
Member

@simitt There are some minor lint errors and it also needs a changelog. More details on adding changelog is available here:

**Recommended Steps**
1. Create an entry file using `make chlog-new`. This generates a file based on your current branch (e.g. `./.chloggen/my-branch.yaml`)
2. Fill in all fields in the new file
3. Run `make chlog-validate` to ensure the new file is valid
4. Commit and push the file

@ChrsMark ChrsMark added the ready to merge Code review completed; ready to merge by maintainers label May 23, 2025
@songy23 songy23 merged commit 5f2aa3a into open-telemetry:main May 23, 2025
183 of 184 checks passed
@github-actions github-actions bot added this to the next release milestone May 23, 2025
dragonlord93 pushed a commit to dragonlord93/opentelemetry-collector-contrib that referenced this pull request May 23, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Add support for parsing `gauges` from any signal type with last value
aggregation per batch.
For now only numerical values are supported. Parsing timestamps is not
yet supported.


<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Relates to open-telemetry#37093

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Automated unit tests have been added. 

<!--Describe the documentation added.-->
#### Documentation
README was updated
<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Vishal Raj <[email protected]>
Co-authored-by: Christos Markou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
connector/signaltometrics ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants