Skip to content

Render rerank observability (0060b)#207

Merged
chris-colinsky merged 2 commits into
mainfrom
feature/0060b-rerank-observability
Jul 2, 2026
Merged

Render rerank observability (0060b)#207
chris-colinsky merged 2 commits into
mainfrom
feature/0060b-rerank-observability

Conversation

@chris-colinsky

Copy link
Copy Markdown
Member

Completes the rerank capability (proposal 0060) with the observability half, the second of the two-PR split (0060a shipped the capability + events + reference reranker in #205). The bundled observers no longer safe-skip the typed rerank events.

What's here

  • OTel _handle_rerank -> the openarmature.rerank.complete span (observability section 5.5.13): the GenAI semconv subset + openarmature.rerank.{query_length, document_count, top_k, result_count} (top_k omitted when None), conditional gen_ai.usage.input_tokens and openarmature.rerank.search_units (per proposal 0093), and payload-gated query/documents/results (the scored results from RerankEvent.output_results per 0089). Parented lineage-aware, back-dated by latency_ms, not gated by disable_llm_spans.
  • Langfuse _handle_rerank -> a dedicated Retriever observation (section 8.4.7, asType="retriever"): model + usageDetails.{input, searchUnits} + openarmature_* metadata + payload-gated input/output; ERROR-level on RerankFailedEvent with error_category as the status message and no output.
  • New retriever() on the LangfuseClient Protocol + InMemoryLangfuseClient + the SDK adapter (as_type="retriever" / native LangfuseRetriever), and a search_units field on LangfuseUsage for the searchUnits usageDetails convention.
  • Conformance: un-defer fixtures 099-108 / 138 / 141 / 142; 109 (metrics) stays deferred under proposal 0067.
  • conformance.toml: 0060 and 0089 move to implemented.

Validation

  • tests/conformance/test_observability.py: 92 passed (the 13-fixture rerank family; 109 the only rerank skip)
  • Full suite: 1582 passed, 487 skipped; manifest 93/93; ruff + pyright clean
  • Reviewed via /review (six angles + live-SDK checks): no correctness defects. Follow-up cleanup (harness DRY, coverage tightening, src-side observer/adapter de-duplication) tracked separately.

Render the typed rerank events in both bundled observers, replacing the
safe-skip guards: the OTel openarmature.rerank.complete span
(observability §5.5.13) and the Langfuse Retriever observation (§8.4.7,
a new retriever() client/adapter surface + the searchUnits usageDetails
convention on LangfuseUsage). Usage figures emit conditionally per
proposal 0093; the span renders the scored results
(RerankEvent.output_results per 0089) and is not gated by
disable_llm_spans.

Un-defer conformance fixtures 099-108 / 138 / 141 / 142 (109 metrics
rides 0067). conformance.toml 0060 and 0089 move to implemented,
completing the rerank capability and the 0089 output-rendering surface.
Copilot AI review requested due to automatic review settings July 2, 2026 20:03
Comment thread src/openarmature/observability/langfuse/client.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Completes proposal 0060 “rerank” observability by wiring typed rerank events into the bundled OTel and Langfuse observers, updating conformance to un-defer rerank observability fixtures, and marking proposals 0060/0089 as implemented.

Changes:

  • Add OTel openarmature.rerank.complete span emission from RerankEvent / RerankFailedEvent (with payload + GenAI-semconv gating).
  • Add Langfuse “Retriever” observation emission (asType "retriever") plus searchUnits usageDetails support.
  • Update conformance harness + proposal status/notes to reflect implemented rerank observability fixtures.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/conformance/test_observability.py Un-defer rerank observability fixtures; add rerank fixture harness and usageDetails assertions.
src/openarmature/observability/otel/observer.py Render rerank spans from typed rerank events.
src/openarmature/observability/langfuse/observer.py Render Langfuse Retriever observations from typed rerank events.
src/openarmature/observability/langfuse/client.py Extend Langfuse client protocol/in-memory client with retriever observation + search_units usage field.
src/openarmature/observability/langfuse/adapter.py Map retriever observation to Langfuse SDK (as_type="retriever") and searchUnits usage_details.
conformance.toml Mark proposals 0060/0089 implemented and update proposal notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/openarmature/observability/otel/observer.py
Comment thread src/openarmature/observability/langfuse/observer.py
Comment thread conformance.toml Outdated
The 0060 conformance note said Langfuse usageDetails is an empty map
when usage is null, but the observer omits usageDetails entirely
(usage=None, so the adapter adds no usage_details), which fixture 142
asserts. Correct the note to 'omitted when usage = null'.
@chris-colinsky chris-colinsky merged commit 3347cb3 into main Jul 2, 2026
6 checks passed
@chris-colinsky chris-colinsky deleted the feature/0060b-rerank-observability branch July 2, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants