-
Notifications
You must be signed in to change notification settings - Fork 903
Extended opentelemetry #7496
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
base: main
Are you sure you want to change the base?
Extended opentelemetry #7496
Conversation
- Create Entity/EntityBuilder class in internal package - Update serialization code Need to discuss how to work with Resource going forward.
- Remove ResourceWithEntity, no way to keep bincompat that way - Update toString tests to be a lot more forgiving, but preserve intent
- fix reflective method lookup - also add unit test in the right project.
- Creates an API matching EntityProvider OTEP - Updates EntityDetector to be ResourceDetector - Creates synchronous "update resource with this entity" method. - Adds wiring for incubating API + incubating SDK Note: Still have some thoughts and ideas about a formal API, this may still change.
- Remove `Entity` and only expose `EntityBuilder` similar to how we do `LogRecord`s. - Have methods on `Resource` which determine if you're attaching the entity, simplify "remove" or just ignore for now.
…OpenTelemetry API. - Update shared state in SDK to use Supplier<Resource> instead of Resource - Add helper utils to expose private methods to supply the supplier - Create new ExtendedOpenTelemetry* API/SDK and end-to-end test.
…internal/otlp/EntityRefMarshaler.java Co-authored-by: jack-berg <[email protected]>
…iderBuilder.java Co-authored-by: jack-berg <[email protected]>
- Hide more methods (no incubating methods in public APIs that are not internal) - Update builder API to use attributes directly - Use static instances in Noop API
…lemetrySdk.getOpenTelemetrySdk() to return the extended instance
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7496 +/- ##
============================================
- Coverage 89.99% 89.97% -0.02%
- Complexity 7078 7093 +15
============================================
Files 803 807 +4
Lines 21405 21449 +44
Branches 2086 2087 +1
============================================
+ Hits 19263 19299 +36
- Misses 1479 1488 +9
+ Partials 663 662 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Alternative is #7500 |
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.api.incubator.config.ConfigProvider; | ||
|
||
/** Extension to {@link OpenTelemetry} that supports getting {@link ConfigProvider}. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the language generic enough to support evolving use cases.
/** Extension to {@link OpenTelemetry} that supports getting {@link ConfigProvider}. */ | |
/** Extended {@link OpenTelemetry} with experimental APIs. */ |
*** MODIFIED CLASS: PUBLIC NON_FINAL (<- FINAL) io.opentelemetry.sdk.OpenTelemetrySdk (not serializable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth calling out attention to this, but I think this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative PR doesn't need this
import javax.annotation.concurrent.ThreadSafe; | ||
|
||
/** A new interface for creating OpenTelemetrySdk that supports getting {@link ConfigProvider}. */ | ||
public class ExtendedOpenTelemetrySdk extends OpenTelemetrySdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we could skip extending OpenTelemetrySdk and avoid awkwardness of trying to figure mesh together builder and constructors. OpenTelemetrySdk doesn't do much anyway so not much to repeat.
Maybe do something like have ExtendedOpenTelemetrySdk
accept a delegate OpenTelemetrySdk
instance during initialization and skip the builder pattern? Usage could be something like:
ExtendedOpenTelemetrySdk sdk = ExtendedOpenTelemetrySdk.create(OpenTelemetrySdk, SdkConfigProvider);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal (IMO) is to have AutoConfiguredOpenTelemetrySdk.getOpenTelemetrySdk()
return the instance that we can work with - so that library users don't have to jump through hoops to have the correct instance.
* @param configurator A callback fleshing out tracers. | ||
* @return this | ||
*/ | ||
public ExtendedOpenTelemetrySdkBuilder withTracerProvider( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we get from these withers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from the entity PR where it's actually needed
@@ -82,7 +83,7 @@ private DeclarativeConfiguration() {} | |||
* | |||
* @throws DeclarativeConfigException if unable to parse or interpret | |||
*/ | |||
public static OpenTelemetrySdk parseAndCreate(InputStream inputStream) { | |||
public static ExtendedOpenTelemetrySdk parseAndCreate(InputStream inputStream) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool - frees up callers from needing to worry about initializing SdkConfigProvider
.matches("OpenTelemetrySdk\\{tracerProvider=SdkTracerProvider\\{.*}.*}") | ||
.matches("OpenTelemetrySdk\\{.*, meterProvider=SdkMeterProvider\\{.*}.*}") | ||
.matches("OpenTelemetrySdk\\{.*, loggerProvider=SdkLoggerProvider\\{.*}.*}") | ||
.matches("OpenTelemetrySdk\\{.*, propagators=DefaultContextPropagators\\{.*}}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meh yeah this is probably an overdue improvement 😉
private IncubatingUtil() {} | ||
|
||
@Nullable | ||
static OpenTelemetrySdk createExtendedOpenTelemetrySdk() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot to delete this
@jack-berg please check if you like the alternative without API changes better: #7500 |
Fixes #7495