systemmetrics

package
v0.0.0-...-77e6df5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompressionType

type CompressionType int32

CompressionType describes how the system metrics data is compressed.

const (
	CompressionTypeNone  CompressionType = 0
	CompressionTypeTARGZ CompressionType = 1
	CompressionTypeZIP   CompressionType = 2
	CompressionTypeGZ    CompressionType = 3
	CompressionTypeXZ    CompressionType = 4
)

Valid CompressionType values.

type ConnectionOptions

type ConnectionOptions struct {
	DialOpts timber.DialCedarOptions
	Client   http.Client
}

ConnectionOptions contains the options needed to create a grpc connection with cedar.

type DataFormat

type DataFormat int32

DataFormat describes how the time series data is stored.

const (
	DataFormatText DataFormat = 0
	DataFormatFTDC DataFormat = 1
	DataFormatBSON DataFormat = 2
	DataFormatJSON DataFormat = 3
	DataFormatCSV  DataFormat = 4
)

Valid DataFormat values.

type MetricDataOpts

type MetricDataOpts struct {
	Id         string
	MetricType string
	Format     DataFormat
}

MetricDataOpts describes the data being streamed or sent to cedar.

type SchemaType

type SchemaType int32

SchemaType describes how the time series data is stored.

const (
	SchemaTypeRawEvents             SchemaType = 0
	SchemaTypeCollapsedEvents       SchemaType = 1
	SchemaTypeIntervalSummarization SchemaType = 2
	SchemaTypeHistogram             SchemaType = 3
)

Valid SchemaType values.

type StreamOpts

type StreamOpts struct {
	FlushInterval time.Duration
	NoTimedFlush  bool
	MaxBufferSize int
}

StreamOpts allow maximum buffer size and the maximum time between flushes to be specified. If NoTimedFlush is true, then the timed flush will not occur.

type SystemMetricsClient

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

SystemMetricsClient provides a wrapper around the grpc client for sending system metrics data to cedar.

func NewSystemMetricsClient

func NewSystemMetricsClient(ctx context.Context, opts ConnectionOptions) (*SystemMetricsClient, error)

NewSystemMetricsClient returns a SystemMetricsClient to send system metrics data to cedar. If authentication credentials (username and apikey) are not specified, then an insecure connection will be established with the specified address and port.

func NewSystemMetricsClientWithExistingConnection

func NewSystemMetricsClientWithExistingConnection(ctx context.Context, clientConn *grpc.ClientConn) (*SystemMetricsClient, error)

NewSystemMetricsClientWithExistingConnection returns a SystemMetricsClient to send system metrics data to cedar, using the provided client connection.

func (*SystemMetricsClient) AddSystemMetrics

func (s *SystemMetricsClient) AddSystemMetrics(ctx context.Context, opts MetricDataOpts, data []byte) error

AddSystemMetrics sends the given byte slice to the cedar backend for the system metrics object with the corresponding id.

func (*SystemMetricsClient) CloseClient

func (s *SystemMetricsClient) CloseClient() error

CloseClient closes out the client connection if one was created by NewSystemMetricsClient. A provided client connection will not be closed.

func (*SystemMetricsClient) CloseSystemMetrics

func (s *SystemMetricsClient) CloseSystemMetrics(ctx context.Context, id string, success bool) error

CloseMetrics will add the completed_at timestamp to the system metrics object in cedar with the corresponding id, as well as the success boolean.

func (*SystemMetricsClient) CreateSystemMetricsRecord

func (s *SystemMetricsClient) CreateSystemMetricsRecord(ctx context.Context, opts SystemMetricsOptions) (string, error)

CreateSystemMetricsRecord creates a system metrics metadata object in cedar with the provided info, along with setting the created_at timestamp.

func (*SystemMetricsClient) StreamSystemMetrics

func (s *SystemMetricsClient) StreamSystemMetrics(ctx context.Context, dataOpts MetricDataOpts, streamOpts StreamOpts) (*SystemMetricsWriteCloser, error)

StreamSystemMetrics returns a buffered WriteCloser that can be used to stream system metrics data to cedar.

type SystemMetricsOptions

type SystemMetricsOptions struct {
	// Unique information to identify the system metrics object.
	Project   string `bson:"project" json:"project" yaml:"project"`
	Version   string `bson:"version" json:"version" yaml:"version"`
	Variant   string `bson:"variant" json:"variant" yaml:"variant"`
	TaskName  string `bson:"task_name" json:"task_name" yaml:"task_name"`
	TaskId    string `bson:"task_id" json:"task_id" yaml:"task_id"`
	Execution int32  `bson:"execution" json:"execution" yaml:"execution"`
	Mainline  bool   `bson:"mainline" json:"mainline" yaml:"mainline"`

	// Data storage information for this object
	Compression CompressionType `bson:"compression" json:"compression" yaml:"compression"`
	Schema      SchemaType      `bson:"schema" json:"schema" yaml:"schema"`
}

SystemMetricsOptions support the use and creation of a system metrics object.

type SystemMetricsWriteCloser

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

SystemMetricsWriteCloser is a wrapper around a stream of system metrics data that implements buffering with timed flushes and the WriteCloser interface.

func (*SystemMetricsWriteCloser) Close

func (s *SystemMetricsWriteCloser) Close() error

Close flushes any remaining data in the buffer and closes the stream. If the writer was previously closed, this returns an error.

func (*SystemMetricsWriteCloser) Write

func (s *SystemMetricsWriteCloser) Write(data []byte) (int, error)

Write adds provided data to the buffer, flushing it if it exceeds its max size. Write will fail if the writer was previously closed or if a timed flush encountered an error.

Jump to

Keyboard shortcuts

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