[Bug]: Cannot send log to jaeger from a python application #5190
-
What happened?I'm trying to send logs from my python application to Steps to reproduceI've used the following python code (inspired by otel logs collection yoda example) import logging
import time
from opentelemetry import trace
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
OTLP_GRPC_ENDPOINT = "localhost:4317"
resource = Resource.create({SERVICE_NAME: "testing-jaeger"})
def configure_logger(endpoint: str, resource: Resource) -> None:
import logging
from opentelemetry import _logs
from opentelemetry.exporter.otlp.proto.grpc._log_exporter import (
OTLPLogExporter,
)
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
from opentelemetry.sdk._logs.export import SimpleLogRecordProcessor
provider = LoggerProvider(resource=resource)
_logs.set_logger_provider(provider)
processor = SimpleLogRecordProcessor(OTLPLogExporter(endpoint=endpoint, insecure=True))
provider.add_log_record_processor(processor)
handler = LoggingHandler(level=logging.DEBUG, logger_provider=provider)
logging.getLogger().addHandler(handler)
configure_logger(OTLP_GRPC_ENDPOINT, resource)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
i = 0
try:
while True:
print(f"Logging {i=}")
logger.info(f"[{i=}] This is a test log message.")
print(f"Done logging {i=}")
i += 1
time.sleep(0.5)
except KeyboardInterrupt:
raise SystemExit(0) When I execute the script with python test.py I only have the first Expected behaviorI expect jaeger to process the log events. If I replace Relevant log outputJaeger All in One log from docker compose
ScreenshotNo response Additional contextNo response Jaeger backend version1.53.0 SDKHere the python dependencies I'm using:
PipelineOTEL SDK -> [OTEL] -> Jaeger All in One Stogage backendMemory Operating systemLinux Deployment modelDocker compose Deployment configsDocker compose: services:
jaeger:
image: jaegertracing/all-in-one@sha256:1147036b9becc1eca6006f1af7eb2f0c2fe039a8d313ce15c6aa52a6a877f9f7 # jaegertracing/all-in-one:1.53.0
restart: on-failure
ports:
- 16686:16686
- 4317:4317
- 4318:4318
environment:
LOG_LEVEL: debug
COLLECTOR_OTLP_ENABLED: "true" |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Jaeger is a tracing backend, it does not collect logs. |
Beta Was this translation helpful? Give feedback.
Jaeger is a tracing backend, it does not collect logs.