Open dpridan opened 6 months ago
I'm getting the same error
I try it:
I imported the first line
import autodynatrace
import time
import logging
import sys
from autodynatrace.sdk import sdk as oneagent_sdk
class DynatraceAdapter(logging.LoggerAdapter):
"""Logging Adapter to add trace_id and span_id to log messages"""
def process(self, msg, kwargs):
"""Enrich logs with dynatrace trace information"""
ctx = oneagent_sdk.tracecontext_get_current()
msg_out = f" {msg} [!dt dt.trace_id={ctx.trace_id},dt.span_id={ctx.span_id}] "
return msg_out, kwargs
def get_logger(name, severity=logging.INFO):
"""Creates a custom logger"""
formatter = logging.Formatter(
"%(asctime)sZ - %(name)s - %(levelname)s - %(message)s"
)
formatter.converter = time.gmtime
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(severity)
handler.setFormatter(formatter)
log = logging.getLogger(name)
log.setLevel(severity)
log.addHandler(handler)
return DynatraceAdapter(log, {})
Hey, I want to monitor the liveness calls from my FastAPI app but I get errors in the trace about No response although my service is up with the error: Some data could not be collected or transmitted. This is most likely due to a resource congestion on network, host or process level in your monitored environment (Diagnostic codes: C1, A5)
Thanks in advance for your help.