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

Proof of concept: Named Tracers / TracerFactory #186

Closed
wants to merge 4 commits into from

Conversation

z1c0
Copy link
Contributor

@z1c0 z1c0 commented Aug 13, 2019

This draft shows a possible implementation of the Named Tracers RFC (open-telemetry/oteps#16).

Instead of working with a single global Tracer object, tracers must be created using a factory-pattern approach for a given tracer name.

The LoggingTracer.Demo.AspNetCore application already makes uses of the ITracerFactory and produces log output using the tracer name as a logging prefix:

           2 |        1 | TracerFactory.Create(OpenTelemetry.Collector.AspNetCore)
Hosting environment: Production
Content root path: C:\workspaces\git\Dynatrace\opentelemetry-dotnet\samples\LoggingTracer\LoggingTracer.Demo.AspNetCore
Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.
       12185 |        6 | LoggingTextFormat.Extract(...)
       12186 |        6 | Tracer(OpenTelemetry.Collector.AspNetCore).SpanBuilder(/)
       12186 |        6 | SpanBuilder.ctor(/)
       12187 |        6 | Span.ctor(/, Internal)
       12187 |        6 | SpanBuilder.SetSpanKind(Server)
       12187 |        6 | SpanBuilder.SetSampler(AlwaysSampleSampler)
       12188 |        6 | SpanBuilder.SetParent(SpanContext{TraceId=00000000000000000000000000000000, SpanId=0000000000000000, TraceOptions=None})
       12189 |        6 | SpanBuilder.StartSpan()
       12189 |        6 | Tracer(OpenTelemetry.Collector.AspNetCore).WithSpan
       12190 |        6 | Span.SetAttribute(http.host, localhost:5001)
       12190 |        6 | Span.SetAttribute(http.method, GET)
       12190 |        6 | Span.SetAttribute(http.path, /)
       12192 |        6 | Span.SetAttribute(http.user_agent, Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36)
       12194 |        6 | Span.SetAttribute(http.url, https://localhost:5001/)
       12214 |        6 | Span.SetAttribute(http.status_code, 200)
       12215 |        6 | Span.End, Name: /
       12421 |       10 | LoggingTextFormat.Extract(...)
       12422 |       10 | Tracer(OpenTelemetry.Collector.AspNetCore).SpanBuilder(/favicon.ico)
       12422 |       10 | SpanBuilder.ctor(/favicon.ico)
       12422 |       10 | Span.ctor(/favicon.ico, Internal)
       12423 |       10 | SpanBuilder.SetSpanKind(Server)
       12423 |       10 | SpanBuilder.SetSampler(AlwaysSampleSampler)
       12424 |       10 | SpanBuilder.SetParent(SpanContext{TraceId=00000000000000000000000000000000, SpanId=0000000000000000, TraceOptions=None})
       12425 |       10 | SpanBuilder.StartSpan()
       12425 |       10 | Tracer(OpenTelemetry.Collector.AspNetCore).WithSpan
       12426 |       10 | Span.SetAttribute(http.host, localhost:5001)
       12426 |       10 | Span.SetAttribute(http.method, GET)
       12426 |       10 | Span.SetAttribute(http.path, /favicon.ico)
       12427 |       10 | Span.SetAttribute(http.user_agent, Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36)
       12427 |       10 | Span.SetAttribute(http.url, https://localhost:5001/favicon.ico)
       12427 |       10 | Span.SetAttribute(http.status_code, 200)
       12427 |       10 | Span.End, Name: /favicon.ico
       26840 |       10 | LoggingTextFormat.Extract(...)
       26840 |       10 | Tracer(OpenTelemetry.Collector.AspNetCore).SpanBuilder(/bla)
       26841 |       10 | SpanBuilder.ctor(/bla)
       26841 |       10 | Span.ctor(/bla, Internal)
       26841 |       10 | SpanBuilder.SetSpanKind(Server)
       26842 |       10 | SpanBuilder.SetSampler(AlwaysSampleSampler)
       26842 |       10 | SpanBuilder.SetParent(SpanContext{TraceId=00000000000000000000000000000000, SpanId=0000000000000000, TraceOptions=None})
       26842 |       10 | SpanBuilder.StartSpan()
       26843 |       10 | Tracer(OpenTelemetry.Collector.AspNetCore).WithSpan
       26843 |       10 | Span.SetAttribute(http.host, localhost:5001)
       26843 |       10 | Span.SetAttribute(http.method, GET)
       26844 |       10 | Span.SetAttribute(http.path, /bla)
       26844 |       10 | Span.SetAttribute(http.user_agent, Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36)
       26844 |       10 | Span.SetAttribute(http.url, https://localhost:5001/bla)
       26845 |       10 | Span.SetAttribute(http.status_code, 200)
       26845 |       10 | Span.End, Name: /bla
       26938 |        7 | LoggingTextFormat.Extract(...)
       26938 |        7 | Tracer(OpenTelemetry.Collector.AspNetCore).SpanBuilder(/favicon.ico)
       26939 |        7 | SpanBuilder.ctor(/favicon.ico)
       26939 |        7 | Span.ctor(/favicon.ico, Internal)
       26940 |        7 | SpanBuilder.SetSpanKind(Server)
       26940 |        7 | SpanBuilder.SetSampler(AlwaysSampleSampler)
       26941 |        7 | SpanBuilder.SetParent(SpanContext{TraceId=00000000000000000000000000000000, SpanId=0000000000000000, TraceOptions=None})
       26941 |        7 | SpanBuilder.StartSpan()
       26942 |        7 | Tracer(OpenTelemetry.Collector.AspNetCore).WithSpan
       26943 |        7 | Span.SetAttribute(http.host, localhost:5001)
       26943 |        7 | Span.SetAttribute(http.method, GET)
       26943 |        7 | Span.SetAttribute(http.path, /favicon.ico)
       26943 |        7 | Span.SetAttribute(http.user_agent, Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36)
       26944 |        7 | Span.SetAttribute(http.url, https://localhost:5001/favicon.ico)
       26945 |        7 | Span.SetAttribute(http.status_code, 200)
       26945 |        7 | Span.End, Name: /favicon.ico

@austinlparker
Copy link
Member

I forget what happened here, but these commits got eaten somehow - could this get recreated?

@z1c0
Copy link
Contributor Author

z1c0 commented Sep 11, 2019

This was just a proof-of-concept implementation of the Named Tracers RFC (open-telemetry/oteps#16).
Until some progress is made on this RFC I will close the PR.

@z1c0 z1c0 closed this Sep 11, 2019
Yun-Ting pushed a commit to Yun-Ting/opentelemetry-dotnet that referenced this pull request Oct 13, 2022
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.

3 participants