Documentation
¶
Index ¶
- func AttributesToMap(attributes pcommon.Map) map[string]string
- func ConvertEvents(events ptrace.SpanEventSlice) ([]time.Time, []string, []map[string]string)
- func ConvertExemplars(exemplars pmetric.ExemplarSlice) (clickhouse.ArraySet, clickhouse.ArraySet, clickhouse.ArraySet, ...)
- func ConvertLinks(links ptrace.SpanLinkSlice) ([]string, []string, []string, []map[string]string)
- func ConvertSliceToArraySet[T any](slice []T) clickhouse.ArraySet
- func ConvertValueAtQuantile(valueAtQuantile pmetric.SummaryDataPointValueAtQuantileSlice) (clickhouse.ArraySet, clickhouse.ArraySet)
- func GetValue(intValue int64, floatValue float64, dataType any) float64
- func SpanIDToHexOrEmptyString(id pcommon.SpanID) string
- func SpanKindStr(sk ptrace.SpanKind) string
- func StatusCodeStr(sk ptrace.StatusCode) string
- func TraceIDToHexOrEmptyString(id pcommon.TraceID) string
- type Attribute
- type Body
- type OTLPLogExportRequest
- type OTLPMetricExportRequest
- type OTLPTraceExportRequest
- type Resource
- type Scope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttributesToMap ¶
func ConvertEvents ¶
func ConvertExemplars ¶
func ConvertExemplars(exemplars pmetric.ExemplarSlice) (clickhouse.ArraySet, clickhouse.ArraySet, clickhouse.ArraySet, clickhouse.ArraySet, clickhouse.ArraySet)
func ConvertLinks ¶
func ConvertSliceToArraySet ¶
func ConvertSliceToArraySet[T any](slice []T) clickhouse.ArraySet
func ConvertValueAtQuantile ¶
func ConvertValueAtQuantile(valueAtQuantile pmetric.SummaryDataPointValueAtQuantileSlice) (clickhouse.ArraySet, clickhouse.ArraySet)
func GetValue ¶
https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/metrics/v1/metrics.proto#L358 define two types for one datapoint value, clickhouse only use one value of float64 to store them
func SpanIDToHexOrEmptyString ¶
SpanIDToHexOrEmptyString returns a hex string from SpanID. An empty string is returned, if SpanID is empty.
func SpanKindStr ¶
SpanKindStr returns a string representation of the SpanKind as it's defined in the proto. The function provides old behavior of ptrace.SpanKind.String() to support graceful adoption of https://github.com/open-telemetry/opentelemetry-collector/pull/6250.
func StatusCodeStr ¶
func StatusCodeStr(sk ptrace.StatusCode) string
StatusCodeStr returns a string representation of the StatusCode as it's defined in the proto. The function provides old behavior of ptrace.StatusCode.String() to support graceful adoption of https://github.com/open-telemetry/opentelemetry-collector/pull/6250.
func TraceIDToHexOrEmptyString ¶
TraceIDToHexOrEmptyString returns a hex string from TraceID. An empty string is returned, if TraceID is empty.
Types ¶
type Attribute ¶
type Attribute struct {
Key string `json:"key"`
Value struct {
StringValue string `json:"stringValue"`
} `json:"value,omitempty"`
Value0 struct {
BoolValue bool `json:"boolValue"`
} `json:"value,omitempty"`
Value1 struct {
IntValue string `json:"intValue"`
} `json:"value,omitempty"`
Value2 struct {
DoubleValue float64 `json:"doubleValue"`
} `json:"value,omitempty"`
Value3 struct {
ArrayValue struct {
Values []struct {
StringValue string `json:"stringValue"`
} `json:"values"`
} `json:"arrayValue"`
} `json:"value,omitempty"`
Value4 struct {
KvlistValue struct {
Values []struct {
Key string `json:"key"`
Value struct {
StringValue string `json:"stringValue"`
} `json:"value"`
} `json:"values"`
} `json:"kvlistValue"`
} `json:"value,omitempty"`
}
type OTLPLogExportRequest ¶
type OTLPLogExportRequest struct {
ResourceLogs []struct {
Resource `json:"resource"`
ScopeLogs []struct {
SchemaURL string `json:"schemaUrl,omitempty"`
Scope Scope `json:"scope"`
LogRecords []struct {
TimeUnixNano string `json:"timeUnixNano"`
SeverityNumber int `json:"severityNumber"`
SeverityText string `json:"severityText"`
ServiceName string `json:"serviceName"`
Flags int `json:"flags,omitempty"`
DroppedAttributesCount int `json:"droppedAttributesCount"`
TraceID string `json:"traceId"`
SpanID string `json:"spanId"`
Body Body `json:"body"`
Attributes []Attribute `json:"attributes"`
} `json:"logRecords"`
} `json:"scopeLogs"`
} `json:"resourceLogs"`
}
type OTLPMetricExportRequest ¶
type OTLPMetricExportRequest struct {
ResourceMetrics []struct {
Resource struct {
Attributes []struct {
Key string `json:"key"`
Value struct {
StringValue string `json:"stringValue"`
} `json:"value"`
} `json:"attributes"`
} `json:"resource"`
ScopeMetrics []struct {
Scope struct{} `json:"scope"`
Metrics []struct {
Name string `json:"name"`
Unit string `json:"unit"`
Sum struct {
DataPoints []struct {
Attributes []struct {
Key string `json:"key"`
Value struct {
StringValue string `json:"stringValue"`
} `json:"value"`
} `json:"attributes"`
StartTimeUnixNano string `json:"startTimeUnixNano"`
TimeUnixNano string `json:"timeUnixNano"`
AsInt string `json:"asInt"`
} `json:"dataPoints"`
AggregationTemporality int `json:"aggregationTemporality"`
IsMonotonic bool `json:"isMonotonic"`
} `json:"sum"`
} `json:"metrics"`
} `json:"scopeMetrics"`
} `json:"resourceMetrics"`
}
NOTE(jm): we have to define this here, because the `pmetricotlp.ExportRequest` type is actually a hidden type and means we would have to define this otherwise.
Instead, we use https://mholt.github.io/json-to-go/ to generate the types from the example JSON in the OTEL examples here: https://opentelemetry.io/docs/specs/otel/protocol/file-exporter/#examples
type OTLPTraceExportRequest ¶
type OTLPTraceExportRequest struct {
ResourceSpans []struct {
Resource struct {
Attributes []struct {
Key string `json:"key"`
Value struct {
StringValue string `json:"stringValue"`
} `json:"value"`
} `json:"attributes"`
} `json:"resource"`
ScopeSpans []struct {
Scope struct {
Name string `json:"name"`
Version string `json:"version"`
Attributes []struct {
Key string `json:"key"`
Value struct {
StringValue string `json:"stringValue"`
} `json:"value"`
} `json:"attributes"`
} `json:"scope"`
Spans []struct {
TraceID string `json:"traceId"`
SpanID string `json:"spanId"`
ParentSpanID string `json:"parentSpanId"`
Name string `json:"name"`
StartTimeUnixNano string `json:"startTimeUnixNano"`
EndTimeUnixNano string `json:"endTimeUnixNano"`
Kind int `json:"kind"`
Attributes []struct {
Key string `json:"key"`
Value struct {
StringValue string `json:"stringValue"`
} `json:"value"`
} `json:"attributes"`
} `json:"spans"`
} `json:"scopeSpans"`
} `json:"resourceSpans"`
}
NOTE(jm): we have to define this here, because the `ptraceotlp.ExportRequest` type is actually a hidden type and means we would have to define this otherwise.
Instead, we use https://mholt.github.io/json-to-go/ to generate the types from the example JSON in the OTEL examples here: https://github.com/open-telemetry/opentelemetry-proto/blob/main/examples/trace.json