Skip to content
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

[cmd/telemetrygen] Add exemplars support for telemetrygen #33320

Conversation

jpkrohling
Copy link
Member

This PR adds support for passing a traceID and spanID to be used as exemplars on the generated data points. This was verified with an e2e test using OTel Collector and the debug exporter in detailed verbosity, resulting in this:

2024-05-31T11:41:51.378+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope  
Metric #0
Descriptor:
     -> Name: gen
     -> Description: 
     -> Unit: 
     -> DataType: Gauge
NumberDataPoints #0
StartTimestamp: 1970-01-01 00:00:00 +0000 UTC
Timestamp: 2024-05-31 09:41:51.374564535 +0000 UTC
Value: 0
Exemplars:
Exemplar #0
     -> Trace ID: ae87dadd90e9935a4bc9660628efd569
     -> Span ID: 5828fa4960140870
     -> Timestamp: 2024-05-31 09:41:51.374432029 +0000 UTC
     -> Value: 1

Given that I needed to do the validation of the traceID/spanID on the metrics config as well, I refactored the current validation done in the logging part of the command so that it's now part of the common package.

Signed-off-by: Juraci Paixão Kröhling juraci@kroehling.de

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
@jpkrohling jpkrohling requested review from mx-psi, codeboten and a team as code owners May 31, 2024 09:45
@github-actions github-actions bot added the cmd/telemetrygen telemetrygen command label May 31, 2024
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
},
},
{
name: "only-traceID",
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a valid case for supporting only one of trace or span ID? I guess it could be used for edge case testing?

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea is indeed to allow for different test scenarios, like how a backend would behave in face of bad instrumentation.

@jpkrohling jpkrohling merged commit 9f4d61e into open-telemetry:main Jun 1, 2024
162 checks passed
@github-actions github-actions bot added this to the next release milestone Jun 1, 2024
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Jul 11, 2024
…etry#33320)

This PR adds support for passing a traceID and spanID to be used as
exemplars on the generated data points. This was verified with an e2e
test using OTel Collector and the debug exporter in detailed verbosity,
resulting in this:

```
2024-05-31T11:41:51.378+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope  
Metric #0
Descriptor:
     -> Name: gen
     -> Description: 
     -> Unit: 
     -> DataType: Gauge
NumberDataPoints #0
StartTimestamp: 1970-01-01 00:00:00 +0000 UTC
Timestamp: 2024-05-31 09:41:51.374564535 +0000 UTC
Value: 0
Exemplars:
Exemplar #0
     -> Trace ID: ae87dadd90e9935a4bc9660628efd569
     -> Span ID: 5828fa4960140870
     -> Timestamp: 2024-05-31 09:41:51.374432029 +0000 UTC
     -> Value: 1
```

Given that I needed to do the validation of the traceID/spanID on the
metrics config as well, I refactored the current validation done in the
logging part of the command so that it's now part of the common package.

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>

---------

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd/telemetrygen telemetrygen command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants