datarobot_genai.drmcp.core.telemetry
telemetry
OtelASGIMiddleware
Bases: BaseHTTPMiddleware
ASGI middleware extracts trace_id and parent span id from raw http request and set them in the context, so downsream trace can link to them if avaialble.
Source code in datarobot_genai/drmcp/core/telemetry.py
initialize_telemetry
Initialize OpenTelemetry for the FastMCP application.
Source code in datarobot_genai/drmcp/core/telemetry.py
get_trace_id
Get the current trace ID if available.
Source code in datarobot_genai/drmcp/core/telemetry.py
trace_execution
Trace tool execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trace_name
|
str | None
|
Optional name for the span. If not provided, uses the function name. |
None
|
trace_type
|
str
|
Optional type for the span. If not provided, uses "tool". |
'tool'
|
Example
@trace_execution() async def my_tool(self, param1: str) -> str: return "result"
@trace_execution("custom_name") async def another_tool(self, param1: str) -> str: return "result"
Source code in datarobot_genai/drmcp/core/telemetry.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |