You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/opentelemetry_api/README.md
+4-56Lines changed: 4 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,64 +30,12 @@ def deps do
30
30
end
31
31
```
32
32
33
-
### Registering and Using Tracers Directly
34
-
35
-
If it is a runnable application then this registration should happen in `start/2`, example below is adding `Tracer` registration to the Postgres library [pgo](https://github.com/erleans/pgo):
Then when the spans are started and finished in the application's code the `Tracer` is fetched with `get_tracer/1` and passed to `with_span/3` or `start_span/3`:
A `Tracer` variable can be passed through your Application's calls so `get_tracer` only has to be called once, it is safe to store it in the state of a `gen_server` and to pass across process boundaries.
64
-
65
-
If the application does not have a `start/2` there may be another function that is always called before the library would create any spans. For example, the [Elli](https://github.com/elli-lib/elli) middleware for OpenTelemetry instrumentation registers the `Tracer` during Elli startup:
Not registering does not cause any issues or crashes, OpenTelemetry simply will fallback to the default `Tracer` if `get_tracer/1` is called with a name that is not registered.
86
-
87
-
88
33
### Helper Macros for Application Tracers
89
34
90
-
When `register_application_tracer/1` is used to register a Tracer there are both Erlang and Elixir macros that make use of the current module's name to lookup the Tracer for you and can be used for Trace and Span operations:
35
+
There are both Erlang and Elixir macros that make use of the current module's
36
+
name to lookup a Named Tracer -- a Named Tracer is created for each Application
37
+
loaded in the system at start time -- for you and can be used for Trace and Span
Registering a [Named Tracer](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/api-tracing.md#obtaining-a-tracer) with the name of an OTP Application enables each module in
123
-
the Application to be mapped to the Named Tracer, named for the Application and using the
124
-
version of the currently loaded Application by that name.
125
-
126
-
Macros in `OpenTelemetry.Tracer` use the name of the module they are being used in in order
127
-
to lookup the Named Tracer registered for that module and using it for trace operations.
0 commit comments