annotations

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 14 Imported by: 0

README

Annotations

This package provides an HTTP API for interacting with both annotations and streams independently. The HTTP handlers are located in the transport folder. The code for interacting with the sqlite datastore is located in the service.go file. Definitions for the basic types & interfaces associated with annotations and streams used throughout the platform are located in the top-level influxdb package, in the annotation.go file.

Anatomy

An annotation is, at its simplest, a textual note on a range of time. The start and stop time of that range can be the same point in time, which represents an annotation at a single instance. Annotations can also have "stickers". "Stickers" allow users to "tag" the annotation with further granularity for filtering in key-value pairs. Some examples of sticker key-value pairs are: "product: oss", "product: cloud", or "service: tasks", but keys and values can be any string.

Every annotation belongs to a single "stream". A "stream" represents a logical grouping of annotated events. Some examples of stream names are: "incidents", "deployments", or "marketing", but can be any string. A stream can also have a description to further clarify what annotated events may be expected in the stream.

Use

Requested annotations may be filtered by stream name, stickers, and/or time range. Streams may also be retrieved, in order to view their description. If a stream is deleted, all annotations associated with that stream are deleted as well. Every annotation that is created must have a stream associated with it - if a stream name is not provided when creating an annotation, it will be assigned to the default stream.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggingService

func NewLoggingService(logger *zap.Logger, underlying influxdb.AnnotationService) *loggingService

func NewMetricCollectingService

func NewMetricCollectingService(reg prometheus.Registerer, underlying influxdb.AnnotationService, opts ...metric.ClientOptFn) *metricsService

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(store *sqlite.SqlStore) *Service

func (*Service) CreateAnnotations

func (s *Service) CreateAnnotations(ctx context.Context, orgID platform.ID, creates []influxdb.AnnotationCreate) ([]influxdb.AnnotationEvent, error)

CreateAnnotations creates annotations in the database for the provided orgID as defined by the provided list Streams corresponding to the StreamTag property of each annotation are created if they don't already exist as part of a transaction

func (*Service) CreateOrUpdateStream

func (s *Service) CreateOrUpdateStream(ctx context.Context, orgID platform.ID, stream influxdb.Stream) (*influxdb.ReadStream, error)

CreateOrUpdateStream creates a new stream, or updates the description of an existing stream. Doesn't support updating a stream desctription to "". For that use the UpdateStream method.

func (*Service) DeleteAnnotation

func (s *Service) DeleteAnnotation(ctx context.Context, id platform.ID) error

DeleteAnnoation deletes a single annotation by ID

func (*Service) DeleteAnnotations

func (s *Service) DeleteAnnotations(ctx context.Context, orgID platform.ID, delete influxdb.AnnotationDeleteFilter) error

DeleteAnnotations deletes multiple annotations according to the provided filter

func (*Service) DeleteStreamByID

func (s *Service) DeleteStreamByID(ctx context.Context, id platform.ID) error

DeleteStreamByID deletes a single stream by ID. Returns an error if the ID could not be found.

func (*Service) DeleteStreams

func (s *Service) DeleteStreams(ctx context.Context, orgID platform.ID, delete influxdb.BasicStream) error

DeleteStreams is used for deleting multiple streams by name

func (*Service) GetAnnotation

func (s *Service) GetAnnotation(ctx context.Context, id platform.ID) (*influxdb.StoredAnnotation, error)

GetAnnotation gets a single annotation by ID

func (*Service) GetStream

func (s *Service) GetStream(ctx context.Context, id platform.ID) (*influxdb.StoredStream, error)

GetStream gets a single stream by ID

func (*Service) ListAnnotations

func (s *Service) ListAnnotations(ctx context.Context, orgID platform.ID, filter influxdb.AnnotationListFilter) ([]influxdb.StoredAnnotation, error)

ListAnnotations returns a list of annotations from the database matching the filter For time range matching, sqlite is able to compare times with millisecond accuracy

func (*Service) ListStreams

func (s *Service) ListStreams(ctx context.Context, orgID platform.ID, filter influxdb.StreamListFilter) ([]influxdb.StoredStream, error)

ListStreams returns a list of streams matching the filter for the provided orgID.

func (*Service) UpdateAnnotation

func (s *Service) UpdateAnnotation(ctx context.Context, id platform.ID, update influxdb.AnnotationCreate) (*influxdb.AnnotationEvent, error)

UpdateAnnotation updates a single annotation by ID In a similar fashion as CreateAnnotations, if the StreamTag in the update request does not exist, a stream will be created as part of a transaction with the update operation

func (*Service) UpdateStream

func (s *Service) UpdateStream(ctx context.Context, id platform.ID, stream influxdb.Stream) (*influxdb.ReadStream, error)

UpdateStream updates a stream name and/or a description. It is strictly used for updating an existing stream.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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