Skip to content

[receiver/sqlserver] Ensure all enabled metrics are emitted #38839

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 3 commits into from
Mar 20, 2025

Conversation

crobert-1
Copy link
Member

Description

When directly connecting to SQL Server, this receiver runs multiple queries to get enabled metrics. Each query is only run if one or more metric is enabled for that particular query. The bug here was that some metrics weren't properly being checked to see if they were enabled. This means that in some cases, if a subset of metrics were enabled, the query wouldn't be run, and the metrics wouldn't be recorded or emitted.

Testing

Added a test to ensure whenever new metrics are added, the setupQueries method gets changed as well. If we continue to hit more bugs with this we may want to just always run the queries, even if there's a slight performance hit.

@crobert-1 crobert-1 requested a review from a team as a code owner March 20, 2025 19:14
@crobert-1 crobert-1 requested a review from dmitryax March 20, 2025 19:14
- Return result of ||, rather than include if
@atoulme atoulme merged commit 4ea8ffd into open-telemetry:main Mar 20, 2025
171 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 20, 2025
Fiery-Fenix pushed a commit to Fiery-Fenix/opentelemetry-collector-contrib that referenced this pull request Apr 24, 2025
…emetry#38839)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
When directly connecting to SQL Server, this receiver runs multiple
queries to get enabled metrics. Each query is only run if one or more
metric is enabled for that particular query. The bug here was that some
metrics weren't properly being checked to see if they were enabled. This
means that in some cases, if a subset of metrics were enabled, the query
wouldn't be run, and the metrics wouldn't be recorded or emitted.

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added a test to ensure whenever new metrics are added, the
`setupQueries` method gets changed as well. If we continue to hit more
bugs with this we may want to just always run the queries, even if
there's a slight performance hit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants