metrics

package
v0.1.0-M4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0, EPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MessagesParameterInvalid defines the invalid payload code.
	MessagesParameterInvalid MessageErrorCode = "messages:parameter.invalid"
	// MessagesExecutionFailed defines the execution failed code.
	MessagesExecutionFailed MessageErrorCode = "messages:execution.failed"

	// StatusBadRequest defines the bad request status code.
	StatusBadRequest = http.StatusBadRequest
	// StatusInternalError defines the internal server error status code.
	StatusInternalError = http.StatusInternalServerError
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration struct {
	time.Duration
}

Duration is used to support duration string un-marshalling to time.Duration.

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON supports marshalling to '50s' string format.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON supports '50s' string format.

type Filter

type Filter struct {
	ID         []string `json:"id"`
	Originator string   `json:"originator"`
}

Filter defines the type of metric data to be reported.

type Measurement

type Measurement struct {
	ID    string  `json:"id"`
	Value float64 `json:"value"`
}

Measurement represents a measured value per metric ID.

type MessageError

type MessageError struct {
	ErrorCode MessageErrorCode `json:"error"`
	Status    int              `json:"status"`
}

MessageError contains a message error data.

func NewMessageInternalError

func NewMessageInternalError() *MessageError

NewMessageInternalError creates internal server message error.

func NewMessageParameterInvalidError

func NewMessageParameterInvalidError() *MessageError

NewMessageParameterInvalidError creates invalid parameter message error.

type MessageErrorCode

type MessageErrorCode string

MessageErrorCode defines the error code.

type MetricData

type MetricData struct {
	Snapshot  []OriginatorMeasurements `json:"snapshot"`
	Timestamp int64                    `json:"timestamp"`
}

MetricData contains a snapshot with all originators' measurements collected at a concrete time.

type Metrics

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

Metrics feature implementation.

func NewMetrics

func NewMetrics(initialRequest *Request) *Metrics

NewMetrics constructs Metrics with an initial request.

func (*Metrics) Close

func (m *Metrics) Close()

Close Metrics by stopping the provider and disconnecting from the Ditto endpoint and cleaning up used resources.

func (*Metrics) Update

func (m *Metrics) Update(mqttClient MQTT.Client, edgeConfig *client.EdgeConfiguration)

Update Metrics configuration and connect to the Ditto endpoint.

type OriginatorMeasurements

type OriginatorMeasurements struct {
	Originator   string        `json:"originator"`
	Measurements []Measurement `json:"measurements"`
}

OriginatorMeasurements represents all the measurements collected per originator.

type Request

type Request struct {
	Frequency Duration
	Filter    []Filter
	// contains filtered or unexported fields
}

Request defines the metric data request with defined frequency.

Jump to

Keyboard shortcuts

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