melt

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DumpFormatHuman = "human"
	DumpFormatText  = "text"
	DumpFormatJson  = "json"
	DumpFormatYaml  = "yaml"
	DumpFormatHex   = "hex"
)
View Source
const (
	// AggregationTemporalityUnspecified -  temporality unspecified
	AggregationTemporalityUnspecified AggregationTemporality = 0

	// AggregationTemporalityDelta -  temporality delta
	AggregationTemporalityDelta AggregationTemporality = 1

	// AggregationTemporalityCumulative -  temporality comulative
	AggregationTemporalityCumulative AggregationTemporality = 2

	// SpanKindUnspecified - unspecified
	SpanKindUnspecified SpanKind = 0
	// SpanKindInternal - intermal
	SpanKindInternal SpanKind = 1
	// SpanKindServer - server
	SpanKindServer SpanKind = 2
	// SpanKindClient - client
	SpanKindClient SpanKind = 3
	// SpanKindProducer - producer
	SpanKindProducer SpanKind = 4
	// SpanKindConsumer - consumer
	SpanKindConsumer SpanKind = 5

	// SpanStatusCodeUnset - unset
	SpanStatusCodeUnset SpanStatusCode = 0
	// SpanStatusCodeOK - unset
	SpanStatusCodeOK SpanStatusCode = 1
	// SpanStatusCodeError - unset
	SpanStatusCodeError SpanStatusCode = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregationTemporality

type AggregationTemporality int8

AggregationTemporality - aggretation temporality

func (*AggregationTemporality) UnmarshalYAML added in v0.63.1

func (a *AggregationTemporality) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML for AggregationTemporality support both integer and string (human) enumerated values

type DataPoint

type DataPoint struct {
	StartTime       int64
	EndTime         int64
	Value           float64
	Count           int64
	Bucket_Count    []uint64               `yaml:"bucket_count,omitempty"`
	Explicit_Bounds []float64              `yaml:"explicit_bounds,omitempty"`
	Attributes      map[string]interface{} `yaml:"attributes,omitempty"`
	Quantiles       []*QuantileValue
}

DataPoint - structs for data point

type Entity

type Entity struct {
	TypeName      string
	ID            string `yaml:"id,omitempty"`
	Attributes    map[string]interface{}
	Metrics       []*Metric
	Logs          []*Log
	Relationships []*Relationship
	Spans         []*Span
}

Entity - type for holding entity inforrmation

func NewEntity

func NewEntity(typeName string) *Entity

NewEntity - Returns a new entity

func (*Entity) AddLog

func (e *Entity) AddLog(l *Log) *Entity

AddLog - add a log/event

func (*Entity) AddMetric

func (e *Entity) AddMetric(m *Metric) *Entity

AddMetric - add a metric

func (*Entity) AddRelationship

func (e *Entity) AddRelationship(r *Relationship) *Entity

AddRelationship - add a Relationship

func (*Entity) AddSpan

func (e *Entity) AddSpan(l *Span) *Entity

AddSpan - add a span

func (*Entity) ClearLogs

func (e *Entity) ClearLogs() *Entity

ClearLogs - clear the logs

func (*Entity) ClearMetrics

func (e *Entity) ClearMetrics() *Entity

ClearMetrics - clear the metrics

func (*Entity) SetAttribute

func (e *Entity) SetAttribute(key string, value interface{}) *Entity

SetAttribute - Set an attribute

type Exporter

type Exporter struct {
	DumpFunc   func(text string)
	DumpFormat string
	DryRun     bool
}

Exporter - exporter for entities, metrics and logs

func (*Exporter) ExportEvents

func (exp *Exporter) ExportEvents(entities []*Entity) error

ExportEvents - export events as resource logs OTEL does not distibguish between events and logs

func (*Exporter) ExportLogs

func (exp *Exporter) ExportLogs(entities []*Entity) error

ExportLogs - export resource logs

func (*Exporter) ExportMetrics

func (exp *Exporter) ExportMetrics(entities []*Entity) error

ExportMetrics - export metrics

func (*Exporter) ExportSpans

func (exp *Exporter) ExportSpans(entities []*Entity) error

ExportSpans - export resource spans

type FsocData

type FsocData struct {
	Melt []*Entity
}

type Log

type Log struct {
	Resource   Resource `yaml:"resource,omitempty"`
	Body       string
	Severity   string // use for log
	Timestamp  int64  `yaml:"timestamp,omitempty"`
	Attributes map[string]interface{}
	IsEvent    bool   `yaml:"isevent,omitempty"`
	TypeName   string `yaml:"typename,omitempty"`
}

Log - structs for logs“

func NewEvent

func NewEvent(typeName string) *Log

NewEvent - Returns a new event

func NewLog

func NewLog() *Log

NewLog - Returns a new log

func (*Log) SetAttribute

func (l *Log) SetAttribute(key string, value interface{}) *Log

SetAttribute - Set an attribute on log

type Metric

type Metric struct {
	TypeName               string
	Description            string
	ContentType            string
	Unit                   string
	Type                   string
	Resource               Resource               `yaml:"resource,omitempty"`
	Attributes             map[string]interface{} `yaml:"attributes,omitempty"`
	DataPoints             []*DataPoint           `yaml:"datapoints,omitempty"`
	Min                    string                 `yaml:"min,omitempty"`
	Max                    string                 `yaml:"max,omitempty"`
	Value                  string                 `yaml:"value,omitempty"`
	IsMonotonic            bool                   `yaml:"ismonotonic,omitempty"`
	AggregationTemporality AggregationTemporality `yaml:"aggregationtemporality,omitempty"`
}

Metric - structs for metrics

func NewMetric

func NewMetric(typeName string, unit string, contentType string, metricType string) *Metric

NewMetric - Returns a new metric

func (*Metric) AddDataPoint

func (m *Metric) AddDataPoint(startTime, endTime int64, attributes map[string]interface{}, value float64) *Metric

AddDataPoint - Add a data point for sum or gauge metrics

func (*Metric) AddDistributionDataPoint added in v0.65.0

func (m *Metric) AddDistributionDataPoint(startTime, endTime int64, value float64, count int64, quantiles []*QuantileValue) *Metric

AddDistributionDataPoint - Add a data point for distribution metrics.

func (*Metric) AddHistogramDataPoint added in v0.69.0

func (m *Metric) AddHistogramDataPoint(startTime, endTime int64, value float64, count int64, quantile string, bucket_count []uint64, explicit_bounds []float64) *Metric

AddHistogramDataPoint - Add a data point for histrogram metrics.

func (*Metric) ClearDataPoints

func (m *Metric) ClearDataPoints()

ClearDataPoints - clears the data points

func (*Metric) SetAttribute

func (m *Metric) SetAttribute(key string, value interface{}) *Metric

SetAttribute - Set an attribute on metric

type QuantileValue added in v0.65.0

type QuantileValue struct {
	Quantile string
	Value    float64
}

type Relationship

type Relationship struct {
	Attributes map[string]interface{}
}

Relationship - structs for holding relationship info

func NewRelationship

func NewRelationship() *Relationship

NewRelationship - Returns a new Relationship

func (*Relationship) SetAttribute

func (r *Relationship) SetAttribute(key string, value interface{}) *Relationship

SetAttribute - Set an attribute on log

type Resource

type Resource struct {
	TypeName   string
	Attributes map[string]interface{}
}

Resource - structs for data point

type Span

type Span struct {
	TraceID      string
	SpanID       string
	TraceState   string
	ParentSpanID string
	Name         string
	Kind         SpanKind
	StartTime    int64
	EndTime      int64
	Attributes   map[string]interface{}
	Events       []*SpanEvent
	Links        []*SpanLink
	Status       *SpanStatus
}

Span - structs for a span

func NewSpan

func NewSpan(traceID, spanID, name string) *Span

NewSpan - Returns a new span

func (*Span) NewEvent

func (s *Span) NewEvent(name string, timeStamp int64) *SpanEvent

NewEvent - add a new event to span

func (s *Span) NewLink(traceID, spanID, traceState string) *SpanLink

NewLink - add a new link on span

func (*Span) SetAttribute

func (s *Span) SetAttribute(key string, value interface{}) *Span

SetAttribute - Set an attribute on log

func (*Span) SetStatus

func (s *Span) SetStatus(message string, code SpanStatusCode) *Span

SetStatus - set the span status

type SpanEvent

type SpanEvent struct {
	Name       string
	Timestamp  int64
	Attributes map[string]interface{}
}

SpanEvent - event for span

func (*SpanEvent) SetAttribute

func (s *SpanEvent) SetAttribute(key string, value interface{}) *SpanEvent

SetAttribute - Set an attribute on span event

type SpanKind

type SpanKind int8

SpanKind - spand kinds

type SpanLink struct {
	TraceID    string
	SpanID     string
	TraceState string
	Attributes map[string]interface{}
}

SpanLink - link for span

func (*SpanLink) SetAttribute

func (s *SpanLink) SetAttribute(key string, value interface{}) *SpanLink

SetAttribute - Set an attribute on span link

type SpanStatus

type SpanStatus struct {
	Message string
	Code    SpanStatusCode
}

SpanStatus - status for span

type SpanStatusCode

type SpanStatusCode int8

SpanStatusCode - spand status code

Jump to

Keyboard shortcuts

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