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 wrapper for OTel calls as a first step towards configurable attributes #10911

Conversation

codeboten
Copy link
Contributor

Part of #10801

@codeboten codeboten requested review from a team and jpkrohling August 19, 2024 19:41
@codeboten codeboten changed the title [mdatagen] generate wrapper for otel calls [mdatagen] Generate wrapper for OTel calls as a first step towards configurable attributes Aug 19, 2024
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 98.07692% with 2 lines in your changes missing coverage. Please review.

Project coverage is 91.64%. Comparing base (343f449) to head (88dca19).
Report is 488 commits behind head on main.

Files with missing lines Patch % Lines
...ereceiver/internal/metadata/generated_telemetry.go 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10911      +/-   ##
==========================================
+ Coverage   91.62%   91.64%   +0.02%     
==========================================
  Files         406      406              
  Lines       19046    19103      +57     
==========================================
+ Hits        17450    17507      +57     
- Misses       1237     1238       +1     
+ Partials      359      358       -1     

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

Copy link
Member

@crobert-1 crobert-1 left a comment

Choose a reason for hiding this comment

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

Should we add tests as a part of this change as well?

@codeboten codeboten force-pushed the codeboten/wrap-otel-api-mdatagen branch from 5058717 to 92d0d36 Compare August 21, 2024 19:10
Signed-off-by: Alex Boten <[email protected]>
@codeboten
Copy link
Contributor Author

@crobert-1 added test in mdatagen to validate the generated code

Sum: &sum{
Async: false,
Mono: Mono{true},
MetricValueType: MetricValueType{ValueType: pmetric.NumberDataPointValueTypeInt},
Copy link
Member

Choose a reason for hiding this comment

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

Could we add another case where the type is Histogram, since that's the other special case in the generated code?

{{- if not $metric.Data.Async }}

func (b *TelemetryBuilder) Record{{ $name.Render }}(ctx context.Context, val {{ $metric.Data.BasicType }}, opts ...metric.{{- if eq $metric.Data.Type "Histogram" -}}Record{{- else -}}Add{{- end -}}Option) {
b.{{ $name.Render }}.{{- if eq $metric.Data.Type "Histogram" -}}Record{{- else -}}Add{{- end -}}(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.

I believe we also need Record for gauge metrics.

I found that the Int64Gauge metric type has Record, not Add as rendered here. (Same goes for Float64Gauge) This is hit if you do:

telemetry:
  metrics:
    fake_metric:
      enabled: true
      description: Description of metric
      unit: "{x}"
      gauge:
        value_type: int

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Sep 12, 2024
@github-actions github-actions bot removed the Stale label Sep 19, 2024
Copy link
Contributor

github-actions bot commented Oct 3, 2024

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Oct 3, 2024
Copy link
Contributor

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Oct 19, 2024
@codeboten codeboten reopened this Oct 21, 2024
@codeboten codeboten requested a review from a team as a code owner October 21, 2024 15:57
@github-actions github-actions bot removed the Stale label Oct 23, 2024
Copy link
Contributor

github-actions bot commented Nov 7, 2024

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added Stale and removed Stale labels Nov 7, 2024
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Nov 23, 2024
Copy link
Contributor

github-actions bot commented Dec 7, 2024

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants