-
Notifications
You must be signed in to change notification settings - Fork 821
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
Logs/events API #3117
Logs/events API #3117
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3117 +/- ##
==========================================
+ Coverage 93.24% 93.26% +0.02%
==========================================
Files 196 201 +5
Lines 6541 6579 +38
Branches 1373 1379 +6
==========================================
+ Hits 6099 6136 +37
- Misses 442 443 +1
|
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.
not sure if you wanted feedback about this but went for it anyway, i'm still following how the oteps evolve because i'm not sure to see where the difference between Event and LogRecord is going
experimental/packages/opentelemetry-api-logs/src/types/Logger.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-logs/src/NoopLoggerProvider.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-logs/src/types/LoggerOptions.ts
Outdated
Show resolved
Hide resolved
a56f539
to
586778f
Compare
experimental/packages/opentelemetry-api-logs/src/types/Logger.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-logs/src/internal/global-utils.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-logs/src/types/Event.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-logs/tsconfig.docs.json
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-logs/src/types/LogRecord.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-logs/src/types/LogRecord.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-logs/src/types/Event.ts
Outdated
Show resolved
Hide resolved
I think the folder opentelemetry-api-logs should be renamed to api-logs as we started to omit the |
experimental/packages/opentelemetry-api-metrics/tsconfig.docs.json
Outdated
Show resolved
Hide resolved
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.
Looks good just a few comments and I think we can start getting this ✅ and merged soon
|
||
import { Attributes } from '@opentelemetry/api'; | ||
|
||
export interface Event { |
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.
Events do not have span context properties?
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 have added the context properties. @scheler just double checking that the intent was to be able to add them manually (in addition to the includeTraceContext
config for automatic inclusion).
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'm not for or against manually including them, just thought it was odd not to be consistent
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.
Events do need to have span context and the SDK should add it to the event when includeTraceContext
is on. The includeTraceContext
option is added to support the case of not tagging span context of an unrelated in-progress span in an event in the same execution context. For eg., if a user clicks on a button in the browser while a span is in progress, you may not want to include this span's context in the user click event, and in this case the event needs to be created from a logger
that has includeTraceContext
off.
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.
After a conversation with @scheler, I have removed the includeTraceContext
option for now, as we could not think of a use case for it.
You're missing the |
Most recent failure seems to be related to #3238 |
@dyladan @pichlermarc The codecov check was failing, so I added one more test just to make sure that lower coverage is not caused by this change. Now the HttpsInstrumentation integration test is failing again. Can you please re-run it again? |
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.
Looks great, thanks for putting in all this work. 🚀
Which problem is this PR solving
This is a draft implementation of the proposed specification for logs/events API.
open-telemetry/opentelemetry-specification#2676
Short description of the changes
For the most part follows the pattern from the trace and metrics APIs. The main things of note are:
The Logger interface has the following methods: createLogRecord(), createEvent(), emit(LogRecord), emit(Event), emitEvent(name, attributes). If we want to have an
emit
method that takes an instance of LogRecord / Event, then the API also must provide a method for creating the instance. This is similar toTracer.startSpan()
orMeter.createCounter()
.The API defines an abstract class for Event, which
event.name
andevent.domain
attributes in constructor based on name and domain argumentsSince (if) we have a separate method for emitting an event, and this method should take an instance of an event, then we need to define an interface for an Event. The reason I chose abstract class over interface is because 1) the Event interface would be the same as LogRecord if it was just an interface, and 2) the abstract class can enforce setting name/domain as attributes with the specific keys.
Type of change
Please delete options that are not relevant
How Has This Been Tested?
Checklist: