Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Global initializer requirements proposal #11

Merged
merged 10 commits into from
Aug 16, 2019

Conversation

jmacd
Copy link
Contributor

@jmacd jmacd commented Jul 31, 2019

This proposal is supported by demonstration code here:
jmacd/opentelemetry-go#3

This is heavily influenced by: open-telemetry/opentelemetry-ruby#19

This is attempting to resolve: open-telemetry/opentelemetry-go#52

@bhs
Copy link
Contributor

bhs commented Aug 4, 2019

@jmacd what's the current status on this PR? What are we blocked on, if anything? Thanks in advance...

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 OpenTracing library uninitialized.
Copy link
Contributor

Choose a reason for hiding this comment

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

*OpenTelemetry

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw, in OpenTracing/OpenTelemetry Java a default no-op SDK is installed, so no explicit installation of a no-op SDK is needed at all for this case, just FYI ;)

Copy link
Contributor Author

@jmacd jmacd Aug 13, 2019

Choose a reason for hiding this comment

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

I was trying to emphasize a minor point, which is that there may be a difference in performance between the default/implicit noop implementation and an explicit noop implementation. The explicit noop implementation can do nothing. The implicit noop implementation, if it is to "start working after the SDK is first registered", must do more than the explicit noop implementation. This is a super minor point, but if I wanted the lowest overhead possible, I should explicitly install a noop.

In Java, the presence of a Service Provider Interface sidesteps this concern. In Java, the elected SDK can be installed before its first use.


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"?
Copy link
Contributor

Choose a reason for hiding this comment

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

In OpenTracing we have GlobalTracer.isRegistered() (to tell whether any SDK has been installed) but that works mostly as a hint ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍
I'd lean toward having the Tracer and Meter interfaces support a "Am I not a Noop?" method.

Copy link
Contributor

@carlosalberto carlosalberto left a comment

Choose a reason for hiding this comment

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

Left a pair of comments, but looks great overall!

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
Copy link
Member

Choose a reason for hiding this comment

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

I suggest that we have separate initialization for Tracer and Meter, even in the examples here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it's possible with this API to independently construct and configure the Tracer and Meter that will be used, all that this requires is that they be provided in a single initializer call. I believe that we should encourage a single initializer call so that when a combined implementation (i.e., an SDK that presents both APIs) is registered, it can be sure that its registration is all-or-none.

In any case, it should be possible to provide Tracer and Meter implementations that are completely independent, or to pass a Noop implementation of either in the initializer.

initialized before the SDK is installed will redirect to the global
SDK after it is installed.

### Concrete types
Copy link
Member

Choose a reason for hiding this comment

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

I wonder what shall we do with propagators (e.g. should propagators be part of tracing API). We can explore this in a separate PR though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see a separate issue here, yes.

Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

Look good in general.

I left one comment about the global initialization - we don't want to have opentelemetry.Init(Tracer, Meter) even in examples, OpenTelemetry allows people to use trace without metrics or vice versa.

@bogdandrutu
Copy link
Member

@jmacd please respond to the comments.

@jmacd
Copy link
Contributor Author

jmacd commented Aug 13, 2019

I've responded to the comments. I don't see this proposal as preventing the use of independent Tracer and Meter implementations.

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 OpenTracing library uninitialized.
Copy link
Member

Choose a reason for hiding this comment

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

s/OpenTracing/OpenTelemetry

@bogdandrutu
Copy link
Member

@jmacd ping, can you please fix the last comment.

Josh MacDonald added 2 commits August 16, 2019 11:58
@jmacd
Copy link
Contributor Author

jmacd commented Aug 16, 2019

Done.

@jmacd
Copy link
Contributor Author

jmacd commented Aug 16, 2019

After #16, I believe we'll change the global initialization logic to install factories rather than concrete Tracer and Meter interfaces.

@bogdandrutu bogdandrutu merged commit e4ebf33 into open-telemetry:master Aug 16, 2019
@jmacd jmacd deleted the jmacd/global_init branch September 13, 2019 18:16
carlosalberto pushed a commit to carlosalberto/oteps that referenced this pull request Oct 23, 2024
* Document global initializion

* Global initializer requirements

* Minor revision

* Set status

* Rename 0010-global-init.md to text/0005-global-init.md

* OTr->OTel
carlosalberto pushed a commit to carlosalberto/oteps that referenced this pull request Oct 23, 2024
* Document global initializion

* Global initializer requirements

* Minor revision

* Set status

* Rename 0010-global-init.md to text/0005-global-init.md

* OTr->OTel
carlosalberto pushed a commit to carlosalberto/oteps that referenced this pull request Oct 30, 2024
* Document global initializion

* Global initializer requirements

* Minor revision

* Set status

* Rename 0010-global-init.md to text/0005-global-init.md

* OTr->OTel
carlosalberto pushed a commit to open-telemetry/opentelemetry-specification that referenced this pull request Nov 8, 2024
* Document global initializion

* Global initializer requirements

* Minor revision

* Set status

* Rename 0010-global-init.md to text/0005-global-init.md

* OTr->OTel
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loading the Go SDK
5 participants