---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ydb.tech/docs/en/reference/ydb-sdk/observability/tracing/jaeger.md?version=main
  - https://ydb.tech/docs/ru/reference/ydb-sdk/observability/tracing/jaeger.md?version=main
sourcePath: en/core/reference/ydb-sdk/observability/tracing/jaeger.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# Enabling tracing in Jaeger

Below are code examples for enabling tracing in Jaeger in different YDB SDKs.

{% list tabs %}

- C++

  This feature is not currently supported.

- Go

  {% list tabs %}

  - Native SDK

    ```go
    package main

    import (
        "context"
        "time"

        "github.com/opentracing/opentracing-go"
        jaegerConfig "github.com/uber/jaeger-client-go/config"

        "github.com/ydb-platform/ydb-go-sdk/v3"
        "github.com/ydb-platform/ydb-go-sdk/v3/trace"

        tracing "github.com/ydb-platform/ydb-go-sdk-opentracing"
    )

    const (
        tracerURL   = "localhost:5775"
        serviceName = "ydb-go-sdk"
    )

    func main() {
        tracer, closer, err := jaegerConfig.Configuration{
            ServiceName: serviceName,
            Sampler: &jaegerConfig.SamplerConfig{
                Type:  "const",
                Param: 1,
            },
            Reporter: &jaegerConfig.ReporterConfig{
                LogSpans:            true,
                BufferFlushInterval: 1 * time.Second,
                LocalAgentHostPort:  tracerURL,
            },
        }.NewTracer()
        if err != nil {
            panic(err)
        }

        defer closer.Close()

        // set global tracer of this application
        opentracing.SetGlobalTracer(tracer)

        span, ctx := opentracing.StartSpanFromContext(context.Background(), "client")
        defer span.Finish()

        db, err := ydb.Open(ctx,
            os.Getenv("YDB_CONNECTION_STRING"),
            tracing.WithTraces(tracing.WithDetails(trace.DetailsAll)),
        )
        if err != nil {
            panic(err)
        }
        defer db.Close(ctx)
        ...
    }
    ```

  - database/sql

    ```go
    package main

    import (
        "context"
        "database/sql"
        "time"

        "github.com/opentracing/opentracing-go"
        jaegerConfig "github.com/uber/jaeger-client-go/config"

        "github.com/ydb-platform/ydb-go-sdk/v3"
        "github.com/ydb-platform/ydb-go-sdk/v3/trace"

        tracing "github.com/ydb-platform/ydb-go-sdk-opentracing"
    )

    const (
        tracerURL   = "localhost:5775"
        serviceName = "ydb-go-sdk"
    )

    func main() {
        tracer, closer, err := jaegerConfig.Configuration{
            ServiceName: serviceName,
                Sampler: &jaegerConfig.SamplerConfig{
                Type:  "const",
                Param: 1,
            },
            Reporter: &jaegerConfig.ReporterConfig{
                LogSpans:            true,
                BufferFlushInterval: 1 * time.Second,
                LocalAgentHostPort:  tracerURL,
            },
        }.NewTracer()
        if err != nil {
            panic(err)
        }

        defer closer.Close()

        // set global tracer of this application
        opentracing.SetGlobalTracer(tracer)

        span, ctx := opentracing.StartSpanFromContext(context.Background(), "client")
        defer span.Finish()

        nativeDriver, err := ydb.Open(ctx,
            os.Getenv("YDB_CONNECTION_STRING"),
            tracing.WithTraces(tracing.WithDetails(trace.DetailsAll)),
        )
        if err != nil {
            panic(err)
        }
        defer nativeDriver.Close(ctx)

        connector, err := ydb.Connector(nativeDriver)
        if err != nil {
            panic(err)
        }

        db := sql.OpenDB(connector)
        defer db.Close()
        ...
    }
    ```

  {% endlist %}

- Java

  <!-- source: en/_includes/feature-not-supported.md -->
  This functionality is not currently supported.
  <!-- endsource: en/_includes/feature-not-supported.md -->

- Python

  <!-- source: en/_includes/feature-not-supported.md -->
  This functionality is not currently supported.
  <!-- endsource: en/_includes/feature-not-supported.md -->

- C#

  <!-- source: en/_includes/feature-not-supported.md -->
  This functionality is not currently supported.
  <!-- endsource: en/_includes/feature-not-supported.md -->

- JavaScript

  <!-- source: en/_includes/feature-not-supported.md -->
  This functionality is not currently supported.
  <!-- endsource: en/_includes/feature-not-supported.md -->

- Rust

  <!-- source: en/_includes/feature-not-supported.md -->
  This functionality is not currently supported.
  <!-- endsource: en/_includes/feature-not-supported.md -->

  For distributed tracing, use [`tracing`](https://docs.rs/tracing) and export via OpenTelemetry ([#268](https://github.com/ydb-platform/ydb-rs-sdk/issues/268)).

- PHP

  <!-- source: en/_includes/feature-not-supported.md -->
  This functionality is not currently supported.
  <!-- endsource: en/_includes/feature-not-supported.md -->

{% endlist %}
