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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file respan_instrumentation_elasticsearch-0.1.0.tar.gz.
File metadata
- Download URL: respan_instrumentation_elasticsearch-0.1.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.3.2 CPython/3.13.12 Linux/6.17.0-35-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0720e6aff6ea9283fce53f2f08582a3b9300723d9a24da3486da5e524a9f966c
|
|
| MD5 |
d4449a390309c964d812df46b0ba93c0
|
|
| BLAKE2b-256 |
bb45e2c707a9893559b1ec8ed06cd3c30a2a42239188be62c0f000e548b71acf
|
File details
Details for the file respan_instrumentation_elasticsearch-0.1.0-py3-none-any.whl.
File metadata
- Download URL: respan_instrumentation_elasticsearch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.3.2 CPython/3.13.12 Linux/6.17.0-35-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1334243198477e76928b5da74579035fae8ff01b2879f69a3739a20ec056add4
|
|
| MD5 |
3e4d10979aa3c388ecb46958939cdeb0
|
|
| BLAKE2b-256 |
2f35f503f2ebbb838b869814c68552e446d65f33ebbb10838621090e7ed3d038
|