Skip to content

otel.hyperdx

with_hyperdx(cls)

Decorator to wrap a function with hyperdx.

Source code in mirascope/otel/hyperdx/hyperdx.py
def with_hyperdx(cls):
    """Decorator to wrap a function with hyperdx."""
    provider = trace.get_tracer_provider()
    if not isinstance(provider, TracerProvider):
        motel.configure(
            processors=[
                BatchSpanProcessor(
                    OTLPSpanExporter(
                        endpoint="https://in-otel.hyperdx.io/v1/traces",
                        headers={"authorization": os.getenv("HYPERDX_API_KEY")},
                    )
                )
            ]
        )
    return motel.with_otel(cls)