spooltest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package spooltest reads a spool folder back, for tests that prove what ynf wrote: the OTLP JSON lines of every file in it, parsed into spans, events, log records and metric points.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attrs

type Attrs map[string]any

Attrs are an attribute list as a map; an integer is an int64, a float a float64.

func (Attrs) Str

func (a Attrs) Str(k string) string

Str is a string attribute, or "".

type Data

type Data struct {
	Spans  []Span
	Logs   []Log
	Points []Point
	// Raw is every line, as written, for checks over the whole content.
	Raw string
}

Data is everything in a spool folder.

func Read

func Read(t testing.TB, dir string) Data

Read parses every file in dir, closed or open. It fails the test on a line that is not JSON.

func (Data) Events

func (d Data) Events(name string) []Log

Events are the log records with an event name.

func (Data) Named

func (d Data) Named(name string) []Span

Named are the spans with a name, in the order written.

func (Data) Span

func (d Data) Span(id string) (Span, bool)

Span is the span with an id, or false.

type Link struct{ TraceID, SpanID string }

Link is a span link.

type Log

type Log struct {
	Event, TraceID, SpanID, Body string
	Attrs                        Attrs
	Resource                     Attrs
}

Log is one exported log record: an event when it has an event name.

type Point

type Point struct {
	Metric string
	Attrs  Attrs
	Value  float64
}

Point is one metric data point.

type Span

type Span struct {
	Name, TraceID, SpanID, ParentID string
	Attrs                           Attrs
	Links                           []Link
	StatusCode                      int
	Resource                        Attrs
}

Span is one exported span.

Jump to

Keyboard shortcuts

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