-
Notifications
You must be signed in to change notification settings - Fork 713
Events API implementation #4054
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
dae55a5
initial commit
soumyadeepm04 078d75c
lint
soumyadeepm04 7df9ed2
Merge branch 'main' into eventapi
soumyadeepm04 f028535
resolve comments
soumyadeepm04 722fb54
Merge branch 'eventapi' of https://github.com/soumyadeepm04/opentelem…
soumyadeepm04 0b3eec2
Merge branch 'main' into eventapi
xrmx 32baf7c
Merge branch 'main' into eventapi
emdneto da611a8
updated CHANGELOG
soumyadeepm04 100826d
Merge branch 'eventapi' of https://github.com/soumyadeepm04/opentelem…
soumyadeepm04 79af742
Merge branch 'main' into eventapi
emdneto 2d186bd
Merge branch 'main' into eventapi
soumyadeepm04 7a4db6c
initial full implementation
soumyadeepm04 a991447
Merge branch 'eventapi' of https://github.com/soumyadeepm04/opentelem…
soumyadeepm04 7111579
Merge branch 'main' into eventapi
soumyadeepm04 1115efc
lint
soumyadeepm04 a20d31e
Merge branch 'eventapi' of https://github.com/soumyadeepm04/opentelem…
soumyadeepm04 e328c9d
lint
soumyadeepm04 0d1dd73
lint
soumyadeepm04 bfe1fb0
rename file
soumyadeepm04 235eec5
lint
soumyadeepm04 f25db47
Merge branch 'main' into eventapi
lzchen cfc3792
fix comments
soumyadeepm04 5589341
Merge branch 'eventapi' of https://github.com/soumyadeepm04/opentelem…
soumyadeepm04 2ff0a4e
fix lint
soumyadeepm04 1742aaa
fix comments
soumyadeepm04 f597da6
fix lint
soumyadeepm04 c3642ed
fix lint
soumyadeepm04 e379cb4
Merge branch 'main' into eventapi
lzchen f5928e8
Merge branch 'main' into eventapi
xrmx 3259a1b
Merge branch 'main' into eventapi
xrmx ad8244d
Update opentelemetry-api/src/opentelemetry/_events/__init__.py
soumyadeepm04 9e07117
fix attributes
soumyadeepm04 68831d3
Merge branch 'eventapi' of https://github.com/soumyadeepm04/opentelem…
soumyadeepm04 5b10d0b
fix lint
soumyadeepm04 2cf8bd9
Merge branch 'main' into eventapi
lzchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from abc import ABC, abstractmethod | ||
soumyadeepm04 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
from typing import Any, Optional | ||
|
||
from opentelemetry._logs import LogRecord | ||
from opentelemetry._logs.severity import SeverityNumber | ||
from opentelemetry.context.context import Context | ||
from opentelemetry.util.types import Attributes | ||
|
||
|
||
class Event(LogRecord): | ||
|
||
def __init__( | ||
self, | ||
name: str, | ||
payload: Optional[Any] = None, | ||
soumyadeepm04 marked this conversation as resolved.
Show resolved
Hide resolved
lzchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
attributes: Optional[Attributes] = None, | ||
): | ||
super().__init__( | ||
body=payload, # type: ignore | ||
attributes=attributes, | ||
) | ||
self.name = name | ||
|
||
|
||
class EventLogger(ABC): | ||
xrmx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def __init__( | ||
self, | ||
name: str, | ||
body: Optional[Any] = None, | ||
timestamp: Optional[int] = None, | ||
context: Optional[Context] = None, | ||
severity_number: Optional[SeverityNumber] = None, | ||
attributes: Optional[Attributes] = None, | ||
): | ||
self._name = name | ||
self._body = body # type: ignore | ||
self._timestamp = timestamp | ||
self._context = context | ||
self._severity_number = severity_number | ||
self._attributes = attributes | ||
|
||
@abstractmethod | ||
def emit(self, event: "Event") -> None: | ||
"""Emits a :class:`Event` representing an event.""" | ||
|
||
|
||
class EventLoggerProvider(ABC): | ||
|
||
@abstractmethod | ||
def get_event_logger( | ||
self, | ||
name: str, | ||
version: Optional[str] = None, | ||
schema_url: Optional[str] = None, | ||
attributes: Optional[Attributes] = None, | ||
) -> EventLogger: | ||
"""Returns an EventLoggerProvider for use.""" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.