# Python tracing libraries

Python tracing libraries record spans that show how a request moves through an application and the services it calls. An SDK creates each span with timing and context before an exporter sends it to a backend such as an OpenTelemetry collector. These libraries let developers find slow calls and failures in web services and AI agent runs.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [opentelemetry-sdk](#opentelemetry-sdk) | 342.4M | 2.7K | Oct 2026 | Apache-2.0 |
| [Sentry SDK](#sentry-sdk) | 157.0M | 2.2K | Nov 2026 | MIT |
| [LangSmith](#langsmith) | 94.9M | 1.1K | Nov 2026 | MIT |
| [ddtrace](#ddtrace) | 48.7M | 655 | Nov 2026 | BSD-3-Clause |
| [Langfuse](#langfuse) | 31.7M | 516 | Nov 2026 | MIT |
| [Logfire](#logfire) | 19.0M | 4.6K | Nov 2026 | MIT |
| [MLflow Tracing](#mlflow-tracing) | 17.5M | 28.9K | Nov 2026 | Apache-2.0 |
| [AWS X-Ray SDK](#aws-xray-sdk) | 17.1M | 340 | Oct 2026 | Apache-2.0 |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[opentelemetry-sdk](#opentelemetry-sdk) has the most monthly downloads in this comparison, at 342.4M.

## Capabilities

| Library | OpenTelemetry API integration | OTLP trace export |
| --- | --- | --- |
| [opentelemetry-sdk](#opentelemetry-sdk) | Yes | Via plugin |
| [Sentry SDK](#sentry-sdk) | Via plugin | Via plugin |
| [LangSmith](#langsmith) | Via plugin | Via plugin |
| [ddtrace](#ddtrace) | Yes | No |
| [Langfuse](#langfuse) | Yes | Yes |
| [Logfire](#logfire) | Yes | Yes |
| [MLflow Tracing](#mlflow-tracing) | Yes | Via plugin |
| [AWS X-Ray SDK](#aws-xray-sdk) | Undocumented | Undocumented |

## Libraries

### opentelemetry-sdk

[GitHub](https://github.com/open-telemetry/opentelemetry-python) · [PyPI](https://pypi.org/project/opentelemetry-sdk) · [Docs](https://pypi.org/project/opentelemetry-sdk/)

Creates spans and exports Python application telemetry through configurable processors and exporters.

- Downloads / mo: 342.4M
- Stars: 2.7K
- Last release: 1.45.2
- License: Apache-2.0
- Capabilities: [From the opentelemetry-sdk docs](https://pypi.org/project/opentelemetry-sdk/)

**Strengths**

- **Configurable span processing.** Choose the span processor and exporter for the tracing pipeline.
- **Exports through standard OTLP.** Send traces to an OTLP-compatible collector or backend.

**Watch out for**

- **Auto instrumentation needs extra packages.** Install a distro and the instrumentors for the frameworks the application uses.
- **OTLP exporters install separately.** Add the HTTP or gRPC exporter package before configuring its endpoint.

```sh
pip install opentelemetry-sdk
```

**mlflow/mlflow** (28.9K stars)

[mlflow/mlflow](https://github.com/mlflow/mlflow) 

```python
def _initialize_tracer_provider(disabled=False):
    """
    Instantiate a tracer provider and set it as the global tracer provider.

    Note that this function ALWAYS updates the global tracer provider, regardless of the current
    state. It is the caller's responsibility to ensure that the tracer provider is initialized
    only once, and update the _INITIALIZED flag accordingly.
    """
    processors = _get_span_processors(disabled=disabled)
    if not processors:
        provider.set(trace.NoOpTracerProvider())
        return

    # Demote the "Failed to detach context" log raised by the OpenTelemetry logger to DEBUG
    # level so that it does not show up in the user's console. This warning may indicate
    # some incorrect context handling, but in many cases just false positive that does not
    # cause any issue in the generated trace.
    # Note that we need to apply it permanently rather than just the scope of prediction call,
    # because the exception can happen for streaming case, where the error log might be
    # generated when the iterator is consumed and we don't know when it will happen.
    suppress_warning("opentelemetry.context", "Failed to detach context")

    # These Otel warnings are occasionally raised in a valid case, e.g. we timeout a trace
    # but some spans are still active. We suppress them because they are not actionable.
    suppress_warning("opentelemetry.sdk.trace", "Setting attribute on ended span")
    suppress_warning("opentelemetry.sdk.trace", "Calling end() on an ended span")

    # When using the global tracer provider mode (MLFLOW_USE_DEFAULT_TRACER_PROVIDER=false),
    # check if a TracerProvider is already set (e.g., set with `set_tracer_provider` API for
    # Uvicorn, FastAPI, etc.). If so, add MLflow's span processors to the existing provider
    # instead of replacing it. This enables unified tracing where both external and MLflow spans
    # are captured in the same trace.
    if not MLFLOW_USE_DEFAULT_TRACER_PROVIDER.get():
        existing_provider = trace.get_tracer_provider()
        if isinstance(existing_provider, TracerProvider):
            _logger.debug(
                "An existing TracerProvider is detected. Adding MLflow's span processors "
                "to the existing provider for unified tracing."
            )
            try:
                existing_processors = set(existing_provider._active_span_processor._span_processors)
                for processor in processors:
                    if not any(isinstance(p, type(processor)) for p in existing_processors):
                        existing_provider.add_span_processor(processor)
                return
            except Exception as e:
                _logger.debug(
                    f"An error occurred while adding span processors to the existing provider: {e}."
                    " Overriding the existing provider with MLflow trace provider.",
                    exc_info=True,
                )

    # NB: If otel resource env vars are set explicitly, don't create an empty resource
    # so that they are propagated to otel spans.
    otel_service_name = os.environ.get("OTEL_SERVICE_NAME")
    otel_resource_attributes = os.environ.get("OTEL_RESOURCE_ATTRIBUTES")
    resource = None
    sdk_attributes = {
        "telemetry.sdk.language": "python",
        "telemetry.sdk.name": "mlflow",
        "telemetry.sdk.version": mlflow.__version__,
    }
    if not otel_service_name and not otel_resource_attributes:
        # Setting an empty resource to avoid triggering resource aggregation, which causes
        # an issue in LiteLLM tracing: https://github.com/mlflow/mlflow/issues/16296
        # Add telemetry resource: https://opentelemetry.io/docs/specs/semconv/resource/#telemetry-sdk
        resource = Resource(sdk_attributes)
    else:
        # Update the env var to let otel initialize the resource with MLflow's SDK attributes
        attributes = {**_parse_otel_resource_attributes(otel_resource_attributes), **sdk_attributes}
        os.environ["OTEL_RESOURCE_ATTRIBUTES"] = ",".join([
            f"{k}={v}" for k, v in attributes.items()
        ])

    if MLFLOW_TRACE_USE_ISOLATED_RANDOM_ID_GENERATOR.get():
        tracer_provider = TracerProvider(
            resource=resource,
            sampler=_get_trace_sampler(),
            id_generator=_IsolatedRandomIdGenerator(),
        )
    else:
        tracer_provider = TracerProvider(
            resource=resource,
            sampler=_get_trace_sampler(),
        )
    for processor in processors:
        tracer_provider.add_span_processor(processor)

    provider.set(tracer_provider)
```

[mlflow/tracing/provider.py](https://github.com/mlflow/mlflow/blob/6976fb3d588ac525e00e59dda7e1aaaa384089f1/mlflow/tracing/provider.py#L707-L795) · [More projects using opentelemetry-sdk →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20opentelemetry-sdk%20to%20configure%20span%20processors%2C%20propagate%20active%20trace%20context%20and%20tag%20application%20operations&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor, ConsoleSpanExporter
provider = TracerProvider()
provider.add_span_processor(SimpleSpanProcessor(ConsoleSpanExporter()))
tracer = provider.get_tracer(__name__)
with tracer.start_as_current_span('example'):
    pass

```

From [instrumentation.md](https://opentelemetry.io/docs/languages/python/instrumentation/)

### Sentry SDK

[GitHub](https://github.com/getsentry/sentry-python) · [PyPI](https://pypi.org/project/sentry-sdk) · [Docs](https://docs.sentry.io/platforms/python/)

Captures application errors and tracing spans with Python framework integrations.

- Downloads / mo: 157.0M
- Stars: 2.2K
- Last release: 2.75.0
- License: MIT
- Capabilities: [From the Sentry SDK docs](https://docs.sentry.io/platforms/python/)

**Strengths**

- **Instruments supported frameworks automatically.** Supported HTTP and database operations become spans through enabled integrations.
- **Adds custom nested spans.** Wrap application operations in spans inside an active transaction.

**Watch out for**

- **Custom spans need a transaction.** Create a transaction when the framework integration does not create one.
- **Tracing needs sampling configuration.** Set traces_sample_rate for the share of traces sent to Sentry.

```sh
pip install sentry-sdk
```

**home-assistant/core** (92.3K stars)

[home-assistant/core](https://github.com/home-assistant/core) 

```python
def _init_sdk():
    """Initialize the Sentry SDK."""
    sentry_sdk.init(
        dsn=entry.data[CONF_DSN],
        environment=entry.options.get(CONF_ENVIRONMENT),
        integrations=[
            sentry_logging,
            AioHttpIntegration(),
            SqlalchemyIntegration(),
        ],
        release=current_version,
        before_send=lambda event, hint: process_before_send(
            hass,
            entry.options,
            channel,
            huuid,
            system_info,
            custom_components,
            event,
            hint,
        ),
        **tracing,
    )
```

[homeassistant/components/sentry/__init__.py](https://github.com/home-assistant/core/blob/d0ccc62cfc198f25db6ec5c6b228337e3207d047/homeassistant/components/sentry/__init__.py#L81-L103) · [More projects using Sentry SDK →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20sentry-sdk%20to%20configure%20span%20processors%2C%20propagate%20active%20trace%20context%20and%20tag%20application%20operations&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import os
import sentry_sdk
sentry_sdk.init(dsn=os.environ['SENTRY_DSN'], traces_sample_rate=1.0)
with sentry_sdk.start_transaction(op='task', name='example'):
    pass
sentry_sdk.flush()

```

From [custom-instrumentation.md](https://docs.sentry.io/platforms/python/tracing/instrumentation/custom-instrumentation/)

### LangSmith

[GitHub](https://github.com/langchain-ai/langsmith-sdk) · [PyPI](https://pypi.org/project/langsmith) · [Docs](https://pypi.org/project/langsmith/)

Connects to the LangSmith observability and evaluation platform.

- Downloads / mo: 94.9M
- Stars: 1.1K
- Last release: 0.15.0
- License: MIT
- Capabilities: [From the LangSmith docs](https://pypi.org/project/langsmith/)

```sh
pip install langsmith
```

**langchain-ai/langchain** (149.9K stars)

[langchain-ai/langchain](https://github.com/langchain-ai/langchain) 

```python
def _persist_run_single(self, run: Run) -> None:
    """Persist a run."""
    if run.extra.get("__disabled"):
        return
    try:
        run.extra["runtime"] = get_runtime_environment()
        run.tags = self._get_tags(run)
        _patch_missing_metadata(self, run)
        if run.ls_client is not self.client:
            run.ls_client = self.client
        run.post()
    except Exception as e:
        # Errors are swallowed by the thread executor so we need to log them here
        log_error_once("post", e)
        raise
```

[libs/core/langchain_core/tracers/langchain.py](https://github.com/langchain-ai/langchain/blob/ced9bdb1a8899516b6c541fc0e19ab5f349aa0ea/libs/core/langchain_core/tracers/langchain.py#L356-L370) · [More projects using LangSmith →](https://dashboard.exa.ai/playground/search?q=langsmith%20GitHub%20projects)

**Quickstart**

```python
from langsmith import traceable

@traceable
def example(text: str) -> str:
    return text.upper()

example('hello')

```

From [README.md](https://docs.langchain.com/langsmith/annotate-code)

### ddtrace

[GitHub](https://github.com/DataDog/dd-trace-py) · [PyPI](https://pypi.org/project/ddtrace) · [Docs](https://ddtrace.readthedocs.io/en/stable/)

Adds manual and automatic tracing to Python applications for Datadog.

- Downloads / mo: 48.7M
- Stars: 655
- Last release: 4.17.0
- License: BSD-3-Clause
- Capabilities: [From the ddtrace docs](https://ddtrace.readthedocs.io/en/stable/)

**Strengths**

- **Wraps selected code blocks.** Use the tracer context manager around an operation that needs a span.
- **Propagates context across async tasks.** New tasks inherit the active trace context by default.

**Watch out for**

- **Spans belong to their execution.** Pass and activate the context when continuing a trace across execution boundaries.
- **Automatic tracing must start early.** Import ddtrace.auto before application imports when using that initialization route.

```sh
pip install ddtrace
```

**Quickstart**

```python
from ddtrace.trace import tracer
with tracer.trace('example'):
    pass
tracer.shutdown()

```

From [advanced_usage.html](https://ddtrace.readthedocs.io/en/stable/api.html) · [Find projects using ddtrace →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20ddtrace%20to%20configure%20span%20processors%2C%20propagate%20active%20trace%20context%20and%20tag%20application%20operations&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### Langfuse

[GitHub](https://github.com/langfuse/langfuse-python) · [PyPI](https://pypi.org/project/langfuse) · [Docs](https://langfuse.com/docs/observability/sdk/overview)

Traces LLM applications, with datasets, experiments, evaluation, and prompt management.

- Downloads / mo: 31.7M
- Stars: 516
- Last release: 5.2.0
- License: MIT
- Capabilities: [From the Langfuse docs](https://langfuse.com/docs/observability/sdk/overview)

```sh
pip install langfuse
```

**deepset-ai/haystack-core-integrations** (212 stars)

[deepset-ai/haystack-core-integrations](https://github.com/deepset-ai/haystack-core-integrations) 

```python
def create_span(self, context: SpanContext) -> LangfuseSpan:
    """Create a Langfuse span based on the given context."""
    if self.tracer is None:
        message = (
            "Tracer is not initialized. "
            "Make sure the environment variable HAYSTACK_CONTENT_TRACING_ENABLED is set to true before "
            "importing Haystack."
        )
        raise RuntimeError(message)

    # Get external tracing context for root trace creation (correlation metadata)
    tracing_ctx = tracing_context_var.get({})
    if not context.parent_span:
        root_span_type: Literal["agent", "span"] = (
            "agent" if context.operation_name == "haystack.agent.run" else "span"
        )
        trace_context: TraceContext | None = cast(
            TraceContext, {"trace_id": tracing_ctx.get("trace_id")} if tracing_ctx.get("trace_id") else None
        )

        span_context_manager = self.tracer.start_as_current_observation(
            trace_context=trace_context,
            name=context.trace_name,
            version=tracing_ctx.get("version"),
            as_type=root_span_type,
        )
        span = LangfuseSpan(span_context_manager)

        if context.public:
            span.raw_span().set_trace_as_public()

        return span

    span_type = None
    name = context.name

    # Agent spans carry no component tags, so they're matched by operation name
    if context.operation_name == _AGENT_STEP_OPERATION:
        span_type = "chain"
        name = f"agent step {context.tags.get(_AGENT_STEP_KEY)}"
    elif context.operation_name == _AGENT_STEP_LLM_OPERATION:
        span_type = "generation"
        name = "llm"
    elif context.operation_name == _AGENT_STEP_TOOL_OPERATION:
        span_type = "tool"
        tool_name = context.tags.get(_TOOL_NAME_KEY)
        name = f"tool - {tool_name}" if tool_name else "tool"
    elif context.operation_name == "haystack.agent.run":
        span_type = "agent"
    elif context.component_type and context.component_type.endswith("Retriever"):
        span_type = "retriever"
    elif context.component_type and context.component_type.endswith("Embedder"):
        span_type = "embedding"
    elif context.component_type and context.component_type.endswith("Generator"):
        span_type = "generation"

    if span_type:
        return LangfuseSpan(
            self.tracer.start_as_current_observation(name=name, as_type=cast(ObservationSpanType, span_type))
        )
    else:
        return LangfuseSpan(self.tracer.start_as_current_observation(name=name))
```

[integrations/langfuse/src/haystack_integrations/tracing/langfuse/tracer.py](https://github.com/deepset-ai/haystack-core-integrations/blob/9d2a68d636551a2eddd30304a86e624b8189de27/integrations/langfuse/src/haystack_integrations/tracing/langfuse/tracer.py#L425-L486) · [More projects using Langfuse →](https://dashboard.exa.ai/playground/search?q=langfuse%20GitHub%20projects)

**Quickstart**

```python
from langfuse import get_client
langfuse = get_client()
with langfuse.start_as_current_observation(as_type='span', name='example'):
    pass
langfuse.flush()

```

From [README.md](https://langfuse.com/docs/observability/sdk/instrumentation)

### Logfire

[GitHub](https://github.com/pydantic/logfire) · [PyPI](https://pypi.org/project/logfire) · [Docs](https://pydantic.dev/docs/logfire/)

Creates structured logs and spans using OpenTelemetry and configurable telemetry backends.

- Downloads / mo: 19.0M
- Stars: 4.6K
- Last release: 5.6.0
- License: MIT
- Capabilities: [From the Logfire docs](https://pydantic.dev/docs/logfire/)

**Strengths**

- **Exports to alternative backends.** Configure an OTLP endpoint for a compatible telemetry backend.
- **Traces selected modules automatically.** Install auto tracing before importing the application modules to trace.

**Watch out for**

- **Cloud delivery starts enabled.** Set send_to_logfire=False when sending only to another backend.
- **Auto tracing precedes module imports.** Install auto tracing before importing the modules it should instrument.

```sh
pip install logfire
```

**pydantic/pydantic-ai** (21.3K stars)

[pydantic/pydantic-ai](https://github.com/pydantic/pydantic-ai) 

```python
async def main():
    async with AsyncClient() as client:
        logfire.instrument_httpx(client, capture_all=True)
        deps = Deps(client=client)
        result = await weather_agent.run(
            'What is the weather like in London and in Wiltshire?', deps=deps
        )
        print('Response:', result.output)
```

[examples/pydantic_ai_examples/weather_agent.py](https://github.com/pydantic/pydantic-ai/blob/657a0664b3aaf62b337d18aa6f9055b02a1708dc/examples/pydantic_ai_examples/weather_agent.py#L96-L103) · [More projects using Logfire →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20logfire%20to%20configure%20span%20processors%2C%20propagate%20active%20trace%20context%20and%20tag%20application%20operations&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import logfire
logfire.configure(send_to_logfire=False)
with logfire.span('example'):
    pass

```

From [logfire.md](https://logfire.pydantic.dev/docs/reference/api/logfire/)

### MLflow Tracing

[GitHub](https://github.com/mlflow/mlflow) · [PyPI](https://pypi.org/project/mlflow-tracing) · [Docs](https://pypi.org/project/mlflow-tracing/)

Instruments code for MLflow tracing with a minimal set of dependencies.

- Downloads / mo: 17.5M
- Stars: 28.9K
- Last release: 3.18.0
- License: Apache-2.0
- Capabilities: [From the MLflow Tracing docs](https://pypi.org/project/mlflow-tracing/)

```sh
pip install mlflow-tracing opentelemetry-exporter-otlp
```

**guardrails-ai/guardrails** (7.6K stars)

[guardrails-ai/guardrails](https://github.com/guardrails-ai/guardrails) 

```python
def _instrument_runner_step(self, runner_step: Callable[..., Iteration]):
    @wraps(runner_step)
    def trace_step_wrapper(*args, **kwargs) -> Iteration:
        with mlflow.start_span(
            name="guardrails/guard/step",
            span_type="step",
            attributes={
                "guardrails.version": GUARDRAILS_VERSION,
                "type": "guardrails/guard/step",
            },
        ) as step_span:
            try:
                response = runner_step(*args, **kwargs)
                add_step_attributes(step_span, response, *args, **kwargs)  # type: ignore
                return response
            except Exception as e:
                step_span.set_status(status=SpanStatusCode.ERROR)
                add_step_attributes(step_span, None, *args, **kwargs)  # type: ignore
                raise e

    return trace_step_wrapper
```

[guardrails/integrations/databricks/ml_flow_instrumentor.py](https://github.com/guardrails-ai/guardrails/blob/06d0ff2c5f9bcb493d976b76f885e37e41ce845d/guardrails/integrations/databricks/ml_flow_instrumentor.py#L206-L226) · [More projects using MLflow Tracing →](https://dashboard.exa.ai/playground/search?q=mlflow-tracing%20GitHub%20projects)

**Quickstart**

```python
import os
os.environ['OTEL_EXPORTER_OTLP_TRACES_ENDPOINT'] = 'http://localhost:4318/v1/traces'
os.environ['OTEL_EXPORTER_OTLP_TRACES_PROTOCOL'] = 'http/protobuf'
import mlflow
with mlflow.start_span(name='example'):
    pass

```

From [README.md](https://mlflow.org/docs/latest/genai/tracing/opentelemetry/export/)

### AWS X-Ray SDK

[GitHub](https://github.com/aws/aws-xray-sdk-python) · [PyPI](https://pypi.org/project/aws-xray-sdk) · [Docs](https://pypi.org/project/aws-xray-sdk/)

Records application data and sends it to AWS X-Ray.

- Downloads / mo: 17.1M
- Stars: 340
- Last release: 2.16.0
- License: Apache-2.0
- Capabilities: [From the AWS X-Ray SDK docs](https://pypi.org/project/aws-xray-sdk/)

```sh
pip install aws-xray-sdk
```

**aws-powertools/powertools-lambda-python** (3.3K stars)

[aws-powertools/powertools-lambda-python](https://github.com/aws-powertools/powertools-lambda-python) 

```python
@functools.wraps(lambda_handler)
def decorate(event, context, **kwargs):
    with self.provider.in_subsegment(name=f"## {lambda_handler_name}") as subsegment:
        try:
            logger.debug("Calling lambda handler")
            response = lambda_handler(event, context, **kwargs)
            logger.debug("Received lambda handler response successfully")
            self._add_response_as_metadata(
                method_name=lambda_handler_name,
                data=response,
                subsegment=subsegment,
                capture_response=capture_response,
            )
        except Exception as err:
            logger.exception(f"Exception received from {lambda_handler_name}")
            self._add_full_exception_as_metadata(
                method_name=lambda_handler_name,
                error=err,
                subsegment=subsegment,
                capture_error=capture_error,
            )

            raise
        finally:
            cold_start = _is_cold_start()
            logger.debug("Annotating cold start")
            subsegment.put_annotation(key="ColdStart", value=cold_start)

            if self.service:
                subsegment.put_annotation(key="Service", value=self.service)

        return response
```

[aws_lambda_powertools/tracing/tracer.py](https://github.com/aws-powertools/powertools-lambda-python/blob/19c07985e8068ec1a8b97e9d8f2a0a1304a96c6d/aws_lambda_powertools/tracing/tracer.py#L346-L377) · [More projects using AWS X-Ray SDK →](https://dashboard.exa.ai/playground/search?q=aws-xray-sdk%20GitHub%20projects)

**Quickstart**

```python
from aws_xray_sdk.core import xray_recorder
xray_recorder.configure(service='example')
with xray_recorder.in_segment('example'):
    pass

```

From [recorder.py](https://raw.githubusercontent.com/aws/aws-xray-sdk-python/2.16.0/aws_xray_sdk/core/recorder.py)

## FAQ

### Which Python tracing library should I use?

[opentelemetry-sdk](#opentelemetry-sdk) suits tracing exported through standard OTLP to compatible backends. [Sentry SDK](#sentry-sdk) suits applications that track errors and spans together. [Langfuse](#langfuse) and [LangSmith](#langsmith) suit tracing LLM applications and agents.

### What is Langfuse?

[Langfuse](#langfuse) is a Python SDK for LLM observability and tracing, with datasets, experiments, evaluation, and prompt management.

### What is LangSmith?

[LangSmith](#langsmith) is a client library that connects to the LangSmith observability and evaluation platform.

### What is Logfire?

[Logfire](#logfire) creates structured logs and spans using OpenTelemetry. It sends data to its cloud by default. Its configuration can point to another OTLP backend instead.

### OpenTelemetry vs Sentry: which should I use?

[opentelemetry-sdk](#opentelemetry-sdk) creates spans and exports them through OTLP to compatible collectors and backends. [Sentry SDK](#sentry-sdk) captures errors and spans for Sentry, with automatic instrumentation for supported frameworks.

### What is ddtrace?

[ddtrace](#ddtrace) adds manual and automatic tracing to Python applications for Datadog. Automatic tracing must start early in the process.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python tracing libraries OpenTelemetry ddtrace Sentry Logfire distributed tracing code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
