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

Debug Logging for sdk/trace #2500

Merged
merged 4 commits into from Jan 11, 2022
Merged

Conversation

MadVikingGod
Copy link
Contributor

This addresses the lack of configuration visibility of our sdk.

Closes #2499

This does not address all exporters, just stdout. Aditional exporters can be addressed after we establish a working pattern.

sdk/trace/batch_span_processor.go Outdated Show resolved Hide resolved
sdk/trace/batch_span_processor.go Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
sdk/trace/provider.go Outdated Show resolved Hide resolved
sdk/resource/resource.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jmacd jmacd left a comment

Choose a reason for hiding this comment

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

Looking forward to OTLP exporters having MarshalLog methods 🚀

@MadVikingGod
Copy link
Contributor Author

MadVikingGod commented Jan 10, 2022

To help people see how this change would affect things you can run the NamedTracer example and see the output:

/workspaces/opentelemetry-go/example/namedtracer $ go run . > /dev/null
2022/01/10 19:24:10 internal_logging.go:48: "level"=1 "msg"="TracerProvider created" "config"={"SpanProcessors":[{"Type":"BatchSpanProcessor","SpanExporter":{"Type":"stdout","WithTimestamps":true},"Config":{"MaxQueueSize":2048,"BatchTimeout":"5s","ExportTimeout":"30s","MaxExportBatchSize":512,"BlockOnQueueFull":false}}],"SamplerType":"trace.alwaysOnSampler","IDGeneratorType":"*trace.randomIDGenerator","SpanLimits":{"AttributeCountLimit":128,"EventCountLimit":128,"LinkCountLimit":128,"AttributePerEventCountLimit":128,"AttributePerLinkCountLimit":128},"Resource":{"Attributes":{"service.name":"unknown_service:namedtracer","telemetry.sdk.language":"go","telemetry.sdk.name":"opentelemetry","telemetry.sdk.version":"1.3.0"},"SchemaURL":"https://opentelemetry.io/schemas/v1.7.0"}}
2022/01/10 19:24:10 internal_logging.go:48: "level"=1 "msg"="Tracer created" "name"="example/namedtracer/main" "version"="" "schemaURL"=""
2022/01/10 19:24:10 internal_logging.go:48: "level"=1 "msg"="Tracer created" "name"="example/namedtracer/foo" "version"="" "schemaURL"=""
2022/01/10 19:24:10 internal_logging.go:62: "level"=5 "msg"="exporting spans" "count"=2 "dropped"=0

I would also like to add the formating of these logs in entirely controlled by the logger, so if we were to use for example a json logger we would have a different output.

@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #2500 (e47714b) into main (c37f485) will decrease coverage by 0.3%.
The diff coverage is 6.8%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2500     +/-   ##
=======================================
- Coverage   76.3%   76.0%   -0.4%     
=======================================
  Files        174     174             
  Lines      12027   12084     +57     
=======================================
+ Hits        9182    9188      +6     
- Misses      2600    2653     +53     
+ Partials     245     243      -2     
Impacted Files Coverage Δ
attribute/set.go 61.8% <0.0%> (-1.8%) ⬇️
exporters/stdout/stdouttrace/trace.go 66.1% <0.0%> (-10.4%) ⬇️
sdk/resource/resource.go 77.8% <0.0%> (-4.8%) ⬇️
sdk/trace/simple_span_processor.go 74.5% <0.0%> (-12.7%) ⬇️
sdk/trace/batch_span_processor.go 79.4% <9.0%> (-6.1%) ⬇️
sdk/trace/provider.go 81.8% <17.6%> (-6.7%) ⬇️
sdk/metric/sdk.go 81.5% <0.0%> (+1.4%) ⬆️
sdk/metric/refcount_mapped.go 100.0% <0.0%> (+20.0%) ⬆️

@Aneurysm9 Aneurysm9 merged commit f24f52a into open-telemetry:main Jan 11, 2022
@MrAlias MrAlias mentioned this pull request Feb 10, 2022
@MadVikingGod MadVikingGod deleted the log-exporters branch February 21, 2023 19:57
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.

Configuration and Debug logging.
5 participants