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

Drop event API / SDK #7053

Merged
merged 3 commits into from
Jan 30, 2025
Merged

Conversation

jack-berg
Copy link
Member

Resoles #7008.

Callers of the event API can recreate the equivalent by calling ((ExtendedILogger) logger).logRecordBuilder(), albeit at the expense of ergonomics.

I'll annotate this PR with notable changes.

@jack-berg jack-berg requested a review from a team as a code owner January 29, 2025 18:57
@@ -672,7 +666,6 @@ private static void testLogRecordExporter(LogRecordExporter logRecordExporter) {
.setSeverityText("DEBUG")
.setContext(Context.current())
.emit();
eventLogger.builder("namespace.event-name").put("key", "value").emit();
Copy link
Member Author

Choose a reason for hiding this comment

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

Generally in this PR, I translate any events to the equivalent log record call, rather than deleting. Here I delete because there's already a log record emitted / asserted which contains all the fields the event would

.put("doubleArrKey", 1.0, 2.0)
.put("boolArrKey", true, false)
// Set complex data
.put("key", Value.of(Collections.singletonMap("childKey1", Value.of("value"))))
Copy link
Member Author

Choose a reason for hiding this comment

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

EventBuilder had put overloads which add KeyValue entries to the log record value. Producing the equivalent with LogRecordBuilder is more cumbersome.

Copy link
Member

Choose a reason for hiding this comment

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

I think this may be ok now that we're deprioritizing event bodies

Copy link
Member Author

Choose a reason for hiding this comment

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

LogRecordBuilder also lacks overloads for setting attributes which we see in the span api.

Obviously we'd want to add these as part of an ergonomic / user facing API.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this may be ok now that we're deprioritizing event bodies

Until we land #6983 (or equivalent) the body is the only place you can put complex data as a java user.

Copy link
Member

Choose a reason for hiding this comment

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

LogRecordBuilder also lacks overloads for setting attributes which we see in the span api.

Obviously we'd want to add these as part of an ergonomic / user facing API.

I'd probably be in favor of adding these overloads in the LogRecordBuilder regardless of the future user facing API, but I don't think there's any rush on this

.logRecordBuilder()
.setEventName("namespace.test-name")
.setSeverity(Severity.INFO)
.setBody(Value.of(io.opentelemetry.api.common.KeyValue.of("cow", Value.of("moo"))))
Copy link
Member Author

Choose a reason for hiding this comment

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

We lose a default severity of INFO set by the event SDK.

Also, as mentioned here, we lose the put overloads for adding KeyValue entries to the body.

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.85%. Comparing base (8e31bf4) to head (90d0a81).
Report is 1 commits behind head on main.

❌ Your project status has failed because the head coverage (89.97%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7053      +/-   ##
============================================
- Coverage     89.95%   89.85%   -0.10%     
+ Complexity     6668     6608      -60     
============================================
  Files           748      740       -8     
  Lines         20105    19972     -133     
  Branches       1970     1963       -7     
============================================
- Hits          18085    17946     -139     
- Misses         1427     1438      +11     
+ Partials        593      588       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

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

Farewell, old friend. 🌤️

@jack-berg jack-berg merged commit bf71be1 into open-telemetry:main Jan 30, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants