Skip to content

Commit

Permalink
Merge pull request #158 from tonybaloney/aspire_tracing_tweaks
Browse files Browse the repository at this point in the history
Aspire tracing tweaks
  • Loading branch information
tonybaloney authored Aug 23, 2024
2 parents e28a451 + 5b1c9c2 commit 076865a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions samples/Aspire/python/otlp_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def configure_oltp_grpc_tracing(
exporter = OTLPLogExporter(endpoint=endpoint)
logger_provider.add_log_record_processor(BatchLogRecordProcessor(exporter))
handler = LoggingHandler(level=logging.NOTSET, logger_provider=logger_provider)
handler.setFormatter(logging.Formatter("Python: %(message)s"))

# Attach OTLP handler to root logger
logging.getLogger().addHandler(handler)
Expand Down
4 changes: 2 additions & 2 deletions samples/Aspire/python/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
tracer = configure_oltp_grpc_tracing()
logger = logging.getLogger(__name__)

Psycopg2Instrumentor().instrument()
Psycopg2Instrumentor().instrument(skip_dep_check=True, enable_commenter=True, commenter_options={})

ado_conn_str = os.getenv("ConnectionStrings__weather")
# Convert the connection string to a dictionary
Expand All @@ -24,7 +24,7 @@

def get_weather_forecast(trace_id: str = None, span_id: str = None) -> List[Dict[str, Any]]:
with tracer.start_as_current_span("generate-forecast", get_span_context(trace_id, span_id)):
logger.info("Generating weather forecast from Python")
logger.info("Generating weather forecast")

# read 6 random records from the pg database
cursor = cnx.cursor()
Expand Down

0 comments on commit 076865a

Please sign in to comment.