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

Named Tracers and Meters #264

Merged
16 changes: 14 additions & 2 deletions specification/api-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,20 @@ aggregation](overview.md#recording-metrics-with-predefined-aggregation).

### Meter creation

TODO: follow the spec for the Tracer. See work in progress:
https://github.com/open-telemetry/opentelemetry-specification/issues/39
New `Meter` instances can be created via a `MeterFactory` and its `getMeter`
SergeyKanzhelev marked this conversation as resolved.
Show resolved Hide resolved
method. This method expects two string arguments:

- `name` (required): This name must identify the instrumentation library (also
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good to split this into 2 different strings:

  • integration path - io.opentelemetry.contrib
  • instrumented library (component name) - mongodb

This way we can use the instrumented library name, and get rid of the component attribute in the Span. No need to have that set for every Span/Metric we create from this Tracer/Meter.

This may be done in a separate PR but want to hear opinions.

Copy link
Member

Choose a reason for hiding this comment

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

I agree we should do it in separate PR. This PR doesn't tell how this name will be used except to disable certain component's telemetry

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think this PR should just implement the OTEP and not go beyond it.

referred to as integration, e.g. `io.opentelemetry.contrib.mongodb`) and *not*
the instrumented library.
In case an invalid name (null or empty string) is specified, a working
default Meter implementation as a fallback is returned rather than returning
null or throwing an exception.
An instrumentation library *may* also ignore this name and return a default
z1c0 marked this conversation as resolved.
Show resolved Hide resolved
instance for all calls, if it does not support "named" functionality (e.g. an
implementation which is not even observability-related).
z1c0 marked this conversation as resolved.
Show resolved Hide resolved
- `version` (optional): Specifies the version of the instrumentation library
(e.g. `semver:1.0.0`).

### Create Metric

Expand Down
39 changes: 25 additions & 14 deletions specification/api-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,38 @@ Some applications may require multiple `Tracer` instances, e.g. to create
`Span`s on behalf of other applications. Implementations MAY provide a global
registry of `Tracer`s for such applications.

### Obtaining a tracer

`Tracer` object construction and registration will vary by implementation.
`Tracer`s may be explicitly created and registered from user code, or resolved
from linked dependencies using the provider pattern.
### Obtaining a Tracer

New `Tracer` instances can be created via a `TracerFactory` and its `getTracer`
method. This method expects two string arguments:

- `name` (required): This name must identify the instrumentation library (also
referred to as integration, e.g. `io.opentelemetry.contrib.mongodb`) and *not*
the instrumented library.
In case an invalid name (null or empty string) is specified, a working
default Tracer implementation as a fallback is returned rather than returning
null or throwing an exception.
An instrumentation library *may* also ignore this name and return a default
instance for all calls, if it does not support "named" functionality (e.g. an
implementation which is not even observability-related).
- `version` (optional): Specifies the version of the instrumentation library
(e.g. `semver:1.0.0`).

Implementations might require the user to specify configuration properties at
`Tracer` creation time, or rely on external configuration, e.g. when using the
`TracerFactory` creation time, or rely on external configuration, e.g. when using the
provider pattern.

##### Runtimes with multiple deployments/applications

Runtimes that support multiple deployments or applications might need to
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
provide a different `Tracer` instance to each deployment. To support this,

the global `Tracer` registry may delegate calls to create new `Tracer`s to a
separate `Provider` component, and the runtime may include its own `Provider`
implementation which returns a different `Tracer` for each deployment.

`Provider`s are registered with the API via some language-specific mechanism,
for instance the `ServiceLoader` class in Java.
provide a different `TracerFactory` instance to each deployment. To support this,
the global `TracerFactory` registry may delegate calls to create new instances of
`TracerFactory` to a separate `Provider` component, and the runtime may include
its own `Provider` implementation which returns a different `TracerFactory` for
each deployment.

`Provider` instances are registered with the API via some language-specific
mechanism, for instance the `ServiceLoader` class in Java.
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved

### Tracer operations

Expand Down
2 changes: 1 addition & 1 deletion specification/data-semantic-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Depending on the protocol and the type of operation, additional information
is needed to represent and analyze a span correctly in monitoring systems. It is
also important to unify how this attribution is made in different languages.
This way, the operator will not need to learn specifics of a language and
telemetry collected from multi-language micro-services can still be easily
telemetry collected from multi-language micro-service can still be easily
correlated and cross-analyzed.

## HTTP client
Expand Down
10 changes: 10 additions & 0 deletions specification/sdk-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@

<details><summary>Table of Contents</summary>

* [Tracer Creation](#tracer-creation)
bogdandrutu marked this conversation as resolved.
Show resolved Hide resolved
* [Span Processor](#span-processor)
* [Span Exporter](#span-exporter)

</details>

# Tracer Creation

New `Tracer` instances are always created through a `TracerFactory` (see [API](api-tracing.md#obtaining-a-tracer)).
The `name` and `version` arguments supplied to the `TracerFactory` must be used
to create a `Resource` instance which is stored on the created `Tracer`.
The readable representations of all `Span` instances created by a `Tracer` must
provide a `getLibraryResource` method that returns this `Resource` information
held by the `Tracer`.

## Span processor

Span processor is an interface which allows hooks for span start and end method
Expand Down