terraform/internal/rpcapi/telemetry.go
2026-02-17 13:56:34 +00:00

23 lines
684 B
Go

// Copyright IBM Corp. 2014, 2026
// SPDX-License-Identifier: BUSL-1.1
package rpcapi
import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"
)
// tracer is the OpenTelemetry tracer to use for tracing for code in this
// package.
//
// When creating tracing spans in gRPC service functions, always use the
// a [context.Context] descended from the one passed in to the service
// function so that the spans can attach to the automatically-generated
// server request span and, if the client is also using OpenTelemetry,
// to the client's request span.
var tracer trace.Tracer
func init() {
tracer = otel.Tracer("github.com/hashicorp/terraform/internal/rpcapi")
}