datarobot_genai.dragent.plugins.datarobot_otel_conventions_middleware
datarobot_otel_conventions_middleware
DataRobotOtelConventionsMiddlewareConfig
Bases: FunctionMiddlewareBaseConfig
DataRobot Open Telemetry Conventions: https://docs.datarobot.com/en/docs/agentic-ai/agentic-develop/agentic-tracing-code.html#map-spans-and-attributes-to-the-tracing-table.
Source code in datarobot_genai/dragent/plugins/datarobot_otel_conventions_middleware.py
DataRobotOtelConventionsMiddleware
Bases: FunctionMiddleware
DataRobot Open Telemetry Conventions middleware for DRAgent NAT workflows.
Each invocation is wrapped in a dedicated datarobot_agent SDK span that
carries the Tracing table attributes: the last user message becomes
gen_ai.prompt and the workflow output becomes gen_ai.completion.
NAT builds its own (non-SDK) spans and may not open an OTel parent span, so
we create our own to guarantee the attributes have a recording span to live
on. Tool-call spans are emitted as children. The streaming path is
reimplemented so text deltas can be aggregated across chunks within a single
invocation.
Source code in datarobot_genai/dragent/plugins/datarobot_otel_conventions_middleware.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
datarobot_otel_conventions_middleware
async
datarobot_otel_conventions_middleware(config: DataRobotOtelConventionsMiddlewareConfig, builder: Builder) -> AsyncIterator[DataRobotOtelConventionsMiddleware]
Register DataRobot Open Telemetry Conventions middleware for NAT/DRAgent workflows.