-
Notifications
You must be signed in to change notification settings - Fork 656
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 API: not possible to use without SDK #4319
Comments
This is part of the same issue - if I try to use SDK from opentelemetry._logs import LogRecord as APILogRecord
from opentelemetry._logs import get_logger_provider
from opentelemetry.sdk._logs import LogRecord as SDKLogRecord
...
resource = Resource.create({"service.name": "test logs"})
logger_provider = LoggerProvider(resource=resource)
logger_provider.add_log_record_processor(SimpleLogRecordProcessor(ConsoleLogExporter()))
set_logger_provider(logger_provider)
logger = get_logger_provider().get_logger(__name__)
with trace_provider.get_tracer("example").start_as_current_span("foo"):
logger.emit(SDKLogRecord(body="Hello, World!", attributes={"foo": "bar"})) I get into the following issues:
|
Let's assume I'm building a logging bridge for one of many python non-standard loggers (e.g. structlog).
I should be able to create a library using logging (bridge) API alone.
So I should write a code like:
It'd fail with
Probably related to #3552
The recommendation
ReadWriteLogRecord
and should probably replaceLogData
(see Logs SDK: consider removingLogData
and extending SDKLogRecord
to have instrumentation scope #4313)logger.emit(....)
with parameters and the SDK implementation of logger will create SDK implementation ofLogRecord
Part of open-telemetry/community#1751
The text was updated successfully, but these errors were encountered: