Skip to content

Commit f3996f7

Browse files
committed
address copilot feedback
1 parent a21cadb commit f3996f7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

servers/opentelemetry_middleware.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@
1818

1919

2020
def configure_aspire_dashboard(service_name: str = "expenses-mcp"):
21-
"""Configure OpenTelemetry to send telemetry to the Aspire standalone dashboard."""
22-
otlp_endpoint = os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4317")
21+
"""Configure OpenTelemetry to send telemetry to the Aspire standalone dashboard.
22+
23+
Requires the OTEL_EXPORTER_OTLP_ENDPOINT environment variable to be set.
24+
"""
25+
otlp_endpoint = os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT")
26+
if not otlp_endpoint:
27+
raise ValueError(
28+
"OTEL_EXPORTER_OTLP_ENDPOINT environment variable must be set to configure telemetry export."
29+
)
2330

2431
# Create resource with service name
2532
resource = Resource.create({"service.name": service_name})

0 commit comments

Comments
 (0)