Skip to content

Commit

Permalink
fix tracing (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
cassiebreviu authored Sep 5, 2024
1 parent 1387e1f commit 61e4bbb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/api/evaluate/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def evaluate_row(research_context, product_context, assignment_context):
print("value: ", os.environ["BING_SEARCH_KEY"], len(os.environ["BING_SEARCH_KEY"]))


tracer = init_tracing()
tracer = init_tracing(local_tracing=True)

eval_result = evaluate_orchestrator(model_config, data_path=folder +"/eval_inputs.jsonl")

Expand Down
24 changes: 12 additions & 12 deletions src/api/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ def init_tracing(local_tracing: bool = True):
else:
Tracer.add("OpenTelemetry", trace_span)

azmon_logger = logging.getLogger("azure")
azmon_logger.setLevel(logging.INFO)
azmon_logger = logging.getLogger("azure")
azmon_logger.setLevel(logging.INFO)

# oteltrace.set_tracer_provider(TracerProvider())
# oteltrace.set_tracer_provider(TracerProvider())

# Configure Azure Monitor as the Exporter
app_insights = os.getenv("APPINSIGHTS_CONNECTIONSTRING")
# Configure Azure Monitor as the Exporter
app_insights = os.getenv("APPINSIGHTS_CONNECTIONSTRING")

# Add the Azure exporter to the tracer provider
# Add the Azure exporter to the tracer provider

oteltrace.set_tracer_provider(TracerProvider(sampler=ParentBasedTraceIdRatio(1.0)))
oteltrace.get_tracer_provider().add_span_processor(BatchSpanProcessor(AzureMonitorTraceExporter(connection_string=app_insights)))
# oteltrace.get_tracer_provider().add_span_processor(
# SimpleSpanProcessor(trace_exporter)
# )
oteltrace.set_tracer_provider(TracerProvider(sampler=ParentBasedTraceIdRatio(1.0)))
oteltrace.get_tracer_provider().add_span_processor(BatchSpanProcessor(AzureMonitorTraceExporter(connection_string=app_insights)))
# oteltrace.get_tracer_provider().add_span_processor(
# SimpleSpanProcessor(trace_exporter)
# )

return oteltrace.get_tracer(_tracer)
return oteltrace.get_tracer(_tracer)

0 comments on commit 61e4bbb

Please sign in to comment.