-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[mdatagen] Generate wrapper for OTel calls as a first step towards configurable attributes #10911
Conversation
Codecov ReportAttention: Patch coverage is
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. |
There was a problem hiding this 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?
Part of open-telemetry#10801 Signed-off-by: Alex Boten <[email protected]>
Signed-off-by: Alex Boten <[email protected]>
Signed-off-by: Alex Boten <[email protected]>
5058717
to
92d0d36
Compare
Signed-off-by: Alex Boten <[email protected]>
@crobert-1 added test in mdatagen to validate the generated code |
Sum: &sum{ | ||
Async: false, | ||
Mono: Mono{true}, | ||
MetricValueType: MetricValueType{ValueType: pmetric.NumberDataPointValueTypeInt}, |
There was a problem hiding this comment.
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...) |
There was a problem hiding this comment.
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
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Part of #10801