Skip to content

feat(telemetrygen): added support for delta temporality #38146

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

Conversation

NickAnge
Copy link
Contributor

@NickAnge NickAnge commented Feb 24, 2025

Description

This PR adds support for configuring metric temporality (delta or cumulative) in the telemetrygen tool. This allows users to generate metrics with different temporality types, which is particularly useful for testing different metric collection scenarios.

Changes
  • Added temporalityType flag for metrics pipeline that accepts values: delta or cumulative

Link to tracking issue

Fixes #38073

Testing

Testing was performed by setting up as simple collector with otlp receiver and debug exporter

Sum Datapoint
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
Resource attributes:
     -> service.name: Str(telemetrygen)
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope  
Metric #0
Descriptor:
     -> Name: gen
     -> Description: 
     -> Unit: 
     -> DataType: Histogram
     -> AggregationTemporality: Delta
Histogram Datapoint
Count: 0
Sum: 3940.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 5.000000
ExplicitBounds #2: 10.000000
ExplicitBounds #3: 25.000000
ExplicitBounds #4: 50.000000
ExplicitBounds #5: 75.000000
ExplicitBounds #6: 100.000000
ExplicitBounds #7: 250.000000
ExplicitBounds #8: 500.000000
ExplicitBounds #9: 750.000000
ExplicitBounds #10: 1000.000000
ExplicitBounds #11: 2500.000000
ExplicitBounds #12: 5000.000000
ExplicitBounds #13: 7500.000000
ExplicitBounds #14: 10000.000000
Buckets #0, Count: 0
Buckets #1, Count: 0
Buckets #2, Count: 1
Buckets #3, Count: 0
Buckets #4, Count: 0
Buckets #5, Count: 0
Buckets #6, Count: 3
Buckets #7, Count: 4
Buckets #8, Count: 1
Buckets #9, Count: 1
Buckets #10, Count: 0
Buckets #11, Count: 0
Buckets #12, Count: 0
Buckets #13, Count: 0
Buckets #14, Count: 0
  • Need to add tests for the config

Copy link

linux-foundation-easycla bot commented Feb 24, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@ArthurSens
Copy link
Member

Thank you @NickAnge! Could you take care of CLA? Here are docs that could help you: https://github.com/open-telemetry/community/blob/main/guides/contributor/CLA.md

I know you did some research here, as we have spoken through Slack, and I couldn't answer you. @mx-psi, we were in doubt if, when using deltas, the StartTimestamp should be updated for every datapoint or if we could re-use the same StartTimestamp from the first data point. Could you clarify? While you're at it could you trigger the tests? :)

@mx-psi
Copy link
Member

mx-psi commented Feb 25, 2025

I know you did some research here, as we have spoken through Slack, and I couldn't answer you. @mx-psi, we were in doubt if, when using deltas, the StartTimestamp should be updated for every datapoint or if we could re-use the same StartTimestamp from the first data point. Could you clarify? While you're at it could you trigger the tests? :)

The gist of it is that Deltas update StartTimestamp every time, Cumulative keeps the first one. Which means that the current code is not consistent with an usual cumulative timeseries

@NickAnge NickAnge force-pushed the nickange/telemetrygen/metrics/support-delta-temporality branch 2 times, most recently from 95fdd15 to 89bae80 Compare February 25, 2025 20:55
@NickAnge NickAnge force-pushed the nickange/telemetrygen/metrics/support-delta-temporality branch from 89bae80 to 56f210f Compare February 25, 2025 20:57
@NickAnge NickAnge marked this pull request as ready for review February 25, 2025 20:58
@NickAnge NickAnge requested a review from a team as a code owner February 25, 2025 20:58
@NickAnge
Copy link
Contributor Author

Thanks @mx-psi and @ArthurSens . I saw your comment at the issue. Will raise an issue for the cumulative "bug" then. I think the PR is ready for review. Will really appreciate your input.

@mx-psi mx-psi merged commit 27d7b1f into open-telemetry:main Feb 26, 2025
161 checks passed
@github-actions github-actions bot added this to the next release milestone Feb 26, 2025
yiquanzhou added a commit to dash0hq/opentelemetry-collector-contrib that referenced this pull request Feb 27, 2025
* main: (22 commits)
  [receiver/awsfirehose] Add support for encoding extensions (open-telemetry#37262)
  fix(deps): update module google.golang.org/api to v0.223.0 (open-telemetry#38181)
  [chore] skip TestSyslogComplementaryRFC3164 (open-telemetry#38240)
  fix(deps): update module github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common to v1.0.1106 (open-telemetry#38199)
  [provider/s3] Use mdatagen, promote to alpha (open-telemetry#38227)
  fix: fix flaky test in kafkatopicsobserver (open-telemetry#38218)
  [processor/resourcedetection] Add k8s.cluster.uid to kubeadm detector (open-telemetry#38216)
  Revert "Add issue generation from fkaly tests for all archs (open-telemetry#38191)" (open-telemetry#38230)
  Revert "Introduce issuegenerator to open issues when tests fail on main (open-telemetry#38177)" (open-telemetry#38231)
  [chore] Update otelcol core dependency (open-telemetry#38214)
  [pkg/stanza] Improve error logs produced by transformer processors (open-telemetry#37285)
  [receiver/statsd] Make full config structure public (open-telemetry#38186)
  processor/metricsstarttime: add ridwanmsharif as codeowner (open-telemetry#38193)
  fix(deps): update module github.com/huaweicloud/huaweicloud-sdk-go-v3 to v0.1.137 (open-telemetry#38154)
  [pkg/datadog] export StaticAPIKeyCheck (open-telemetry#38223)
  [chore][pkg/ottl] Move scope and resource PathGetSetters to internal ctx packages (open-telemetry#38225)
  fix(deps): update all github.com/datadog packages to v0.64.0-rc.3 (open-telemetry#38202)
  feat(telemetrygen): added support for delta temporality (open-telemetry#38146)
  [chore] Some more fixes of component IDs (open-telemetry#38221)
  [chore][pkg/ottl] Define PathGetSetter in ctxdatapoint (open-telemetry#38201)
  ...
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.

[telemetrygen] Support metrics delta temporality
4 participants