Help us shape the future of Go! Take the 2026 Go Developer Survey

otlprecord

package
v0.6.49 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package otlprecord reads OTLP log records as backplane stores them: attributes as JSON, bodies as text, times, bounded text. The audit and error ingests share it.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidText = errors.New("record contains invalid PostgreSQL text")

ErrInvalidText: PostgreSQL text and jsonb cannot store NUL or invalid UTF-8; such a record is rejected before any transaction.

Functions

func AnyJSON

func AnyJSON(v *commonpb.AnyValue) (any, error)

AnyJSON is an OTLP value as JSON: bytes as base64, a key-value list as an object.

func AttributesJSON

func AttributesJSON(attrs []*commonpb.KeyValue) (json.RawMessage, error)

AttributesJSON is attrs as a JSON object.

func BodyText

func BodyText(body *commonpb.AnyValue) (string, error)

BodyText is a record's body as text: a string as is, anything else as JSON.

func BoolAttr

func BoolAttr(attrs []*commonpb.KeyValue, key string) (bool, bool)

BoolAttr is the bool value of key among attrs; false, false without.

func CutBytes

func CutBytes(s string, limit int) string

CutBytes bounds s to limit bytes on a rune boundary.

func CutRunes

func CutRunes(s string, limit int) string

CutRunes bounds s to limit runes.

func HasAttr

func HasAttr(attrs []*commonpb.KeyValue, key string) bool

HasAttr reports whether key is among attrs.

func RecordTime

func RecordTime(record *logspb.LogRecord, now time.Time) time.Time

RecordTime is the record's time, else its observed time, else now.

func SeverityText

func SeverityText(record *logspb.LogRecord) string

SeverityText is the record's severity text, else its number's name.

func StringAttr

func StringAttr(attrs []*commonpb.KeyValue, key string) string

StringAttr is the string value of key among attrs, "" without.

func ValidText

func ValidText(s string) bool

ValidText reports whether s can be stored as PostgreSQL text.

Types

This section is empty.

Jump to

Keyboard shortcuts

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