Skip to content

Differentiate emitted metrics by configuration options #14018

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 7 commits into from
Jun 13, 2025

Conversation

jaydeluca
Copy link
Member

Related to #13468

This change introduces another system property (metaDataConfig) that we can set during our test runs to help us identify a when condition for which the telemetry data is emitted. This way, we can run separate test suites in order to generate telemetry under different conditions and tag it accordingly.

Example new metrics .telemetry file contents:

when: otel.semconv-stability.opt-in=database
metrics:
  - name: db.client.connection.max
    description: The maximum number of open connections allowed.
    type: LONG_SUM
    unit: connection
    attributes: 
      - name: db.client.connection.pool.name
        type: STRING
...

Then, when we present the telemetry in the instrumentation-list.yaml file, we can differentiate when someone could expect to see the different telemetry. This provides a nice preview of the database semconv differences, as an example:

telemetry:
- when: default
  metrics:
  - name: db.client.connections.max
    description: The maximum number of open connections allowed.
    type: LONG_SUM
    unit: connections
    attributes:
    - name: pool.name
      type: STRING
...
- when: otel.semconv-stability.opt-in=database
  metrics:
  - name: db.client.connection.max
    description: The maximum number of open connections allowed.
    type: LONG_SUM
    unit: connection
    attributes:
    - name: db.client.connection.pool.name
      type: STRING
...

I turned it on for a handful of the existing modules we were already collecting metadata for. I will follow this up with enabling it for every instrumentation I can find that emits metrics.

I also made some small changes to a few modules to setup the tests to run in a way that would be compatible with this setup (oshi, tomcat-jdbc, clickhouse)

@jaydeluca jaydeluca requested a review from a team as a code owner June 10, 2025 20:30
@jaydeluca jaydeluca mentioned this pull request Jun 10, 2025
24 tasks
type: STRING
- name: state
type: STRING
- when: 'otel.semconv-stability.opt-in=database '
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- when: 'otel.semconv-stability.opt-in=database '
- when: otel.semconv-stability.opt-in=database

if (!metrics.getMetrics().isEmpty()) {
module.setMetrics(metrics.getMetrics());

if (!metrics.isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

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

can remove this conditional I think (and just let it iterate over empty map below)

@trask trask merged commit a6ab2c6 into open-telemetry:main Jun 13, 2025
326 of 329 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants