telemetry

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Enabled controls whether telemetry collection is active
	Enabled bool
	// DeviceID is a hashed MAC address for device identification
	DeviceID string

	// OTLPEndpoint for OpenTelemetry Protocol export
	OTLPEndpoint string
	// ServiceName identifies the service in telemetry
	ServiceName string
	// ServiceVersion identifies the service version in telemetry
	ServiceVersion string
	// contains filtered or unexported fields
}

Config represents the telemetry configuration

func NewConfig

func NewConfig(serviceName, serviceVersion string) *Config

NewConfig creates a new telemetry configuration from environment variables

func (*Config) HasApplicationInsights

func (c *Config) HasApplicationInsights() bool

HasApplicationInsights returns whether application insights export is configured

func (*Config) HasOTLP

func (c *Config) HasOTLP() bool

HasOTLP returns whether OTLP export is configured

func (*Config) SetOTLPEndpoint

func (c *Config) SetOTLPEndpoint(endpoint string)

SetOTLPEndpoint sets the OTLP endpoint for CLI configuration

type Service

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

Service provides telemetry functionality for Kubernetes MCP

func NewService

func NewService(config *Config) *Service

NewService creates a new telemetry service

func (*Service) Initialize

func (s *Service) Initialize(ctx context.Context) error

Initialize sets up the telemetry providers and exporters

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the telemetry service

func (*Service) StartActivity

func (s *Service) StartActivity(ctx context.Context, activityName string) (context.Context, oteltrace.Span)

StartActivity starts a new telemetry activity (span)

func (*Service) TrackServiceStartup

func (s *Service) TrackServiceStartup(ctx context.Context)

TrackServiceStartup tracks the MCP server startup

func (*Service) TrackToolInvocation

func (s *Service) TrackToolInvocation(ctx context.Context, toolName string, operation string, success bool)

TrackToolInvocation tracks a tool invocation with minimal data

type TelemetryInterface

type TelemetryInterface interface {
	// Initialize sets up the telemetry providers and exporters
	Initialize(ctx context.Context) error

	// Shutdown gracefully shuts down the telemetry service
	Shutdown(ctx context.Context) error

	// StartActivity starts a new telemetry activity (span)
	StartActivity(ctx context.Context, activityName string) (context.Context, trace.Span)

	// TrackToolInvocation tracks a tool invocation with minimal data
	TrackToolInvocation(ctx context.Context, toolName string, operation string, success bool)

	// TrackServiceStartup tracks the MCP server startup
	TrackServiceStartup(ctx context.Context)
}

TelemetryInterface defines the methods available for telemetry tracking

Jump to

Keyboard shortcuts

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