Skip to main content

respan-instrumentation-elasticsearch

Respan instrumentation for the official Elasticsearch Python client. It traces the shared transport boundary, so synchronous and asynchronous clients receive the same coverage for index, get, search, bulk, update, delete, cluster, and other API operations.

Every request emits a canonical Respan task span. Request and response bodies are JSON-serialized into traceloop.entity.input and traceloop.entity.output; transport failures and HTTP error responses record OpenTelemetry error status plus backend-visible status_code and error.message attributes.

Install

pip install respan-ai respan-instrumentation-elasticsearch "elasticsearch[async]>=8.13,<10"

Usage

from elasticsearch import Elasticsearch
from respan import Respan, workflow
from respan_instrumentation_elasticsearch import ElasticsearchInstrumentor

respan = Respan(instrumentations=[ElasticsearchInstrumentor()])
client = Elasticsearch("http://localhost:9200")


@workflow(name="elasticsearch_search_workflow")
def search():
    return client.search(index="articles", query={"match": {"title": "tracing"}})


print(search())
client.close()
respan.shutdown()

AsyncElasticsearch is instrumented automatically as well.

Content capture

Request and response content is captured by default. Disable it when payloads may contain sensitive data:

ElasticsearchInstrumentor(capture_content=False)

With capture disabled, spans retain operation, sanitized target, status, and timing while omitting request and response bodies. Headers are never captured. activate() and deactivate() are idempotent.

See the Respan example projects for an offline, runnable sync/async suite backed by a local mock Elasticsearch HTTP server.

Metadata

Release files for respan-instrumentation-elasticsearch 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for respan-instrumentation-elasticsearch 0.1.1
File Size Uploaded
respan_instrumentation_elasticsearch-0.1.1.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for respan-instrumentation-elasticsearch 0.1.1
File Interpreter ABI Platform
respan_instrumentation_elasticsearch-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / respan_instrumentation_elasticsearch-0.1.1.tar.gz

Download URL respan_instrumentation_elasticsearch-0.1.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
00c0899e8901fc54583eab66be329314857475c5bf70e58405652ebc6c394484
BLAKE2b-256 checksum
How to use checksums
ee093983ddc2716b6dea04ee92a6c4386c0085e929fc1d76dea105d1deade8d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / respan_instrumentation_elasticsearch-0.1.1-py3-none-any.whl

Download URL respan_instrumentation_elasticsearch-0.1.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b8ff63dda6d220bc94144213650a419cdad00eae4eb435a4f04d71e5acb1439
BLAKE2b-256 checksum
How to use checksums
5c1dca85909ff764408659246e42e4ef46691435678516cadf980944069db9e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page