github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/metrics/example_test.go (about)

     1  package metrics_test
     2  
     3  import (
     4  	"context"
     5  	"os"
     6  
     7  	"github.com/ydb-platform/ydb-go-sdk/v3"
     8  	"github.com/ydb-platform/ydb-go-sdk/v3/metrics"
     9  )
    10  
    11  func ExampleConfig() {
    12  	var registryConfig metrics.Config // registryConfig is an implementation registry.Config
    13  	db, err := ydb.Open(
    14  		context.TODO(),
    15  		os.Getenv("YDB_CONNECTION_STRING"),
    16  		metrics.WithTraces(registryConfig),
    17  	)
    18  	if err != nil {
    19  		panic(err)
    20  	}
    21  	defer func() {
    22  		_ = db.Close(context.TODO())
    23  	}()
    24  	// work with db
    25  }