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

[mdatagen] Generate wrappers for recording telemetry metrics #12182

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

crobert-1
Copy link
Member

Description

This is essentially reviving #10911, the first step towards #10801. The goal is to be able to use mdatagen to handle more use cases around telemetry metrics, similar to regular metrics, especially to be able to set attributes on the telemetry metrics.

Link to tracking issue

Part of #10801

Testing

Code has been generated for different telemetry metric types, existing tests use this behavior pretty heavily.

@crobert-1 crobert-1 requested review from bogdandrutu, dmitryax and a team as code owners January 25, 2025 00:11
@crobert-1 crobert-1 marked this pull request as draft January 25, 2025 00:16
Copy link

codecov bot commented Jan 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.65%. Comparing base (4edaacd) to head (20bc933).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12182      +/-   ##
==========================================
+ Coverage   91.62%   91.65%   +0.03%     
==========================================
  Files         465      465              
  Lines       24775    24834      +59     
==========================================
+ Hits        22699    22761      +62     
+ Misses       1687     1685       -2     
+ Partials      389      388       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@crobert-1 crobert-1 marked this pull request as ready for review January 25, 2025 00:32
Comment on lines +102 to +116
func (builder *TelemetryBuilder) RecordProcessorBatchBatchSendSize(ctx context.Context, val int64, opts ...metric.RecordOption) {
builder.ProcessorBatchBatchSendSize.Record(ctx, val, opts...)
}

func (builder *TelemetryBuilder) RecordProcessorBatchBatchSendSizeBytes(ctx context.Context, val int64, opts ...metric.RecordOption) {
builder.ProcessorBatchBatchSendSizeBytes.Record(ctx, val, opts...)
}

func (builder *TelemetryBuilder) RecordProcessorBatchBatchSizeTriggerSend(ctx context.Context, val int64, opts ...metric.AddOption) {
builder.ProcessorBatchBatchSizeTriggerSend.Add(ctx, val, opts...)
}

func (builder *TelemetryBuilder) RecordProcessorBatchTimeoutTriggerSend(ctx context.Context, val int64, opts ...metric.AddOption) {
builder.ProcessorBatchTimeoutTriggerSend.Add(ctx, val, opts...)
}
Copy link
Member

Choose a reason for hiding this comment

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

Few things here:

  1. We will confuse the user when using Add/Record because we don't respect the same semantics as otel.
  2. What is the next level for this PR? Can you just provide a sketch code that you want to end with, please don't make the code changes, just provide a draft code for me to understand.

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