instrumentation

package
v0.0.0-...-02209d8 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvImageVersionKey        = "IMAGE_VERSION"
	EnvResourceIDKey          = "AZURE_RESOURCE_ID"
	EnvResourceRegionKey      = "AZURE_RESOURCE_REGION"
	EnvClusterDistributionKey = "CLUSTER_DISTRIBUTION"
	EnvChartVersionKey        = "CHART_VERSION"
	EnvNodeNameKey            = "NODE_NAME"
	Unknown                   = "Unknown"
)
View Source
const (
	// Metric name
	ErrorEncounteredMetricName = "ErrorEncountered"
)

Variables

This section is empty.

Functions

func GetDimensionsString

func GetDimensionsString(dimensions []Dimension) string

func GetPlatformMdmAccount

func GetPlatformMdmAccount(region string) string

func GetReleaseTrain

func GetReleaseTrain(region string) string

func TestMain

func TestMain(m *testing.M)

Types

type Dimension

type Dimension struct {
	Key   string
	Value string
}

Dimension A dimension in the metric

type DimensionlessMetric

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

DimensionlessMetric implementation of Metric, for metric without dimensions

func NewDimensionlessMetric

func NewDimensionlessMetric(metricName string) *DimensionlessMetric

NewDimensionlessMetric Cto'r for DimensionlessMetric

func (*DimensionlessMetric) MetricDimension

func (metric *DimensionlessMetric) MetricDimension() []Dimension

func (*DimensionlessMetric) MetricName

func (metric *DimensionlessMetric) MetricName() string

type ErrorEncounteredMetric

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

ErrorEncounteredMetric implementation of Metric, for error encountered metric

func NewErrorEncounteredMetric

func NewErrorEncounteredMetric(errorType, context string) *ErrorEncounteredMetric

NewErrorEncounteredMetric Cto'r for ErrorEncounteredMetric

func (*ErrorEncounteredMetric) MetricDimension

func (metric *ErrorEncounteredMetric) MetricDimension() []Dimension

func (*ErrorEncounteredMetric) MetricName

func (metric *ErrorEncounteredMetric) MetricName() string

type EventBasedMetric

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

EventBasedMetric implementation of Metric, for event based metric

func NewEventCollectedMetric

func NewEventCollectedMetric(eventType string) *EventBasedMetric

newEventCollectedMetric Ctor for EventCollectedMetric

func NewEventEnrichedMetric

func NewEventEnrichedMetric(eventType string) *EventBasedMetric

NewEventEnrichedMetric Ctor for EventEnrichedMetric

func NewEventParsedMetric

func NewEventParsedMetric(eventType string) *EventBasedMetric

NewEventParsedMetric Ctor for EventParsedMetric

func NewEventReadMetric

func NewEventReadMetric(eventType string) *EventBasedMetric

NewEventReadMetric Ctor for EventReadMetric

func (*EventBasedMetric) MetricDimension

func (metric *EventBasedMetric) MetricDimension() []Dimension

MetricDimension - metric dimensions

func (*EventBasedMetric) MetricName

func (metric *EventBasedMetric) MetricName() string

MetricName - metric name

type HeartbeatSender

type HeartbeatSender interface {
	// contains filtered or unexported methods
}

interface for Heartbeat sender

type HeartbeatSenderImpl

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

HeartbeatSenderImpl holds the needed data for sending heartbeat

type InstrumentationConfiguration

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

InstrumentationConfiguration for the instrumentation platform

func NewInstrumentationConfiguration

func NewInstrumentationConfiguration(componentName, azureResourceID, region, clusterDistribution, chartVersion, imageName, imageVersion, mdmAccount, mdmNamespace, releaseTrain, nodeName string) *InstrumentationConfiguration

NewInstrumentationConfiguration - Ctor to create a new instrumentation configuration

func NewInstrumentationConfigurationFromEnv

func NewInstrumentationConfigurationFromEnv(componentName, mdmNamespace string) *InstrumentationConfiguration

NewInstrumentationConfiguration - Ctor to create a new instrumentation configuration from environment variables

func (*InstrumentationConfiguration) GetDefaultDimensions

func (configuration *InstrumentationConfiguration) GetDefaultDimensions() []Dimension

GetDefaultDimensions - Get the default dimensions to be attached to each metric reports

type InstrumentationInitializationResult

type InstrumentationInitializationResult struct {
	MetricSubmitter MetricSubmitter
	Tracer          *log.Entry
}

InstrumentationInitializationResult - aggregative type for all initialization result objects

func InitializeFromEnv

func InitializeFromEnv(componentName, mdmNamespace string) *InstrumentationInitializationResult

type InstrumentationInitializer

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

InstrumentationInitializer helper object to initialize the instrumentation platform

func NewInstrumentationInitializer

func NewInstrumentationInitializer(configuration *InstrumentationConfiguration) *InstrumentationInitializer

NewInstrumentationInitializer - Ctor for creating the instrumentation initializer

func (*InstrumentationInitializer) Initialize

Initialize - initialize the instrumentation framework

type Metric

type Metric interface {
	// GetMetricName - getter for the metric name
	MetricName() string
	// GetMetricDimension - getter for the metric dimensions
	MetricDimension() []Dimension
}

Metric interface for getting the metric name and metric dimensions

type MetricSubmitter

type MetricSubmitter interface {
	// SendMetric - send metric by name with provided dimensions
	SendMetric(value int, metric Metric)

	SendMetricToNamespace(value int, metric Metric, accountName, namespaceName string)
}

MetricSubmitter - interface for sending metrics

type MetricSubmitterFactory

type MetricSubmitterFactory interface {
	// contains filtered or unexported methods
}

func NewMetricSubmitterFactory

func NewMetricSubmitterFactory(tracer *logrus.Entry, configuration *InstrumentationConfiguration) (MetricSubmitterFactory, error)

NewMetricSubmitterFactory tracer factory

type MetricSubmitterFactoryImpl

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

MetricSubmitterFactoryImpl a factory for creating a metric submitter

type MetricSubmitterImpl

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

MetricSubmitterImpl a metric submitter object - can be use to send metrics easily

func (*MetricSubmitterImpl) SendMetric

func (metricSubmitter *MetricSubmitterImpl) SendMetric(value int, metric Metric)

SendMetric send metric

func (*MetricSubmitterImpl) SendMetricToNamespace

func (metricSubmitter *MetricSubmitterImpl) SendMetricToNamespace(value int, metric Metric, accountName, namespaceName string)

type MetricWriter

type MetricWriter interface {
	// Write - send metric by name with provided dimensions
	Write(metric *rawMetric)
}

MetricWriter - interface for sending metrics

type MetricWriterImpl

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

MetricWriterImpl a metric sender object - can be use to send metrics easily

func (*MetricWriterImpl) Write

func (metricWriter *MetricWriterImpl) Write(metric *rawMetric)

Write - writes the new metric or updating the value of the existing cached one

type PlatformMetricSubmitter

type PlatformMetricSubmitter interface {
	// SendMetricToPlatform - send metric by name with provided dimensions, to the platform account and namespace
	SendMetricToPlatform(value int, metric Metric)
}

PlatformMetricSubmitter - interface for sending platform metrics

func NewPlatformMetricSubmitter

func NewPlatformMetricSubmitter(metricSubmitter MetricSubmitter) PlatformMetricSubmitter

NewPlatformMetricSubmitter creates a new metric submitter that reports metrics to the platform namespace and account

type PlatformMetricSubmitterImpl

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

PlatformMetricSubmitterImpl a metric submitter object - can be use to send metrics easily (to platform account)

func (*PlatformMetricSubmitterImpl) SendMetricToPlatform

func (platformMetricSubmitter *PlatformMetricSubmitterImpl) SendMetricToPlatform(value int, metric Metric)

SendMetric send metric (for platform submitter)

type TraceType

type TraceType string
const (
	HeartbeatTraceType TraceType = "Heartbeat"
	MessageTraceType   TraceType = "Trace"
)

type TracerFactory

type TracerFactory interface {
	CreateTracer(tracerType TraceType) *log.Entry
	DeleteTracerFile() error
}

TracerFactory - Interface for creating tracer entry objects

func NewTracerFactory

func NewTracerFactory(instrumentationConfiguration *InstrumentationConfiguration) TracerFactory

NewTracerFactory tracer factory

type TracerFactoryImpl

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

TracerFactoryImpl a factory for creating a tracer entry

func (*TracerFactoryImpl) CreateTracer

func (tracerFactory *TracerFactoryImpl) CreateTracer(tracerType TraceType) *log.Entry

CreateLogger - Method for creating a tracer entry that can be use to send traces

func (*TracerFactoryImpl) DeleteTracerFile

func (tracerFactory *TracerFactoryImpl) DeleteTracerFile() error

DeleteTracerFile - delete the tracer's log file

func (*TracerFactoryImpl) SetRollingFileConfiguration

func (tracerFactory *TracerFactoryImpl) SetRollingFileConfiguration(rollingFileConfiguration *common.RollingFileConfiguration)

SetRollingFileConfiguration - set rolling file configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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