{"modulePath":"github.com/AliceO2Group/Control","version":"v1.51.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package monitoring\n\nPackage monitoring provides monitoring and metrics collection functionality for O² Control components.\n\n## Constants\n\n```go\nconst (\n\tERROR     = \"error\"\n\tSUCCESS   = \"success\"\n\tCANCELLED = \"cancelled\"\n\tTIMEOUT   = \"timeout\"\n)\n```\n\n## Functions\n\n```go\nfunc AddEnvAndRunType(ctx context.Context, envId, runType string) context.Context\n```\n\n```go\nfunc Format(writer io.Writer, metrics []Metric) error\n```\n\n```go\nfunc Run(port uint16, endpointName string) error\n```\n\\\\param port port where the scraping endpoint will be created \\\\param endpointName name of the endpoint, which must start with a slash eg. \"/internalmetrics\"\n\nIf we attempt send more messages than the size of the buffer, these overflowing messages will be ignored and warning will be logged.\n\n```go\nfunc Send(metric *Metric)\n```\n\n```go\nfunc SendHistogrammable(metric *Metric)\n```\n\n```go\nfunc SetupStreamClientInterceptor(metricName string, convert NameConvertType) grpc.StreamClientInterceptor\n```\n\n```go\nfunc SetupUnaryClientInterceptor(name string, convert NameConvertType) grpc.UnaryClientInterceptor\n```\n\n```go\nfunc Stop()\n```\n\n```go\nfunc Timer(metric *Metric, unit TimeResolution) func()\n```\nTimer function is meant to be used with defer statement to measure runtime of given function: defer Timer(\u0026metric, Milliseconds)()\n\n```go\nfunc TimerSendHist(metric *Metric, unit TimeResolution) func()\n```\nTimer function is meant to be used with defer statement to measure runtime of given function: defer Timer(\u0026metric, Milliseconds)() sends measured value as SendHistogrammable(metric)\n\n```go\nfunc TimerSendSingle(metric *Metric, unit TimeResolution) func()\n```\nTimer function is meant to be used with defer statement to measure runtime of given function: defer Timer(\u0026metric, Milliseconds)() sends measured value as Send(metric)\n\n```go\nfunc WaitUntilRunning(timeout time.Duration) bool\n```\nIf monitoring is not running it will wait until monitoring is running or timeout is triggered. \\\\return true if monitoring is running, false if timeout occured\n\n## Types\n\n```go\ntype EnvIDKey struct{}\n```\n\n```go\ntype FieldsType map[string]any\n```\n\n```go\ntype Metric struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewDefaultMetric(name string, timestamp time.Time) Metric\n```\nReturn empty metric, it is used right now mostly in string to report metrics correctly to influxdb use NewECSMetric\n\n```go\nfunc NewMetric(name string) Metric\n```\ncreates empty metric with tag subsystem=ECS, which is used by Telegraf to send metrics from ECS to correct bucket\n\n```go\nfunc (metric *Metric) AddError(err error)\n```\n\n```go\nfunc (metric *Metric) AddResult(result string)\n```\n\n```go\nfunc (metric *Metric) AddTag(tagName string, value string)\n```\n\n```go\nfunc (metric *Metric) MergeFields(other *Metric)\n```\n\n```go\nfunc (metric *Metric) SetFieldFloat64(fieldName string, field float64)\n```\n\n```go\nfunc (metric *Metric) SetFieldInt64(fieldName string, field int64)\n```\n\n```go\nfunc (metric *Metric) SetFieldUInt64(fieldName string, field uint64)\n```\n\n```go\ntype MetricsAggregate struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewMetricsAggregate() *MetricsAggregate\n```\n\n```go\nfunc (this *MetricsAggregate) AddMetric(metric *Metric)\n```\n\n```go\nfunc (this *MetricsAggregate) Clear()\n```\n\n```go\nfunc (this *MetricsAggregate) GetMetrics() []Metric\n```\n\n```go\ntype MetricsReservoirSampling struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewMetricsReservoirSampling() *MetricsReservoirSampling\n```\n\n```go\nfunc (this *MetricsReservoirSampling) AddMetric(metric *Metric)\n```\n\n```go\nfunc (this *MetricsReservoirSampling) Clear()\n```\n\n```go\nfunc (this *MetricsReservoirSampling) GetMetrics() []Metric\n```\n\n```go\ntype NameConvertType func(string) string\n```\n\n```go\ntype RunTypeKey struct{}\n```\n\n```go\ntype Tag struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype TagsType []Tag\n```\n\n```go\ntype TimeResolution int\n```\n\n```go\nconst (\n\tMillisecond TimeResolution = iota\n\tNanosecond\n)\n```\n\n","path":"github.com/AliceO2Group/Control/common/monitoring","name":"monitoring","synopsis":"Package monitoring provides monitoring and metrics collection functionality for O² Control components.","isRedistributable":true}
