spooltest

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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