telemetrytest

package
v2.2.0-dev Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package telemetrytest provides a mock implementation of the telemetry client for testing purposes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConfig

func CheckConfig(t *testing.T, cfgs []telemetry.Configuration, key string, value any)

Types

type LogLine

type LogLine struct {
	Level telemetry.LogLevel
	Text  string
}

type MetricKey

type MetricKey struct {
	Namespace telemetry.Namespace
	Name      string
	Tags      string
	Kind      string
}

type MockClient

type MockClient struct {
	mock.Mock
	// contains filtered or unexported fields
}

MockClient implements Client and is used for testing purposes outside the telemetry package, e.g. the tracer and profiler.

func (*MockClient) AddFlushTicker

func (m *MockClient) AddFlushTicker(ticker func(telemetry.Client))

func (*MockClient) AppStart

func (m *MockClient) AppStart()

func (*MockClient) AppStop

func (m *MockClient) AppStop()

func (*MockClient) Close

func (m *MockClient) Close() error

func (*MockClient) Count

func (m *MockClient) Count(namespace telemetry.Namespace, name string, tags []string) telemetry.MetricHandle

func (*MockClient) Distribution

func (m *MockClient) Distribution(namespace telemetry.Namespace, name string, tags []string) telemetry.MetricHandle

func (*MockClient) Flush

func (m *MockClient) Flush()

func (*MockClient) Gauge

func (m *MockClient) Gauge(namespace telemetry.Namespace, name string, tags []string) telemetry.MetricHandle

func (*MockClient) Log

func (m *MockClient) Log(level telemetry.LogLevel, text string, options ...telemetry.LogOption)

func (*MockClient) MarkIntegrationAsLoaded

func (m *MockClient) MarkIntegrationAsLoaded(integration telemetry.Integration)

func (*MockClient) ProductStartError

func (m *MockClient) ProductStartError(product telemetry.Namespace, err error)

func (*MockClient) ProductStarted

func (m *MockClient) ProductStarted(product telemetry.Namespace)

func (*MockClient) ProductStopped

func (m *MockClient) ProductStopped(product telemetry.Namespace)

func (*MockClient) Rate

func (m *MockClient) Rate(namespace telemetry.Namespace, name string, tags []string) telemetry.MetricHandle

func (*MockClient) RegisterAppConfig

func (m *MockClient) RegisterAppConfig(key string, value any, origin telemetry.Origin)

func (*MockClient) RegisterAppConfigs

func (m *MockClient) RegisterAppConfigs(kvs ...telemetry.Configuration)

type MockMetricHandle

type MockMetricHandle struct {
	mock.Mock
}

func (*MockMetricHandle) Get

func (m *MockMetricHandle) Get() float64

func (*MockMetricHandle) Submit

func (m *MockMetricHandle) Submit(value float64)

type RecordClient

type RecordClient struct {
	Started       bool
	Stopped       bool
	Configuration []telemetry.Configuration
	Logs          []LogLine
	Integrations  []telemetry.Integration
	Products      map[telemetry.Namespace]bool
	Metrics       map[MetricKey]*RecordMetricHandle
	// contains filtered or unexported fields
}

func (*RecordClient) AddFlushTicker

func (r *RecordClient) AddFlushTicker(func(telemetry.Client))

func (*RecordClient) AppStart

func (r *RecordClient) AppStart()

func (*RecordClient) AppStop

func (r *RecordClient) AppStop()

func (*RecordClient) Close

func (r *RecordClient) Close() error

func (*RecordClient) Count

func (r *RecordClient) Count(namespace telemetry.Namespace, name string, tags []string) telemetry.MetricHandle

func (*RecordClient) Distribution

func (r *RecordClient) Distribution(namespace telemetry.Namespace, name string, tags []string) telemetry.MetricHandle

func (*RecordClient) Flush

func (r *RecordClient) Flush()

func (*RecordClient) Gauge

func (r *RecordClient) Gauge(namespace telemetry.Namespace, name string, tags []string) telemetry.MetricHandle

func (*RecordClient) Log

func (r *RecordClient) Log(level telemetry.LogLevel, text string, _ ...telemetry.LogOption)

func (*RecordClient) MarkIntegrationAsLoaded

func (r *RecordClient) MarkIntegrationAsLoaded(integration telemetry.Integration)

func (*RecordClient) ProductStartError

func (r *RecordClient) ProductStartError(product telemetry.Namespace, _ error)

func (*RecordClient) ProductStarted

func (r *RecordClient) ProductStarted(product telemetry.Namespace)

func (*RecordClient) ProductStopped

func (r *RecordClient) ProductStopped(product telemetry.Namespace)

func (*RecordClient) Rate

func (r *RecordClient) Rate(namespace telemetry.Namespace, name string, tags []string) telemetry.MetricHandle

func (*RecordClient) RegisterAppConfig

func (r *RecordClient) RegisterAppConfig(key string, value any, origin telemetry.Origin)

func (*RecordClient) RegisterAppConfigs

func (r *RecordClient) RegisterAppConfigs(kvs ...telemetry.Configuration)

type RecordMetricHandle

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

func (*RecordMetricHandle) Get

func (m *RecordMetricHandle) Get() float64

func (*RecordMetricHandle) Submit

func (m *RecordMetricHandle) Submit(value float64)

Jump to

Keyboard shortcuts

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