api

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContentTypeFlat represents flat buffer content type.
	ContentTypeFlat = "application/flatbuffer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataQuery added in v0.0.2

type DataQuery interface {
	// DataQuery queries time series data from database by given ql.
	// LinQL ref: https://lindb.io/guide/lin-ql.html#metric-query
	// Example: select heap_objects from lindb.runtime.mem where 'role' in ('Broker') group by node
	DataQuery(ctx context.Context, database, ql string) (*models.ResultSet, error)
	// MetadataQuery queries metric metadata from database by given ql.
	// LinQL ref: https://lindb.io/guide/lin-ql.html#metric-meta-query
	// Example: show fields from lindb.runtime.mem
	MetadataQuery(ctx context.Context, database, ql string) (*models.Metadata, error)
}

DataQuery represents data query client for query time series data from database.

func NewDataQuery added in v0.0.2

func NewDataQuery(endpoint string, httpOptions *httppkg.Options) DataQuery

NewDataQuery creates a data query client.

type Field

type Field interface {
	// contains filtered or unexported methods
}

Field represents field interface.

func NewFirst

func NewFirst(name string, v float64) Field

NewFirst creates a First field.

func NewHistogram

func NewHistogram(min, max, sum, count float64, values, bounds []float64) Field

NewHistogram creates a Histogram field.

func NewLast

func NewLast(name string, v float64) Field

NewLast creates a Last field.

func NewMax

func NewMax(name string, v float64) Field

NewMax creates a Max field.

func NewMin

func NewMin(name string, v float64) Field

NewMin creates a Min field.

func NewSum

func NewSum(name string, v float64) Field

NewSum creates a Sum filed.

type First

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

First represents first field, implements Field interface.

type Histogram

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

Histogram represents histogram field(compound field).

type Last

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

Last represents last field, implements Field interface.

type Max

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

Max represents max field, implements Field interface.

type Min

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

Min represents min field, implements Field interface.

type Point

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

Point represents time series data points with name/tags/fields etc.

func NewPoint

func NewPoint(metricName string) *Point

NewPoint creates a data point with name.

func (*Point) AddField

func (p *Point) AddField(field Field) *Point

AddField adds field.

func (*Point) AddTag

func (p *Point) AddTag(key, value string) *Point

AddTag adds tag(key,value).

func (*Point) Fields

func (p *Point) Fields() []Field

Fields returns fields.

func (*Point) MetricName

func (p *Point) MetricName() string

MetricName returns metric name.

func (*Point) Namespace

func (p *Point) Namespace() string

Namespace returns namespace.

func (*Point) SetNamespace

func (p *Point) SetNamespace(namespace string) *Point

SetNamespace sets namespace.

func (*Point) SetTimestamp

func (p *Point) SetTimestamp(timestamp time.Time) *Point

SetTimestamp sets timestamp.

func (*Point) Tags

func (p *Point) Tags() map[string]string

Tags returns tags.

func (*Point) Timestamp

func (p *Point) Timestamp() time.Time

Timestamp returns timestamp.

func (*Point) Valid

func (p *Point) Valid() bool

Valid returns if point is valid.

type Sum

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

Sum represents sum field, implements Field interface.

type Write

type Write interface {
	// AddPoint adds a time series point into buffer.
	AddPoint(ctx context.Context, point *Point)
	// Errors watches error in background goroutine.
	Errors() <-chan error
	// Close closes write client, before close try to send pending points.
	Close()
}

Write represents write client for writing time series data asynchronously.

func NewWrite

func NewWrite(endpoint, database string, writeOptions *WriteOptions, httpOptions *httppkg.Options) Write

NewWrite creates an asynchronously write client.

type WriteOptions

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

WriteOptions represents write configuration.

func DefaultWriteOptions

func DefaultWriteOptions() *WriteOptions

DefaultWriteOptions creates a WriteOptions with default.

func (*WriteOptions) AddDefaultTag

func (opt *WriteOptions) AddDefaultTag(key, value string) *WriteOptions

AddDefaultTag adds default tag.

func (*WriteOptions) BatchSize

func (opt *WriteOptions) BatchSize() int

BatchSize returns the number of batch size in single write request.

func (*WriteOptions) DefaultTags

func (opt *WriteOptions) DefaultTags() map[string]string

DefaultTags returns the default tags for all metrics.

func (*WriteOptions) FlushInterval

func (opt *WriteOptions) FlushInterval() int64

FlushInterval returns the flush interval(ms).

func (*WriteOptions) MaxRetries

func (opt *WriteOptions) MaxRetries() int

MaxRetries returns maximum count of retry attempts of failed write.

func (*WriteOptions) RetryBufferLimit

func (opt *WriteOptions) RetryBufferLimit() int

RetryBufferLimit returns maximum number of write request to keep for retry.

func (*WriteOptions) SetBatchSize

func (opt *WriteOptions) SetBatchSize(batchSize int) *WriteOptions

SetBatchSize sets batch size in single write request.

func (*WriteOptions) SetFlushInterval

func (opt *WriteOptions) SetFlushInterval(interval int64) *WriteOptions

SetFlushInterval sets flush interval(ms).

func (*WriteOptions) SetMaxRetries

func (opt *WriteOptions) SetMaxRetries(maxRetries int) *WriteOptions

SetMaxRetries sets maximum count of retry attempts of failed write.

func (*WriteOptions) SetRetryBufferLimit

func (opt *WriteOptions) SetRetryBufferLimit(retryBufferLimit int) *WriteOptions

SetRetryBufferLimit sets maximum number of write request to keep for retry.

func (*WriteOptions) SetUseGZip

func (opt *WriteOptions) SetUseGZip(useGZip bool) *WriteOptions

SetUseGZip sets whether to use GZip compress write data.

func (*WriteOptions) UseGZip

func (opt *WriteOptions) UseGZip() bool

UseGZip returns whether to use GZip compress write data.

Jump to

Keyboard shortcuts

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