traceyaml

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package traceyaml provides a means to unit test a trace flow, using a YAML file structure that is representative and as close to human-readable as it gets.

This package is tested by unit tests in the above tracing package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns a composite TracerProvider that captures all data written into spans created. The recursively captured span/trace data is gathered into a SpanInfo struct, marshalled into YAML, and written to w. Writer w can optionally implement the zapcore.WriteSyncer interface; if so it'll be used. As soon as a span ends; its list item of YAML will be output to w, as:

# Trace1
- {Trace1 data}

# Trace2
- {Trace2 data}

Types

type Attributes

type Attributes map[string]interface{}

Attributes is a map between an attribute key and value, as defined by OpenTelemetry. If the same key is added twice, the latter value is persisted.

type Error

type Error struct {
	Error       string `json:"error" yaml:"error"`
	EventConfig `json:",inline,omitempty" yaml:",inline,omitempty"`
}

Error represents an error registered using span.RecordError().

type Event

type Event struct {
	Name        string `json:"name" yaml:"name"`
	EventConfig `json:",inline,omitempty" yaml:",inline,omitempty"`
}

Event represents an event registered using span.AddEvent().

type EventConfig

type EventConfig struct {
	Attributes Attributes `json:"attributes,omitempty" yaml:"attributes,omitempty"`
}

EventConfig is created from []trace.EventOption.

type SpanConfig

type SpanConfig struct {
	Attributes Attributes     `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	Links      []trace.Link   `json:"links,omitempty" yaml:"links,omitempty"`
	NewRoot    bool           `json:"newRoot,omitempty" yaml:"newRoot,omitempty"`
	SpanKind   trace.SpanKind `json:"spanKind,omitempty" yaml:"spanKind,omitempty"`
}

SpanConfig is created from []trace.SpanStartOption or []trace.SpanEndOption.

type SpanInfo

type SpanInfo struct {
	SpanName string `json:"spanName" yaml:"spanName"`

	Attributes Attributes `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	Errors     []Error    `json:"errors,omitempty" yaml:"errors,omitempty"`
	Events     []Event    `json:"events,omitempty" yaml:"events,omitempty"`

	StartConfig *SpanConfig `json:"startConfig,omitempty" yaml:"startConfig,omitempty"`
	EndConfig   *SpanConfig `json:"endConfig,omitempty" yaml:"endConfig,omitempty"`

	StatusChanges []Status `json:"statusChanges,omitempty" yaml:"statusChanges,omitempty"`
	NameChanges   []string `json:"nameChanges,omitempty" yaml:"nameChanges,omitempty"`

	Children []*SpanInfo `json:"children,omitempty" yaml:"children,omitempty"`
	// contains filtered or unexported fields
}

SpanInfo captures all events, errors, names, attributes, configuration and children that can be registered to a span in the order they were registered. JSON tags exist on all type such that it can be marshalled to JSON and/or YAML easily.

type Status

type Status struct {
	Code        codes.Code `json:"code" yaml:"code"`
	Description string     `json:"description,omitempty" yaml:"description,omitempty"`
}

Status represents a status update registered using s.Span.SetStatus().

Jump to

Keyboard shortcuts

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