Imporve monitoring 4
This commit is contained in:
@@ -65,11 +65,27 @@ def setup_otel_logging(
|
||||
return None
|
||||
|
||||
# Get OTLP endpoint from environment or parameter
|
||||
# For logs, we need to use the HTTP endpoint (port 4318), not the gRPC endpoint (port 4317)
|
||||
if otel_endpoint is None:
|
||||
# Try logs-specific endpoint first, then fall back to general OTLP endpoint
|
||||
otel_endpoint = os.getenv(
|
||||
"OTEL_EXPORTER_OTLP_ENDPOINT",
|
||||
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT",
|
||||
os.getenv("OTEL_COLLECTOR_ENDPOINT", "http://signoz-otel-collector.bakery-ia:4318")
|
||||
)
|
||||
|
||||
logger.info(f"Original OTLP endpoint for logs: {otel_endpoint}")
|
||||
|
||||
# If we got the tracing endpoint (4317), switch to logs endpoint (4318)
|
||||
if otel_endpoint.endswith(":4317"):
|
||||
logger.info("Converting tracing endpoint (4317) to logs endpoint (4318)")
|
||||
otel_endpoint = otel_endpoint.replace(":4317", ":4318")
|
||||
|
||||
logger.info(f"Final OTLP endpoint for logs: {otel_endpoint}")
|
||||
|
||||
# Ensure endpoint has proper protocol prefix
|
||||
if not otel_endpoint.startswith(("http://", "https://")):
|
||||
# Default to HTTP for insecure connections
|
||||
otel_endpoint = f"http://{otel_endpoint}"
|
||||
|
||||
# Ensure endpoint has /v1/logs path for HTTP
|
||||
if not otel_endpoint.endswith("/v1/logs"):
|
||||
|
||||
Reference in New Issue
Block a user