Repository navigation
feat: add the redisvl[otel] observability foundation (FDE-86) - #755
Open
vishal-bala wants to merge 2 commits into
Open
vishal-bala wants to merge 2 commits into
vishal-bala wants to merge 2 commits into
Conversation
Adds the plumbing RedisVL's OpenTelemetry instrumentation builds on. It emits no telemetry of its own. - An `otel` extra that depends on opentelemetry-api only; the application owns the SDK and exporters. The floor, 1.30.0, is the first API release that accepts histogram bucket advice. - redisvl.utils.otel returns a tracer and meter from the global providers under the `redisvl` scope, RedisVL's version and the semantic-conventions 1.44.0 schema URL. With no SDK configured they are the API's own no-ops: about 2 us for one span and two histogram records on an Apple M4 Pro. When the API is not installed, or REDISVL_OTEL_DISABLED is "true", stand-ins with the same interface are returned, so call sites never branch. The metric and attribute names the instrumentation will use are defined there in one place. - The SDK the tests need sits in a non-default `otel-test` group, so a plain `uv sync` stays free of OpenTelemetry. A shared `otel_sdk` fixture configures in-memory exporters and resets the set-once global providers afterwards. - A CI leg runs the default suite without OpenTelemetry, installing every extra except mistralai and mcp, which pull it in.
vishal-bala
added this pull request to stack #756
October 13, 2026 16:21
vishal-bala
marked this pull request as ready for review
October 14, 2026 08:09
…otel/02-FDE-86-foundation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
SemanticCacheis gaining OpenTelemetry metrics and spans, so that applications can see hit rates, match distances against the threshold, and where a lookup spends its time. This change adds the plumbing that instrumentation builds on, following OpenTelemetry's guidance for libraries: depend on the API only, leave the SDK and exporters to the application, and cost next to nothing when no SDK is configured. It emits no telemetry itself.Changes
The
redisvl[otel]extra andredisvl.utils.otelThe
otelextra depends onopentelemetry-api>=1.30.0, the first release that accepts the histogram bucket advice the cache metrics will set. The internalredisvl.utils.otelmodule returns a tracer and a meter from the global providers, under theredisvlinstrumentation scope with RedisVL's version and the semantic-conventions 1.44.0 schema URL. With no SDK configured they are the API's own no-ops, at about 2 µs for one span and two histogram records on an Apple M4 Pro.When the API is not installed, or
REDISVL_OTEL_DISABLEDistrue, the module returns stand-ins with the same interface, so instrumented code never branches. The metric and attribute names the instrumentation will use are defined in the same module. RedisVL never constructs a provider and never initialises redis-py's own observability; both belong to the application.Tests and CI
The SDK the tests need sits in a non-default
otel-testdependency group, so a plainuv syncstays free of OpenTelemetry and the existing import check keeps running without optional dependencies. A sharedotel_sdkfixture configures in-memory exporters and resets the set-once global providers on teardown. Three tests cover the instrumentation scope with an SDK, the off switch with an SDK configured, and the path with no SDK in a fresh interpreter: the global providers stay the API's proxies, redis-py's observability is not initialised, and the per-call cost is bounded.A new CI leg runs the default suite without OpenTelemetry. Every other leg has it, because mistralai brings in the SDK and fastmcp the API, so the leg installs every extra except those two and skips the MCP tests, which need fastmcp.
Minor
make installand the test matrix sync theotel-testgroup.Notes
This PR sits in a stack on top of the KNN lookup change. On its own it adds an extra that emits nothing, so it should merge together with the instrumentation above it rather than alone.
Next Steps
SemanticCacheoperation-duration and match-distance histograms.Note
Low Risk
Adds an optional extra and internal helpers with no-op defaults; no production instrumentation or runtime behavior change until follow-up PRs wire it in.
Overview
Adds optional OpenTelemetry support via
redisvl[otel](opentelemetry-api>=1.30.0, also inall) and internalredisvl.utils.otel, which exposes cachedget_tracer()/get_meter()under theredisvlscope, shared metric/attribute name constants,REDISVL_OTEL_DISABLED, and no-op stand-ins when the API is missing or disabled so callers never branch. The library does not install an SDK or touch redis-py observability.otel-testis a non-default uv group withopentelemetry-sdkfor tests;make installand the main CI matrix sync--group otel-test. A new Tests without OpenTelemetry job installs extras without mistralai/mcp (which pull OTEL transitively), assertsopentelemetryis not importable, and runs the suite with MCP tests ignored.Adds an
otel_sdkpytest fixture (in-memory exporters + provider reset) and unit tests for scope, the off switch, and API-only no-SDK behavior with a microsecond overhead bound.Reviewed by Cursor Bugbot for commit 5d9a2d5. Bugbot is set up for automated code reviews on this repo. Configure here.