data

package
v0.0.0-...-b0852c1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestContentTypeProtobuf = "application/x-protobuf"
)

Variables

This section is empty.

Functions

func NewEventsRequest

func NewEventsRequest(ctx context.Context, endpoint string, record *v1log.LogRecord, resourceTags Map) (*http.Request, error)

func NewMetricsRequest

func NewMetricsRequest(ctx context.Context, endpoint string, metrics []ResourceMetrics, compressPayload bool) (*http.Request, error)

func ProcessEventsResponse

func ProcessEventsResponse(resp *http.Response) error

func ProcessMetricResponse

func ProcessMetricResponse(resp *http.Response) (dropped int64, errs error)

func WithDelimitedStrings

func WithDelimitedStrings[Tags ~[]string](delim string, tags Tags) func(m Map)

WithDelimtedStrings splits each value based on the delim passed, if there is no delim present, then the entire string is added to the key and uses an empty string as the value

func WithHistogramDataPointAttributes

func WithHistogramDataPointAttributes(attrs Map) func(HistogramDataPoint)

func WithHistogramDataPointCumulativeBucketValues

func WithHistogramDataPointCumulativeBucketValues[Buckets ~map[Bound]int, Bound ~float64](buckets Buckets) func(HistogramDataPoint)

func WithHistogramDataPointStatistics

func WithHistogramDataPointStatistics(values []float64) func(HistogramDataPoint)

func WithInstrumentationScopeAttributes

func WithInstrumentationScopeAttributes(attributes Map) func(InstrumentationScope)

func WithNumberDataPointDoubleValue

func WithNumberDataPointDoubleValue(value float64) func(NumberDataPoint)

func WithNumberDataPointMap

func WithNumberDataPointMap(m Map) func(NumberDataPoint)

func WithNumberDatapointIntValue

func WithNumberDatapointIntValue(value int64) func(NumberDataPoint)

func WithResourceAttributes

func WithResourceAttributes(opts ...func(Map)) func(Resource)

func WithResourceMap

func WithResourceMap(m Map) func(Resource)

func WithStatsdDelimitedTags

func WithStatsdDelimitedTags[Tags ~[]string](tags Tags) func(Map)

func WithStatsdEventTags

func WithStatsdEventTags[Tags ~[]string](tags Tags) func(Map)

Types

type Converter

type Converter[S ~[]string] func(S) Map

type Gauge

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

func NewGauge

func NewGauge(datapoints ...NumberDataPoint) Gauge

type Histogram

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

func NewHistogram

func NewHistogram(datapoints ...HistogramDataPoint) Histogram

type HistogramDataPoint

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

func NewHistogramDataPoint

func NewHistogramDataPoint(timestamp uint64, opts ...func(HistogramDataPoint)) HistogramDataPoint

type InstrumentationScope

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

func NewInstrumentationScope

func NewInstrumentationScope(name string, version string, opts ...func(InstrumentationScope)) InstrumentationScope

NewInstrumentationScope is used for denote how the data was generated, this will always be set to `gostatsd` as the name, and the deployed version. Additional attributes can be set that could be used for filtering later on.

func (InstrumentationScope) Attributes

func (is InstrumentationScope) Attributes() Map

type KeyValue

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

func (KeyValue) Compare

func (a KeyValue) Compare(b KeyValue) int

Compare is used to determine order of a KeyValue within `Map` value, the keys are compared first and if they match, then values are compared. In the event that value types do not match, the `ArrayValue` takes priority of the `StringValue`.

func (KeyValue) InsertValue

func (kv KeyValue) InsertValue(value string)

InsertValue will update the value to be an array value if values doesn't match the existing value, and the array values are ensured for their uniquiness.

type Map

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

func NewMap

func NewMap(opts ...func(Map)) Map

func SplitEventTagsByKeysAndConvert

func SplitEventTagsByKeysAndConvert[S ~[]string](tags S, keys S) (matched, unmatched Map)

func SplitMetricTagsByKeysAndConvert

func SplitMetricTagsByKeysAndConvert[S ~[]string](tags S, keys S) (matched, unmatched Map)

func SplitTagsByKeysAndConvert

func SplitTagsByKeysAndConvert[S ~[]string](tags S, keys S, converter Converter[S]) (matched, unmatched Map)

func (Map) Hash

func (m Map) Hash() uint64

func (Map) Insert

func (m Map) Insert(key string, value string)

Insert will ensure that keys and their values are distinct.

func (Map) Merge

func (m Map) Merge(mm Map)

type Metric

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

func NewMetric

func NewMetric(name string) Metric

NewMetric creates a new metric wrapper and sets the metric value based on the provided function.

func (Metric) SetGauge

func (m Metric) SetGauge(g Gauge) Metric

func (Metric) SetHistogram

func (m Metric) SetHistogram(h Histogram) Metric

func (Metric) SetSum

func (m Metric) SetSum(s Sum) Metric

type NumberDataPoint

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

func NewNumberDataPoint

func NewNumberDataPoint(timestamp uint64, opts ...func(NumberDataPoint)) NumberDataPoint

NewNumberDataPoint applies options in order so the last value set wins

type OtlpEvent

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

func NewOtlpEvent

func NewOtlpEvent(e *gostatsd.Event) (*OtlpEvent, error)

func (*OtlpEvent) TransformToLog

func (s *OtlpEvent) TransformToLog(resourceKeys []string) (*v1log.LogRecord, Map)

type Resource

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

func NewResource

func NewResource(opts ...func(Resource)) Resource

func (Resource) Attributes

func (r Resource) Attributes() Map

type ResourceMetrics

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

func NewResourceMetrics

func NewResourceMetrics(resource Resource, scopeMetrics ...ScopeMetrics) ResourceMetrics

func (ResourceMetrics) AppendMetric

func (rm ResourceMetrics) AppendMetric(is InstrumentationScope, m Metric)

func (ResourceMetrics) CountMetrics

func (rm ResourceMetrics) CountMetrics() int

type ScopeMetrics

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

func NewScopeMetrics

func NewScopeMetrics(is InstrumentationScope, metrics ...Metric) ScopeMetrics

type Sum

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

func NewSum

func NewSum(datapoints ...NumberDataPoint) Sum

Jump to

Keyboard shortcuts

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