metrics

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metric

type Metric struct {
	Name        string
	Unit        string
	Description string
}

Metric represents a metric that can be collected.

type Recorder

type Recorder interface {
	Histogram(metric Metric) otelmetric.Int64Histogram
	Counter(metric Metric) otelmetric.Int64Counter
	Shutdown(ctx context.Context) error
}

Recorder is the interface for recording metrics.

func New

func New(
	ctx context.Context,
	version string,
	logger *slog.Logger,
	option RecorderOption,
) (Recorder, error)

New creates a new Recorder and initializes the OpenTelemetry provider.

func NewNoop

func NewNoop() Recorder

NewNoop returns a no-op Recorder.

type RecorderOption

type RecorderOption struct {
	Endpoint string
	Headers  map[string]string
	UseDelta bool
}

RecorderOption holds configuration for creating a Recorder.

type ServiceReporter

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

ServiceReporter handles metrics reporting for import and export service operations.

func NewServiceReporter

func NewServiceReporter(recorder Recorder) *ServiceReporter

NewServiceReporter creates a new metrics reporter for service operations.

func (*ServiceReporter) ReportExportCall

func (r *ServiceReporter) ReportExportCall(ctx context.Context)

ReportExportCall reports an export operation.

func (*ServiceReporter) ReportImportCall

func (r *ServiceReporter) ReportImportCall(ctx context.Context)

ReportImportCall reports an import operation.

type UnknownActionReporter

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

UnknownActionReporter handles metrics reporting for unknown actions across all plugins.

func NewUnknownActionReporter

func NewUnknownActionReporter(recorder Recorder) *UnknownActionReporter

NewUnknownActionReporter creates a new metrics reporter for unknown actions.

func (*UnknownActionReporter) ReportUnknownCommand

func (r *UnknownActionReporter) ReportUnknownCommand(
	ctx context.Context,
	editorType pluginapi.EditorType,
	action string,
)

ReportUnknownCommand reports an unknown action encountered during import.

Jump to

Keyboard shortcuts

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