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
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 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
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.