Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCanonicalField ¶
IsCanonicalField reports whether a mapping target belongs to the canonical model.
func Unwrap ¶ added in v0.1.95
func Unwrap(document map[string]any, rules []UnwrapRule) error
Unwrap rewrites each rule's field in place. A field the document does not carry is skipped — on a scan, a span without it is ordinary — while a field holding something other than the declared shape is an error naming it.
func ValidMappingUnit ¶
func ValidateUnwrap ¶ added in v0.1.95
func ValidateUnwrap(rules []UnwrapRule) error
ValidateUnwrap refuses a rule without a field or with a kind Unwrap does not know.
Types ¶
type PreviewStatus ¶ added in v0.1.95
type PreviewStatus string
PreviewStatus is what a rule did to its field in a sample.
const ( // PreviewApplied: the field was unwrapped; Before and After hold both shapes. PreviewApplied PreviewStatus = "applied" // PreviewFailed: the field holds something other than the declared shape; // Before is that value and Error is exactly what Unwrap raised. PreviewFailed PreviewStatus = "failed" // PreviewMissing: no sampled document carries the field. PreviewMissing PreviewStatus = "missing" // PreviewInvalid: the rule itself is refused by ValidateUnwrap. PreviewInvalid PreviewStatus = "invalid" )
type RulePreview ¶ added in v0.1.95
type RulePreview struct {
Rule UnwrapRule `json:"rule"`
Status PreviewStatus `json:"status"`
// Row is the index of the document the preview was read from.
Row int `json:"row"`
Before any `json:"before,omitempty"`
After any `json:"after,omitempty"`
Error string `json:"error,omitempty"`
}
RulePreview is one rule's effect on the first sampled document that carries its field.
func PreviewUnwrap ¶ added in v0.1.95
func PreviewUnwrap(documents []map[string]any, rules []UnwrapRule) []RulePreview
PreviewUnwrap runs the rules over copies of the documents, in order and through Unwrap itself, and reports for each rule what it did where it first applied. A later rule therefore reads what an earlier one produced, as it does when the provider reads a document; a document a rule fails on stops there, as a scan would stop. The documents given are not modified.
type Span ¶
type Span struct {
TraceID string `json:"traceId"`
SpanID string `json:"spanId"`
ParentID string `json:"parentId,omitempty"`
StartedAt time.Time `json:"startedAt"`
DurationMs float64 `json:"durationMs"`
Service string `json:"service"`
Operation string `json:"operation"`
Status string `json:"status"`
Kind string `json:"kind,omitempty"`
// Scope is the name of the instrumentation scope (library) that recorded the span.
Scope string `json:"scope,omitempty"`
Attributes map[string]any `json:"attributes,omitempty"`
Resource map[string]any `json:"resource,omitempty"`
OTLP json.RawMessage `json:"otlp,omitempty"`
}
func NormalizeMapped ¶
type UnwrapKind ¶ added in v0.1.95
type UnwrapKind string
UnwrapKind is how a span document field is unwrapped before normalization.
const ( // UnwrapKeyValues turns a list of {key, value} entries — Jaeger's tags, an // OTLP attribute list, either one JSON-encoded — into an object keyed by key. UnwrapKeyValues UnwrapKind = "key_values" // UnwrapJSON decodes a field holding JSON text into the value it encodes. UnwrapJSON UnwrapKind = "json" )
type UnwrapRule ¶ added in v0.1.95
type UnwrapRule struct {
Field string `json:"field" yaml:"field"`
As UnwrapKind `json:"as" yaml:"as"`
}
UnwrapRule names one document field and how to unwrap it. Field is a top-level key, or a dotted path into nested objects.