annotations

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("annotation not found")

ErrNotFound is returned when an annotation does not exist.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	ID        string    `json:"id"`
	Title     string    `json:"title"`
	Body      string    `json:"body"`
	Author    string    `json:"author"`
	Timestamp time.Time `json:"timestamp"`
	Tags      []string  `json:"tags"` // e.g., "deploy", "incident", "config-change"
	Service   string    `json:"service,omitempty"`
}

Annotation marks an event on a metric timeline.

type Store

type Store struct {
	PersistFunc func(annotations []Annotation) // called after any mutation, if non-nil
	// contains filtered or unexported fields
}

Store provides in-memory storage for annotations.

func NewStore

func NewStore() *Store

NewStore creates a new in-memory annotation store.

func NewStoreWithData

func NewStoreWithData(data []Annotation) *Store

NewStoreWithData creates an annotation store pre-loaded with data.

func (*Store) Create

func (s *Store) Create(a Annotation) error

Create adds an annotation to the store, assigning an ID if empty.

func (*Store) Delete

func (s *Store) Delete(id string) error

Delete removes an annotation by ID.

func (*Store) List

func (s *Store) List(start, end time.Time, service string) ([]Annotation, error)

List returns annotations within the given time range and optional service filter. If service is empty, all services are included.

Jump to

Keyboard shortcuts

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