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] add Meter/Tracer func to simplify instrumenting code #29927

Conversation

codeboten
Copy link
Contributor

@codeboten codeboten commented Dec 15, 2023

This PR adds methods to generated_status that returns a Meter/Tracer w/ the scopeName set for each component. I'm not set on where to put this method, added it to generated_status but could easily be in a generated_telemetry.go file as well.

Follows #29926

Fixes #29921

Alex Boten added 2 commits December 15, 2023 13:20
This allows us to support all component types via a map. This will be used when adding the Meter func in mdatagen to produce consistent scope names for other components than receivers/scrapers.

Signed-off-by: Alex Boten <aboten@lightstep.com>
This returns a Meter w/ the scopeName set for each component.

Signed-off-by: Alex Boten <aboten@lightstep.com>
@github-actions github-actions bot added processor/attributes Attributes processor processor/cumulativetodelta Cumulative To Delta processor processor/datadog processor/deltatorate Delta To Rate processor processor/filter Filter processor processor/groupbyattrs Group By Attributes processor processor/groupbytrace Group By Trace processor processor/k8sattributes k8s Attributes processor processor/logstransform Logs Transform processor processor/metricsgeneration Metrics Generation processor processor/metricstransform Metrics Transform processor processor/probabilisticsampler Probabilistic Sampler processor processor/redaction Redaction processor processor/remotetap processor/resourcedetection Resource detection processor labels Dec 15, 2023
Comment on lines 21 to 23
return settings.MeterProvider.Meter("{{ .ScopeName }}")
}
Copy link
Member

Choose a reason for hiding this comment

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

I would start a new telemetry.go.tmpl file since we want to add more things there as well.

Copy link
Member

Choose a reason for hiding this comment

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

We can do the new file maybe later, but let's add at least for Tracer equivalent.

Alex Boten added 2 commits December 15, 2023 14:29
Signed-off-by: Alex Boten <aboten@lightstep.com>
Signed-off-by: Alex Boten <aboten@lightstep.com>
@codeboten codeboten changed the title [mdatagen] add Meter func to simplify getting a Meter [mdatagen] add Meter/Tracer func to simplify instrumenting code Dec 15, 2023
Signed-off-by: Alex Boten <aboten@lightstep.com>
@bogdandrutu bogdandrutu merged commit 07cc09a into open-telemetry:main Dec 18, 2023
85 checks passed
@codeboten codeboten deleted the codeboten/add-mdatagen-meter-method-2 branch December 18, 2023 17:18
@github-actions github-actions bot added this to the next release milestone Dec 18, 2023
bogdandrutu pushed a commit that referenced this pull request Dec 18, 2023
Follows
#29927,
uses the new method

Signed-off-by: Alex Boten <aboten@lightstep.com>
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Jan 10, 2024
…-telemetry#29927)

This PR adds methods to `generated_status` that returns a Meter/Tracer
w/ the scopeName set for each component. I'm not set on where to put
this method, added it to generated_status but could easily be in a
generated_telemetry.go file as well.

Follows
open-telemetry#29926

Fixes
open-telemetry#29921

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Jan 10, 2024
Follows
open-telemetry#29927,
uses the new method

Signed-off-by: Alex Boten <aboten@lightstep.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd/mdatagen mdatagen command connector/count connector/datadog connector/exceptions connector/failover connector/routing connector/servicegraph connector/spanmetrics exporter/alertmanager exporter/alibabacloudlogservice Alibaba components exporter/awscloudwatchlogs awscloudwatchlogs exporter exporter/awsemf awsemf exporter exporter/awskinesis exporter/awss3 exporter/awsxray exporter/azuredataexplorer exporter/azuremonitor exporter/carbon exporter/cassandra exporter/clickhouse exporter/coralogix exporter/datadog Datadog components exporter/dataset exporter/dynatrace exporter/elasticsearch exporter/f5cloud F5 exporter exporter/file exporter/googlecloud exporter/googlecloudpubsub exporter/googlemanagedprometheus Google Managed Prometheus exporter exporter/honeycombmarker exporter/influxdb exporter/instana exporter/kafka exporter/kinetica exporter/loadbalancing exporter/logicmonitor exporter/logzio exporter/loki Loki Exporter exporter/mezmo exporter/opencensus exporter/opensearch exporter/prometheus exporter/prometheusremotewrite exporter/pulsar exporter/sapm exporter/sentry exporter/signalfx exporter/skywalking exporter/splunkhec exporter/sumologic exporter/syslog exporter/tanzuobservability exporter/tencentcloudlogservice exporter/zipkin extension/asapauth extension/awsproxy extension/basicauth extension/bearertokenauth extension/encoding extension/headerssetter extension/healthcheck Health Check Extension extension/httpforwarder extension/jaegerremotesampling extension/oauth2clientauth extension/observer extension/oidcauth extension/opamp extension/pprof extension/remotetap extension/sigv4auth extension/storage processor/attributes Attributes processor processor/cumulativetodelta Cumulative To Delta processor processor/datadog processor/deltatorate Delta To Rate processor processor/filter Filter processor processor/groupbyattrs Group By Attributes processor processor/groupbytrace Group By Trace processor processor/k8sattributes k8s Attributes processor processor/logstransform Logs Transform processor processor/metricsgeneration Metrics Generation processor processor/metricstransform Metrics Transform processor processor/probabilisticsampler Probabilistic Sampler processor processor/redaction Redaction processor processor/remotetap processor/resourcedetection Resource detection processor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add Meter method to mdatagen to simplify collecting telemetry
4 participants