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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respan_instrumentation_elasticsearch-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file respan_instrumentation_elasticsearch-0.1.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_elasticsearch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0720e6aff6ea9283fce53f2f08582a3b9300723d9a24da3486da5e524a9f966c
MD5 d4449a390309c964d812df46b0ba93c0
BLAKE2b-256 bb45e2c707a9893559b1ec8ed06cd3c30a2a42239188be62c0f000e548b71acf

See more details on using hashes here.

File details

Details for the file respan_instrumentation_elasticsearch-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_elasticsearch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1334243198477e76928b5da74579035fae8ff01b2879f69a3739a20ec056add4
MD5 3e4d10979aa3c388ecb46958939cdeb0
BLAKE2b-256 2f35f503f2ebbb838b869814c68552e446d65f33ebbb10838621090e7ed3d038

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page