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

Merge OTEPs into the Specification #4288

Merged
merged 114 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
93d812b
Move RFC 0001 into text directory (open-telemetry/oteps#10)
iredelmeier Jul 30, 2019
b610107
RFC for Removing and replacing SpanData (open-telemetry/oteps#8)
bg451 Aug 9, 2019
5edf348
Metrics API RFCs to eliminate Raw statistics (open-telemetry/oteps#4)
jmacd Aug 13, 2019
2add896
Add missing status to RFC 0001 (open-telemetry/oteps#19)
arminru Aug 13, 2019
d3eb5b2
Add missing status to RFC 0002 (open-telemetry/oteps#20)
arminru Aug 13, 2019
27431fa
fix typo (open-telemetry/oteps#21)
reyang Aug 13, 2019
1b16d8c
Global initializer requirements proposal (open-telemetry/oteps#11)
jmacd Aug 16, 2019
5f2b53f
Change 0002 status to approved (open-telemetry/oteps#22)
bg451 Aug 19, 2019
04195af
Propose sampling API changes (open-telemetry/oteps#24)
bogdandrutu Aug 26, 2019
1fe55b5
Change status to approved for 0006-sampling RFC. (open-telemetry/otep…
bogdandrutu Sep 3, 2019
e0c7e48
Propose Datadog's auto-instrumentation libraries as a starting point …
bhs Sep 12, 2019
06e5217
RFC 0003, 0007 updates (Metrics measure type, metrics handle specific…
jmacd Sep 12, 2019
124347c
WIP: RFC 0008 Metric observer callback specification (open-telemetry/…
jmacd Sep 12, 2019
c794d97
RFC: Remove support to report out-of-band telemetry from the API (ope…
bogdandrutu Sep 12, 2019
3330d02
Renumber 0007-metric-handles to 0009-metric-handles (open-telemetry/o…
jmacd Sep 12, 2019
3841007
Mark RFC 0007-no-out-of-band-reporting.md as approved
bogdandrutu Sep 13, 2019
8eac561
Revert 3841007
bogdandrutu Sep 13, 2019
16f515c
Mark RFC 0007-no-out-of-band-reporting.md as approved (open-telemetry…
bogdandrutu Sep 14, 2019
7ea7775
Metrics API: Rename Cumulative to Counter (open-telemetry/oteps#47)
jmacd Sep 16, 2019
897dc45
Propose "Named Tracers" (open-telemetry/oteps#16)
z1c0 Sep 26, 2019
b0c5aa6
Assign number 0010 cumulative-to-counter and set to approved (open-te…
jmacd Sep 27, 2019
bc828ff
Set status to approved (open-telemetry/oteps#56)
z1c0 Sep 27, 2019
8982037
Clarify maintenance of auto-instr repos (open-telemetry/oteps#57)
bhs Oct 6, 2019
d1c04fa
Proposal: Add a version semantic attribute (open-telemetry/oteps#38)
austinlparker Oct 8, 2019
59d3f02
Add OpenTelemetry Protocol (OTLP) RFC (open-telemetry/oteps#35)
tigrannajaryan Oct 29, 2019
7df738a
Add OTLP Trace Data Format specification (open-telemetry/oteps#59)
tigrannajaryan Nov 7, 2019
905e355
OTEP 0049: LabelSet specification (to match current Metrics spec) (op…
jmacd Nov 16, 2019
4973f4f
Update 0003-measure-metric-type to match current spec (open-telemetry…
jmacd Nov 16, 2019
fac5e51
Update 0009-metric-handles to match current spec (open-telemetry/otep…
jmacd Nov 26, 2019
6aa8c7e
Rename metric instrument "Handles" to "Bound Instruments" (open-telem…
jmacd Dec 13, 2019
0c7f797
Metric Observer instrument specification (refinement) (open-telemetry…
jmacd Jan 8, 2020
e955087
minor fixes in the sampling RFC (open-telemetry/oteps#50)
jahtalab Jan 9, 2020
110344f
Proposal: Separate Layer for Context Propagation (open-telemetry/otep…
tedsuo Jan 18, 2020
8cf612c
Remove SamplingHint from the Sampling otep (open-telemetry/oteps#79)
bogdandrutu Jan 28, 2020
f92635a
Remove the Metric Gauge instrument, recommend use of other instrument…
jmacd Jan 29, 2020
7422c7e
Clarify named tracers and meters (open-telemetry/oteps#76)
dyladan Feb 3, 2020
174ae15
Rename img files with otep prefix (open-telemetry/oteps#82)
bogdandrutu Feb 3, 2020
2ac4526
Propose removing LabelSet from metrics API (open-telemetry/oteps#90)
bogdandrutu Mar 10, 2020
962fcc9
Add InstrumentationLibrary to describe telemetry from a named Tracer/…
bogdandrutu Mar 13, 2020
56eb56e
Use gRPC status code to indicate retryable and not retryable errors (…
tigrannajaryan Mar 18, 2020
6a4f4bd
Add Logs to OpenTelemetry vocabulary (open-telemetry/oteps#91)
tigrannajaryan Mar 27, 2020
02405b9
Propose OpenTelemetry Logs Vision (open-telemetry/oteps#92)
tigrannajaryan Apr 7, 2020
a209ac3
Remove temporary advertisement from Logs Vision (open-telemetry/oteps…
tigrannajaryan Apr 9, 2020
91bc3d1
Metrics API instrument foundation and refinements (open-telemetry/ote…
jmacd Apr 10, 2020
b494497
Add line break between PRs (open-telemetry/oteps#95)
bruno-garcia Apr 23, 2020
2bcc09f
OTLP/HTTP: HTTP Transport Extension for OTLP (open-telemetry/oteps#99)
tigrannajaryan Apr 27, 2020
2819ca9
Enforce lint, link checks, fix errors. Remove "approved" status. (ope…
bogdandrutu May 4, 2020
2feafdd
Enforce similar structure for oteps as for specs (open-telemetry/otep…
bogdandrutu May 4, 2020
70620b7
Explain the Metric API instruments (open-telemetry/oteps#98)
jmacd May 6, 2020
ce3ea2c
Fix link in otep 0098 (open-telemetry/oteps#106)
bogdandrutu May 6, 2020
306f268
Move trace otep to trace directory (open-telemetry/oteps#105)
bogdandrutu May 7, 2020
2763e6c
Define Log Data model (open-telemetry/oteps#97)
tigrannajaryan May 22, 2020
babc00a
Log Data Model: Rename ShortName to Name (open-telemetry/oteps#109)
tigrannajaryan Jun 4, 2020
174ad57
zPages proposal (open-telemetry/oteps#110)
SergeyKanzhelev Jun 9, 2020
db97153
Move 0097-log-data-model.md to text/logs directory (open-telemetry/ot…
tigrannajaryan Jun 17, 2020
157b1bd
HTTP/JSON Encoded for OTLP (open-telemetry/oteps#122)
tensorchen Jul 7, 2020
a0a302f
Integrate Exemplars with Metrics SDK (open-telemetry/oteps#113)
cnnradams Jul 10, 2020
a0f6d94
Added auto resource detection proposal (open-telemetry/oteps#111)
james-bebbington Jul 14, 2020
995169e
Add metric naming conventions (open-telemetry/oteps#108)
tedpennings Jul 17, 2020
2ea32de
Remote configuration for the SDK proposal (open-telemetry/oteps#121)
churanchen Jul 22, 2020
1688337
Standard system metrics and semantic conventions (open-telemetry/otep…
aabmass Aug 4, 2020
3034e00
Update SignalFx Event/Log conventions (open-telemetry/oteps#127)
keitwb Aug 5, 2020
158d5ea
A proposal for SDK configurations for metric aggregation (Basic Views…
jkwatson Aug 11, 2020
f927df6
Rename text/0126-Configurable-Metric-Aggregations.md to text/metrics/…
bogdandrutu Aug 11, 2020
aa2ac1e
Proposal: OTLP Exporters Support for Configurable Export Behavior (op…
huyan0 Aug 13, 2020
d826ab4
Define what's in scope for OpenTelemetry Logs GA (post traces and met…
tigrannajaryan Aug 26, 2020
b833cde
Error flagging with status codes (open-telemetry/oteps#136)
tedsuo Sep 17, 2020
7ce1ed1
Fix link on Auto Resource Detection OTEP (open-telemetry/oteps#140)
mx-psi Nov 2, 2020
7c58fa4
Versioning and Stability for OpenTelemetry Clients (open-telemetry/ot…
tedsuo Dec 16, 2020
9136ea3
Metrics prototype scenario (open-telemetry/oteps#146)
reyang Feb 25, 2021
d79a35a
Upgrade procedures for OpenTelemetry (open-telemetry/oteps#147)
tedsuo Mar 15, 2021
643c515
Add Logging Library SDK Prototype Specification (open-telemetry/oteps…
tigrannajaryan Mar 19, 2021
21d450e
Update OTEP 146 with UpDownCounter and (UpDown)SumObserver cases (ope…
jmacd Apr 8, 2021
a58a530
Introduce Telemetry Schemas (open-telemetry/oteps#152)
tigrannajaryan Apr 26, 2021
502eb5a
Update 0150-logging-library-sdk.md (open-telemetry/oteps#160)
wsargent May 24, 2021
59c3de7
Update 0146-metrics-prototype-scenarios.md (open-telemetry/oteps#159)
jkwatson May 25, 2021
7300238
Instrumentation Ecosystem Management (open-telemetry/oteps#155)
iNikem May 25, 2021
44f51b2
Add exponential bucketing to histogram protobuf (open-telemetry/oteps…
yzhuge Jun 28, 2021
c6d87ab
Probability sampling: Encode Span's head-adjusted count (open-telemet…
jmacd Sep 9, 2021
203d304
Clarify that Logging SDK is not intended to be used by the end users …
tigrannajaryan Sep 16, 2021
51e28d5
Specify how to propagate consistent head sampling probability (open-t…
jmacd Sep 29, 2021
9ce21b7
Rename "labels" to "attributes" OTEP 0152 (open-telemetry/oteps#181)
tigrannajaryan Oct 7, 2021
9c83c0a
Fix missing apply_to_spans in OTEP 0152 (open-telemetry/oteps#180)
tigrannajaryan Oct 8, 2021
3e9d986
Probability sampler composition rules (open-telemetry/oteps#175)
jmacd Oct 14, 2021
6d78390
Proposed scenarios and roadmap for messaging semantic conventions for…
pyohannes Oct 25, 2021
953b3f8
Allow omitting LogRecord in favor of build pattern in Logging SDKs (o…
tigrannajaryan Nov 15, 2021
82365e8
Scope and roadmap for bringing the existing HTTP semantic conventions…
denisivan0v Jan 27, 2022
23b6eca
Define Mapping of Arbitrary Data to OTLP AnyValue (open-telemetry/ote…
tigrannajaryan Feb 24, 2022
2163c80
Introduce Scope Attributes (open-telemetry/oteps#201)
tigrannajaryan May 24, 2022
83da231
Context propagation requirements for messaging semantic conventions (…
pyohannes Jul 9, 2022
d575160
Events and Logs API (open-telemetry/oteps#202)
scheler Jul 11, 2022
365edee
Propose OpenTelemetry Profiling Vision (open-telemetry/oteps#212)
Rperry2174 Sep 22, 2022
b91c193
Support Elastic Common Schema (ECS) in OpenTelemetry (open-telemetry/…
AlexanderWert Mar 18, 2023
83b053f
Configuration proposal (open-telemetry/oteps#225)
codeboten Mar 30, 2023
6ccfdce
Export SpanContext.IsRemote in OTLP (open-telemetry/oteps#182)
axw Apr 14, 2023
12be023
Separate semantic conventions from the specification. (open-telemetry…
jsuereth May 5, 2023
4c75550
Span structure for messaging scenarios (open-telemetry/oteps#220)
pyohannes Jun 29, 2023
cd1aeec
Columnar encoding for the OpenTelemetry protocol (open-telemetry/otep…
lquerel Jun 29, 2023
f6d9427
Framework for defining the maturity of OpenTelemetry and its SIGs (op…
jpkrohling Dec 14, 2023
090a4d2
Threshold propagation in trace state (open-telemetry/oteps#235)
kentquirk Jan 30, 2024
4ef7645
Introducing Application Telemetry Schema in OpenTelemetry - Vision an…
lquerel Feb 7, 2024
dce766d
Introduces Profiling Data Model v2 (open-telemetry/oteps#239)
petethepig Feb 23, 2024
be34d7d
Introduce Entities Data Model, Part 1 (open-telemetry/oteps#256)
tigrannajaryan May 28, 2024
e03430a
profiles: fix index in example (open-telemetry/oteps#254)
florianl May 28, 2024
a65d54c
Event basics (open-telemetry/oteps#265)
trask Sep 19, 2024
7b6322e
Initial Entity and Resource proposal (open-telemetry/oteps#264)
jsuereth Sep 26, 2024
f66317e
Propose that we move OTEPs into the specification repository. (open-t…
jsuereth Oct 22, 2024
a3c6029
[otep] Propose adding env variables as context carriers to specificat…
adrielp Oct 22, 2024
8bc0abb
Merge remote-tracking branch 'oteps/again-again-again' into merge-again
carlosalberto Nov 1, 2024
622140e
Lint fixes.
carlosalberto Nov 1, 2024
84a6780
Define prototype for proposed features in development (#4273)
jack-berg Nov 1, 2024
6bf3bd1
[chore] Correct label name (#4279)
mx-psi Nov 4, 2024
422a1f5
Add README and template.
carlosalberto Nov 6, 2024
18ebee3
Merge branch 'main' into merge-oteps-final
carlosalberto Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions oteps/0000-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Replace this with your awesome OTEP title

Short (one sentence) summary, e.g., something that would be appropriate for a [CHANGELOG](https://keepachangelog.com/) or release notes.

## Motivation

Why should we make this change? What new value would it bring? What use cases does it enable?

## Explanation

Explain the proposed change as though it was already implemented and you were explaining it to a user. Depending on which layer the proposal addresses, the "user" may vary, or there may even be multiple.

We encourage you to use examples, diagrams, or whatever else makes the most sense!

## Internal details

From a technical perspective, how do you propose accomplishing the proposal? In particular, please explain:

* How the change would impact and interact with existing functionality
* Likely error modes (and how to handle them)
* Corner cases (and how to handle them)

While you do not need to prescribe a particular implementation - indeed, OTEPs should be about **behaviour**, not implementation! - it may be useful to provide at least one suggestion as to how the proposal *could* be implemented. This helps reassure reviewers that implementation is at least possible, and often helps them inspire them to think more deeply about trade-offs, alternatives, etc.

## Trade-offs and mitigations

What are some (known!) drawbacks? What are some ways that they might be mitigated?

Note that mitigations do not need to be complete *solutions*, and that they do not need to be accomplished directly through your proposal. A suggested mitigation may even warrant its own OTEP!

## Prior art and alternatives

What are some prior and/or alternative approaches? For instance, is there a corresponding feature in OpenTracing or OpenCensus? What are some ideas that you have rejected?

## Open questions

What are some questions that you know aren't resolved yet by the OTEP? These may be questions that could be answered through further discussion, implementation experiments, or anything else that the future may bring.

## Future possibilities

What are some future changes that this proposal would enable?
113 changes: 113 additions & 0 deletions oteps/0001-telemetry-without-manual-instrumentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# (Open) Telemetry Without Manual Instrumentation

_Cross-language requirements for automated approaches to extracting portable telemetry data with zero source code modification._

## Motivation

The purpose of OpenTelemetry is to make robust, portable telemetry a built-in feature of cloud-native software. For some software and some situations, that instrumentation can literally be part of the source code. In other situations, it’s not so simple: for example, we can’t necessarily edit or even recompile some of our software, the OpenTelemetry instrumentation only exists as a plugin, or instrumentation just never rises to the top of the priority list for a service-owner. Furthermore, there is occasionally a desire to disable instrumentation for a single plugin or module at runtime, again without requiring developers to make changes to source code.

One way to navigate situations like these is with a software layer that adds OpenTelemetry instrumentation to a service without modifying the source code for that service. (In the conventional APM world, these software layers are often called “agents”, though that term is overloaded and ambiguous so we try avoid it in this document.)

### Why “cross-language”?

Many people have correctly observed that “agent” design is highly language-dependent. This is certainly true, but there are still higher-level “product” objectives for OpenTelemetry that can guide the design choices we make across languages and help users form a consistent impression of what OpenTelemetry provides (and what it does not).

### Suggested reading

* This GitHub issue: [Propose an "Auto-Instrumentation SIG"](https://github.com/open-telemetry/community/pull/87)
* [Rough notes from the June 11, 2019 meeting](https://docs.google.com/document/d/1ix0WtzB5j-DRj1VQQxraoqeUuvgvfhA6Sd8mF5WLNeY/edit) following this ^^ issue
* The [rough draft for this RFC](https://docs.google.com/document/d/1sovSQIGdxXtsauxUNp4qUMEIJZzObdukzPT52eyPCHM/edit#), including the comments

## Proposed guidelines

### Requirements

Without further ado, here are a set of requirements for “official” OpenTelemetry efforts to accomplish zero-source-code-modification instrumentation (i.e., “OpenTelemetry agents”) in any given language:

* _Manual_ source code modifications "very strongly discouraged", with an exception for languages or environments that leave no credible alternatives. Any code changes must be trivial and `O(1)` per source file (rather than per-function, etc).
* Licensing must be permissive (e.g., ASL / BSD)
* Packaging must allow vendors to “wrap” or repackage the portable (OpenTelemetry) library into a single asset that’s delivered to customers
* That is, vendors do not want to require users to comprehend both an OpenTelemetry package and a vendor-specific package
* Explicit, whitebox OpenTelemetry instrumentation must interoperate with the “automatic” / zero-source-code-modification / blackbox instrumentation.
* If the blackbox instrumentation starts a Span, whitebox instrumentation must be able to discover it as the active Span (and vice versa)
* Relatedly, there also must be a way to discover and avoid potential conflicts/overlap/redundancy between explicit whitebox instrumentation and blackbox instrumentation of the same libraries/packages
* That is, if a developer has already added the “official” OpenTelemetry plugin for, say, gRPC, then when the blackbox instrumentation effort adds gRPC support, it should _not_ “double-instrument” it and create a mess of extra spans/etc
* From the standpoint of the actual telemetry being gathered, the same standards and expectations (about tagging, metadata, and so on) apply to "whitebox" instrumentation and automatic instrumentation
* The code in the OpenTelemetry package must not take a hard dependency on any particular vendor/vendors (that sort of functionality should work via a plugin or registry mechanism)
* Further, the code in the OpenTelemetry package must be isolated to avoid possible conflicts with the host application (e.g., shading in Java, etc)

### Nice-to-have properties

* Run-time integration (vs compile-time integration)
* Automated and modular testing of individual library/package plugins
* Note that this also makes it easy to test against multiple different versions of any given library
* A fully pluggable architecture, where plugins can be registered at runtime without requiring changes to the central repo at github.com/open-telemetry
* E.g., for ops teams that want to write a plugin for a proprietary piece of legacy software they are unable to recompile
* Augemntation of whitebox instrumentation by blackbox instrumentation (or, perhaps, vice versa). That is, not only can the trace context be shared by these different flavors of instrumentation, but even things like in-flight Span objects can be shared and co-modified (e.g., to use runtime interposition to grab local variables and attach them to a manually-instrumented span).

## Trade-offs and mitigations

Approaching a problem this language-specific at the cross-language altitude is intrinsically challenging since "different languages are different" – e.g., in Go there is no way to perform the kind of runtime interpositioning that's possible in Python, Ruby, or even Java.

There is also a school of thought that we should only be focusing on the bits and bytes that actually escape the running process and ignore how that's actually accomplished. This has a certain elegance to it, but it also runs afoul of the need to have manual instrumentation interoperate with the zero-touch instrumentation, especially when it comes to the (shared) distributed context itself.

## Proposal

### What is our desired end state for OpenTelemetry end-users?

To reiterate much of the above:

* First and foremost, **portable OpenTelemetry instrumentation can be installed without manual source code modification**
* There’s one “clear winner” when it comes to portable, automatic instrumentation; just like with OpenTracing and OpenCensus, this is a situation where choice is not necessarily a good thing. End-users who wish to contribute instrumentation plugins should not have their enthusiasm and generosity diluted across competing projects.
* As much as such a thing is possible, consistency across languages
* Broad coverage / “plugin support”
* Broad vendor support for OpenTelemetry
* All other things being equal, get all of these ^^ benefits ASAP!

### What's the basic proposal?

Given the desired end state, the Datadog tracers seem like the closest-fit, permissively-licensed option out there today. We asked Datadog's leadership whether they would be interested in donating that code to OpenTelemetry, and they were receptive to the idea. (I.e., this would not be a "hard fork" that must be maintained in parallel forever)

### The overarching (technical) process, per-language

* Start with [the Datadog `dd-trace-foo` tracers](https://github.com/DataDog)
* For each language:
* Fork the Datadog `datadog/dd-trace-foo` repo into a `open-telemetry/auto-instr-foo` OpenTelemetry repo (exact naming TBD)
* In parallel:
* The `dd-trace-foo` codebases already do a good job separating Datadog-specific functionality from general-purpose functionality. Where needed, make that boundary even more explicit through an API (or "SPI", really).
* Create a new `dd-trace-foo` lib that wraps `auto-instr-foo` and includes the Datadog-specific pieces factored out above
* Show that it’s also possible to bind to arbitrary OpenTelemetry-based tracers to the above API/SPI
* Declare the forked `auto-instr-foo` repository ready for production beta use
* For some (ideally brief) period:
* When new plugins are added to Datadog's (original) repo, merge them over into the `auto-instr-foo` repo
* Allow Datadog end-users to bind to either for some period of time (ultimately Datadog's decision on timeline here, and does not prevent other tracers from using `auto-instr-foo`)
* Finally, when the combination of `auto-instr-foo` and a Datadog wrapper is functionally equivalent to the `dd-trace-foo` mainline, the latter can be safely replaced by the former.
* Note that, by design, this is not expected to affect Datadog end-users
* Moved repo is GA’d: all new plugins (and improvements to the auto-instrumentation core) happen in the `auto-instr-foo` repo

There are some languages that will have OpenTelemetry support before they have Datadog `dd-trace-foo` support. In those situations, we will fall back to the requirements in this OTEP and leave the technical determinations up to the language SIG and the OpenTelemetry TC.

### Governance of the auto-instrumentation libraries

Each `auto-instr-foo` repository must have at least one [Maintainer](https://github.com/open-telemetry/community/blob/master/community-membership.md#maintainer) in common with the main `opentelemetry-foo` language repository. There are no other requirements or constraints about the set of maintainers/approvers for the main language repository and the respective auto-instrumentation repository; in particular, there may be maintainers/approvers of the main language repository that are not maintainers/approvers for the auto-instrumentation repository, and vice versa.

### Mini-FAQ about this proposal

**Will this be the only auto-instrumentation story for OpenTelemetry?** It need not be. The auto-instrumentation libraries described above will have no privileged access to OpenTelemetry APIs, and as such they have no exclusive advantage over any other auto-instrumentation libraries.

**What about auto-instrumenting _Project X_? Why aren't we using that instead??** First of all, there's nothing preventing any of us from taking great ideas from _Project X_ and incorporating them into these auto-instrumentation libraries. We propose that we start with the Datadog codebases and iterate from there as need be. If there are improvements to be made in any given language, they will be welcomed by all.

## Prior art and alternatives

There are many proprietary APM language agents – no need to survey them all here. There is a much smaller list of "APM agents" (or other auto-instrumentation efforts) that are already permissively-licensed OSS. For instance, when we met to discuss options for JVM (longer notes [here](https://docs.google.com/document/d/1ix0WtzB5j-DRj1VQQxraoqeUuvgvfhA6Sd8mF5WLNeY/edit#heading=h.kjctiyv4rxup)), we came away with the following list:

* [Honeycomb's Java beeline](https://github.com/honeycombio/beeline-java)
* [Datadog's Java tracer](https://github.com/datadog/dd-trace-java)
* [Glowroot](https://glowroot.org/)
* [SpecialAgent](https://github.com/opentracing-contrib/java-specialagent)

The most obvious "alternative approach" would be to choose "starting points" independently in each language. This has several problems:

* Higher likelihood of "hard forks": we want to avoid an end state where two projects (the OpenTelemetry version, and the original version) evolve – and diverge – independently
* Higher likelihood of "concept divergence" across languages: while each language presents unique requirements and challenges, the Datadog auto-instrumentation libraries were written by a single organization with some common concepts and architectural requirements (they were also written to be OpenTracing-compatible, which greatly increases our odds of success given the similarities to OpenTelemetry)
* Datadog would also like a uniform strategy here, and this donation requires their consent (unless we want to do a hard fork, which is suboptimal for everyone). So starting with the Datadog libraries in "all but one" (or "all but two", etc) languages makes this less palatable for them
110 changes: 110 additions & 0 deletions oteps/0005-global-init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Global SDK initialization

**Status**: proposed

Specify the behavior of OpenTelemetry APIs and implementations at startup.

## Motivation

OpenTelemetry is designed with a separation between the API and the
SDK which implements it, allowing an application to configure and bind
any compatible SDK at runtime. OpenTelemetry is designed to support
"zero touch" instrumentation for third party libraries through the use
of a global instance.

In many programming environments, it is possible for libraries of code
to auto-initialize, allowing them to begin operation concurrently with
the main program, e.g., while initializing static program state. This
presents a set of opposing requirements: (1) the API supports a
configurable SDK; (2) third party libraries may use OpenTelemetry
without configuration.

## Explanation

There are several acceptable ways to address this situation. The
feasibility of each approach varies by language. The implementation
must select one of the following strategies:

### Service provider mechanism

Where the language provides a commonly accepted way to inject SDK
components, it should be preferred. The Java SPI supports loading and
configuring the global SDK before it is first used, and because of
this property the service provider mechanism case leaves little else
to specify.

### Explicit initializer

When it is not possible to ensure the SDK is installed and configured
before the API is first used, loading the SDK is handed off to the
user "at the right time", as stated in [Ruby issue
19](https://github.com/open-telemetry/opentelemetry-ruby/issues/19).
In this case, a number of requirements must be specified, as discussed
next.

## Requirements: Explicit initializer

OpenTelemetry specifies that the default implementation is
non-operational (i.e., a "no-op"), requiring that API method calls
result in effectively zero instrumentation overhead. We expect third
party libraries to use the global SDK before it is installed, which is
addressed in a requirement stated below.

The explicit initializer method should take independent `Tracer` and
`Meter` objects (e.g., `opentelemetry.Init(Tracer, Meter)`). The SDK
may be installed no more than once. After the first SDK installed,
subsequent calls to the explicit initializer shall log console
warnings.

In common language, uses of the global SDK instance (i.e., the Tracer
and Meter) must "begin working" once the SDK is installed, with the
following stipulations:

### Tracer

There may be loss of spans at startup.

Spans that are started before the SDK is installed are not recovered,
they continue as No-op spans.

### Meter

There may be loss of metrics at startup.

Metric SubMeasure objects (i.e., metrics w/ predefined labels)
initialized before the SDK is installed will redirect to the global
SDK after it is installed.

### Concrete types

Keys, tags, attributes, labels, resources, span context, and
distributed context are specified as pure API objects, therefore do
not depend on the SDK being installed.

## Trade-offs and mitigations

### Testing support

Testing should be performed without depending on the global SDK.

### Synchronization

Since the global Tracer and Meter objects are required to begin
working once the SDK is installed, there is some implied
synchronization overhead at startup, overhead we expect to fall after
the SDK is installed. We recommend explicitly installing a No-op SDK
to fully disable instrumentation, as this approach will have a lower
overhead than leaving the OpenTelemetry library uninitialized.

## Prior art and alternatives

As an example that does not qualify as "commonly accepted", see [Go
issue 52](https://github.com/open-telemetry/opentelemetry-go/issues/52)
which demonstrates using the Go `plugin` package to load a
configurable SDK prior to first use.

## Open questions

What other options should be passed to the explicit global initializer?

Is there a public test for "is the SDK installed; is it a no-op"?
Loading
Loading