otlp

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Provides OTLP connection configuration types and utilities for the OpenTelemetry Collector (see https://opentelemetry.io/docs/collector/).

Index

Constants

View Source
const (
	// Default protocol for telemetry collection (gRPC).
	DefaultProtocol = GRPC

	// Default otlp endpoint.
	DefaultEndpoint = "localhost:4317"
)

Variables

This section is empty.

Functions

func Defaults

func Defaults() map[string]any

Defaults returns a map of default configuration values for the otlp package. It sets a default protocol and endpoint address.

func TLSConfig

func TLSConfig(config Config) (*tls.Config, error)

TLSConfig generates a tls.Config from the provided Config structure. It loads the client certificate, key, and CA certificate to configure mutual TLS authentication.

func TLSCredentials

func TLSCredentials(
	config Config,
) (credentials.TransportCredentials, error)

TLSCredentials creates gRPC transport credentials using TLS settings from the provided Config. It loads the TLS configuration and returns transport credentials or an error if loading fails.

Types

type Config

type Config struct {
	// Protocol to use for telemetry collection - GRPC (default), HTTP.
	Protocol Protocol `json:"protocol" yaml:"protocol" mapstructure:"protocol"`

	// Endpoint for OTLP protocol.
	Endpoint string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint"`

	// Whether to use an insecure endpoint (without TLS).
	Insecure bool `json:"insecure" yaml:"insecure" mapstructure:"insecure"`

	// Path to the client certificate file.
	ClientCertificate string `json:"clientCertificate" yaml:"clientCertificate" mapstructure:"clientCertificate"`

	// Path to the client private key file.
	ClientKey string `json:"clientKey" yaml:"clientKey" mapstructure:"clientKey"`

	// Path to the Certificate Authority (CA) file.
	Certificate string `json:"certificate" yaml:"certificate" mapstructure:"certificate"`
}

Config represents the configuration settings for a OTEL protocol. It includes details about the protocol, endpoint settings, security options, and TLS configuration.

type Protocol

type Protocol string

Protocol defines a type for supported communication protocols.

const (
	// GRPC represents the gRPC protocol.
	GRPC Protocol = "grpc"
	// HTTP represents the HTTP Protobuf protocol.
	HTTP Protocol = "http/protobuf"
)

func (Protocol) String

func (p Protocol) String() string

String returns the string representation of the Protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL