Trace And LoggedΒΆ
A decorator that wraps a function in an OpenTelemetry span and logs its inputs, outputs, and exceptions.
ClassesΒΆ
TraceFilterConfig ΒΆ
Configuration for filtering which operations get traced.
Source code in src/flock/logging/trace_and_logged.py
Methods:ΒΆ
hides ΒΆ
Whether a call on owner is one of Flock's internals left out at this level.
Classes marked __trace_level__ = "all" (and their subclasses) are checked at call time too, since the hooks they inherit were wrapped in their base class.
Source code in src/flock/logging/trace_and_logged.py
should_trace ΒΆ
Check if an operation should be traced based on filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service | str | Service name (e.g., "Flock", "Agent") | required |
operation | str | Full operation name (e.g., "Flock.publish") | required |
Returns:
| Type | Description |
|---|---|
bool | True if should trace, False otherwise |
Source code in src/flock/logging/trace_and_logged.py
Functions:ΒΆ
capped ΒΆ
An input or output attribute within FLOCK_TRACE_MAX_ATTRIBUTE_BYTES.
A longer value becomes JSON that says it was cut and how large it was, with as much of its start as preview as fits in the cap, escaping and marker included; the cut never splits a character.
Source code in src/flock/logging/trace_and_logged.py
run_attributes ΒΆ
A run's correlation as the attributes observability tools group traces by (#681): Langfuse sessions read session.id, Opik threads gen_ai.conversation.id.
Source code in src/flock/logging/trace_and_logged.py
traced_and_logged ΒΆ
A decorator that wraps a function in an OpenTelemetry span.
Creates proper parent-child span relationships and extracts relevant attributes for observability in Grafana/Jaeger.
Automatically extracts: - Agent name and description - Correlation ID and task ID from Context - Class and method names - Exception information
Supports both synchronous and asynchronous functions.
Source code in src/flock/logging/trace_and_logged.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 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 | |