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

Test SDK TracerProvider #1298

Merged
merged 3 commits into from
Nov 19, 2024
Merged

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Nov 18, 2024

  • Move the tracerProvider type and related functionality to its own file to help discoverability.
  • Use a singleton instance of the tracerProvider for tracerProviderInstance instead of having a new value created each call to TracerProvider.
  • Test the singleton nature of TracerProvider.
  • Test the concurrent safe behavior of the provided TracerProvider (part of SDK needs to be concurrent safe #1297).

@MrAlias MrAlias added this to the v0.18.0-alpha milestone Nov 18, 2024
Move the tracerProvider type and related functionality to its own file
to help discoverability.

Use a singleton instance of the tracerProvider for
tracerProviderInstance instead of having a new value created each call
to TracerProvider.

Test the singleton nature of TracerProvider.

Test the concurrent safe behavior of the provided TracerProvider (part
of open-telemetry#1297).
@MrAlias MrAlias marked this pull request as ready for review November 18, 2024 19:48
@MrAlias MrAlias requested a review from a team as a code owner November 18, 2024 19:48
@RonFed
Copy link
Contributor

RonFed commented Nov 19, 2024

Which part here addresses concurrency? If I understood this correctly, the old code also used a singleton?

@MrAlias
Copy link
Contributor Author

MrAlias commented Nov 19, 2024

Which part here addresses concurrency? If I understood this correctly, the old code also used a singleton?

Correct. The old code is already concurrent safe. This just adds a test to ensure that it remains that way.

The old code uses a default value as the file scope tracer provider. Since Go will always copy-by-value, each value returned from TracerProvider was being copied to new memory. This also changes that to always reference the same instance of a *tracerProvider that is allocated to the heap.

@MrAlias MrAlias merged commit 8d657f3 into open-telemetry:main Nov 19, 2024
27 checks passed
@MrAlias MrAlias deleted the sdk-tracer-provider branch November 19, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants