sdk

package
v0.0.0-...-967d409 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseReport

func ParseReport(reportData []byte) (report metrics.MetricReport, err error)

ParseReport parses the given JSON data and returns a metrics.MetricReport, or an error.

func SerializeStatus

func SerializeStatus(status stats.Snapshot) (data []byte, err error)

SerializeStatus serializes the given stats.Snapshot in JSON, or returns an error.

Types

type Agent

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

Agent is a convenience type that encapsulates a pipeline.Input and a stats.Provider and provides programmatic interfaces similar to those provided by the standalone agent: init, add report, get status, shutdown. Agent is used by the various language-specific SDK implementations contained under this package.

func NewAgent

func NewAgent(configData []byte, stateDir string) (*Agent, error)

NewAgent creates a new Agent. The configuration is passed as YAML or JSON in configData. The state directory is passed as stateDir. If stateDir is empty, state will not be persisted.

func (*Agent) AddReport

func (agent *Agent) AddReport(report metrics.MetricReport) error

AddReport adds a new usage report.

func (*Agent) AddReportJson

func (agent *Agent) AddReportJson(reportData []byte) error

AddReportJson adds a new usage report after fist unmarshalling it from JSON.

func (*Agent) GetStatus

func (agent *Agent) GetStatus() stats.Snapshot

GetStatus returns a stats.Snapshot object containing current agent status.

func (*Agent) GetStatusJson

func (agent *Agent) GetStatusJson() ([]byte, error)

GetStatusJson returns a stats.Snapshot object serialized as JSON.

func (*Agent) Shutdown

func (agent *Agent) Shutdown() error

Shutdown terminates this agent.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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