-
Notifications
You must be signed in to change notification settings - Fork 900
[DO NOT MERGE] Entity Prototype for SDK Specification #7434
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?
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
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (73.87%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #7434 +/- ##
============================================
- Coverage 89.75% 89.64% -0.11%
- Complexity 6980 7203 +223
============================================
Files 797 826 +29
Lines 21165 21926 +761
Branches 2057 2118 +61
============================================
+ Hits 18996 19656 +660
- Misses 1505 1589 +84
- Partials 664 681 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- 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.
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.
Left a variety of comments, but the only material ones are about naming.
api/incubator/src/main/java/io/opentelemetry/api/incubator/entities/ExtendedOpenTelemetry.java
Outdated
Show resolved
Hide resolved
api/incubator/src/main/java/io/opentelemetry/api/incubator/entities/ExtendedOpenTelemetry.java
Outdated
Show resolved
Hide resolved
api/incubator/src/main/java/io/opentelemetry/api/incubator/entities/Resource.java
Outdated
Show resolved
Hide resolved
* @param entityType the type of entity to remove. | ||
* @return true if entity was found and removed. | ||
*/ | ||
public boolean removeEntity(String entityType); |
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.
So can multiple instrumentations compete to add or remove an entity with the same type?
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.
Yes. This API is here to explore the browser-SIGs needs where session has changed and needs to be replaced.
The current addOrUpdate
method does NOT replace an entity if the ID has changed, you must manually remove it.
This is the "footgun" we're worried about in Entities SIG and need to explore.
api/incubator/src/main/java/io/opentelemetry/api/incubator/entities/Resource.java
Outdated
Show resolved
Hide resolved
sdk/common/src/main/java/io/opentelemetry/sdk/resources/internal/SdkEntity.java
Outdated
Show resolved
Hide resolved
@@ -18,28 +18,29 @@ | |||
*/ | |||
final class LoggerSharedState { | |||
private final Object lock = new Object(); | |||
private final Resource resource; | |||
private final Supplier<Resource> resourceSupplier; |
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.
👍
sdk/logs/src/main/java/io/opentelemetry/sdk/logs/LoggerSharedState.java
Outdated
Show resolved
Hide resolved
sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLoggerProviderBuilder.java
Outdated
Show resolved
Hide resolved
* @param supplier The supplier of {@link Resource}. | ||
* @since 1.X.0 | ||
*/ | ||
SdkLoggerProviderBuilder setResourceSupplier(Supplier<Resource> supplier) { |
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.
I don't see these new Sdk{Signal}ProviderBuilder#setResourceSupplier
methods being exercised. How do these fit into the puzzle?
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.
…internal/otlp/EntityRefMarshaler.java Co-authored-by: jack-berg <34418638+jack-berg@users.noreply.github.com>
…iderBuilder.java Co-authored-by: jack-berg <34418638+jack-berg@users.noreply.github.com>
- 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
Replaces #6855
Implementation of OTEP#264
io.opentelemetry.sdk.resources.internal
Resource
andResourceBuilder
do NOT follow other data class conventions in the SDK (of being a pure interface), so we areunable to have this code anywhere but inside the SDK to make everything work.
toString
tests to be more flexibleentity
incubator packageEntityProvider
EntityDetector
EntityDetector
forservice
andtelemetry.sdk
Context
TODOs
Entity
classesResource
in the SDK. Bincompat prevents many good design options.telemetry.sdk
andservice
resource attributes to be entities and include aSchemaURL
.EntityDetector
mechanism and wiringEntityProvider
orResourceProvider
in the SDK, similar toTraceProvider
,MeterProvider
, etc.The current design represents a "middle ground" for binary compatibility given the state of
Resource
today in the SDK.