json

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(params output.Params) (output.Output, error)

New returns a new JSON output.

Types

type Envelope

type Envelope struct {
	Type   string      `json:"type"`
	Data   interface{} `json:"data"`
	Metric string      `json:"metric,omitempty"`
}

Envelope is the data format we use to export both metrics and metric samples to the JSON file.

func WrapSample

func WrapSample(sample stats.Sample) Envelope

WrapSample is used to package a metric sample in a way that's nice to export to JSON.

type Output

type Output struct {
	output.SampleBuffer
	// contains filtered or unexported fields
}

Output funnels all passed metrics to an (optionally gzipped) JSON file.

func (*Output) Description

func (o *Output) Description() string

Description returns a human-readable description of the output.

func (*Output) Start

func (o *Output) Start() error

Start tries to open the specified JSON file and starts the goroutine for metric flushing. If gzip encoding is specified, it also handles that.

func (*Output) Stop

func (o *Output) Stop() error

Stop flushes any remaining metrics and stops the goroutine.

type Sample

type Sample struct {
	Time  time.Time         `json:"time"`
	Value float64           `json:"value"`
	Tags  *stats.SampleTags `json:"tags"`
}

Sample is the data format for metric sample data in the JSON file.

Jump to

Keyboard shortcuts

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