measurement

package
Version: v0.0.0-...-0600186 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Example1NewMeasurements = measurement.NewMeasurement{
	Time:            timeToPointer(time.Now().Format(time.RFC3339)),
	MeasurementType: "P",
	Metrics: map[string]interface{}{
		"P": struct {
			P struct {
				Unit  string `json:"unit"`
				Value int    `json:"value"`
			}
		}{
			P: struct {
				Unit  string `json:"unit"`
				Value int    `json:"value"`
			}{Unit: "W", Value: 71},
		},
	},
}
View Source
var Example2NewMeasurements = measurement.NewMeasurement{
	Time:            timeToPointer(time.Now().Format(time.RFC3339)),
	MeasurementType: "P",
	Metrics: map[string]interface{}{
		"P": struct {
			P1 struct {
				Unit  string `json:"unit"`
				Value int    `json:"value"`
			}
			P2 struct {
				Unit  string `json:"unit"`
				Value int    `json:"value"`
			}
			P3 struct {
				Unit  string `json:"unit"`
				Value int    `json:"value"`
			}
		}{
			P1: struct {
				Unit  string `json:"unit"`
				Value int    `json:"value"`
			}{Unit: "W", Value: 77},
			P2: struct {
				Unit  string `json:"unit"`
				Value int    `json:"value"`
			}{Unit: "W", Value: 43},
			P3: struct {
				Unit  string `json:"unit"`
				Value int    `json:"value"`
			}{Unit: "W", Value: 12},
		},
	},
}
View Source
var ExampleCollection = []measurement.NewMeasurement{
	{
		Time:            timeToPointer(time.Now().Format(time.RFC3339)),
		MeasurementType: "VoltageMeasurement",
		Metrics: map[string]interface{}{
			"VoltageMeasurement": struct {
				Voltage struct {
					Unit  string  `json:"unit"`
					Value float64 `json:"value"`
				} `json:"voltage"`
			}{
				struct {
					Unit  string  `json:"unit"`
					Value float64 `json:"value"`
				}{Unit: "V", Value: 227.32},
			},
		},
	},
	{
		Time:            timeToPointer(time.Now().Format(time.RFC3339)),
		MeasurementType: "c8y_FrequencyMeasurement",
		Metrics: map[string]interface{}{
			"c8y_FrequencyMeasurement": struct {
				Frequency struct {
					Unit  string
					Value float64
				}
			}{
				struct {
					Unit  string
					Value float64
				}{Unit: "Hz", Value: 37.71},
			},
		},
	},
	{
		Time:            timeToPointer(time.Now().Format(time.RFC3339)),
		MeasurementType: "P",
		Metrics: map[string]interface{}{
			"P": struct {
				P1 struct {
					Unit  string `json:"unit"`
					Value int    `json:"value"`
				}
				P2 struct {
					Unit  string `json:"unit"`
					Value int    `json:"value"`
				}
				P3 struct {
					Unit  string `json:"unit"`
					Value int    `json:"value"`
				}
			}{
				P1: struct {
					Unit  string `json:"unit"`
					Value int    `json:"value"`
				}{Unit: "W", Value: 77},
				P2: struct {
					Unit  string `json:"unit"`
					Value int    `json:"value"`
				}{Unit: "W", Value: 43},
				P3: struct {
					Unit  string `json:"unit"`
					Value int    `json:"value"`
				}{Unit: "W", Value: 12},
			},
		},
	},
}

Functions

This section is empty.

Types

type Sender

type Sender struct {
	In      chan measurement.NewMeasurement
	ErrChan chan error
	Stop    chan os.Signal
	Timer   time.Duration
	Client  gomulocity.Gomulocity

	Source measurement.Source
	// contains filtered or unexported fields
}

func NewMeasurementSender

func NewMeasurementSender(client gomulocity.Gomulocity, timer time.Duration, wg *sync.WaitGroup, source measurement.Source) *Sender

func (Sender) Errors

func (s Sender) Errors()

func (Sender) Fill

func (s Sender) Fill()

func (Sender) Send

func (s Sender) Send()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL