otel

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

README


title: OpenTelemetry Plugin

Integrates OpenTelemetry tracing.

Type

  • Wrapper

Description

Adds OpenTelemetry tracing support for database operations.

Configuration

otel:
  exporter_type: "oltp"              # "oltp" or "stdout"
  service_name: "my-gateway"
  service_version: "1.0.0"
  environment: "production"
  endpoint: "localhost:4317"
  tls_mode: "insecure"
  span_max_queue_size: 5000
  span_max_export_batch: 512
  batch_timeout: "1s"
  resource_attributes:               # Additional trace attributes
    team: "backend"
    region: "us-east-1"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (plugins.Wrapper, error)

Types

type Config

type Config struct {
	// ExporterType defines the type of exporter to use ("oltp" or "stdout")
	ExporterType string `yaml:"exporter_type"`

	// ServiceName is the name of your service for tracing
	ServiceName string `yaml:"service_name"`

	// ServiceVersion is the version of your service
	ServiceVersion string `yaml:"service_version"`

	// Environment specifies deployment environment (e.g., "prod", "staging")
	Environment string `yaml:"environment"`

	// Endpoint is the OTLP endpoint URL (for oltp exporter)
	Endpoint string `yaml:"endpoint"`

	// Insecure determines if TLS should be disabled
	Insecure bool `yaml:"tls_mode"`

	// SpanMaxQueueSize is the maximum queue size for spans
	SpanMaxQueueSize int `yaml:"span_max_queue_size"`

	// SpanMaxExportBatch is the maximum batch size for span export
	SpanMaxExportBatch int `yaml:"span_max_export_batch"`

	// BatchTimeout is the timeout for batching spans
	BatchTimeout time.Duration `yaml:"batch_timeout"`

	// ResourceAttributes are additional attributes to add to traces
	ResourceAttributes map[string]string `yaml:"resource_attributes"`
}

Config represents OpenTelemetry configuration

func (Config) Doc

func (c Config) Doc() string

func (Config) Tag

func (c Config) Tag() string

func (Config) WithDefaults

func (c Config) WithDefaults()

type Connector

type Connector struct {
	// contains filtered or unexported fields
}

func (Connector) Config added in v0.0.8

func (c Connector) Config() connectors.Config

func (Connector) Discovery

func (c Connector) Discovery(ctx context.Context) ([]model.Table, error)

func (Connector) InferQuery

func (c Connector) InferQuery(ctx context.Context, query string) ([]model.ColumnSchema, error)

func (Connector) Ping

func (c Connector) Ping(ctx context.Context) error

func (Connector) Query

func (c Connector) Query(ctx context.Context, endpoint model.Endpoint, params map[string]any) ([]map[string]any, error)

func (Connector) Sample

func (c Connector) Sample(ctx context.Context, table model.Table) ([]map[string]any, error)

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (Plugin) Doc

func (p Plugin) Doc() string

func (Plugin) Wrap

func (p Plugin) Wrap(connector connectors.Connector) (connectors.Connector, error)

Jump to

Keyboard shortcuts

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