ddstructs

package
v0.0.0-...-7251252 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: AGPL-3.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2016-2020 Datadog, Inc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIMetricType

type APIMetricType string

APIMetricType represents an API metric type

const (
	APIGaugeType APIMetricType = "gauge"
	APIRateType  APIMetricType = "rate"
	APICountType APIMetricType = "count"
)

Enumeration of the existing API metric types

type Float64MaybeStringJSON

type Float64MaybeStringJSON float64

func (*Float64MaybeStringJSON) UnmarshalJSON

func (f *Float64MaybeStringJSON) UnmarshalJSON(buf []byte) error

UnmarshalJSON is a custom unmarshaller for Point (used for testing)

type InstallMethod

type InstallMethod struct {
	Tool             *string `json:"tool"`
	ToolVersion      string  `json:"tool_version"`
	InstallerVersion *string `json:"installer_version"`
}

InstallMethod is metadata about the agent's installation

type LogsMeta

type LogsMeta struct {
	Transport string `json:"transport"`
}

LogsMeta is metadata about the host's logs agent

type Meta

type Meta struct {
	SocketHostname string   `json:"socket-hostname"`
	Timezones      []string `json:"timezones"`
	SocketFqdn     string   `json:"socket-fqdn"`
	EC2Hostname    string   `json:"ec2-hostname"`
	Hostname       string   `json:"hostname"`
	HostAliases    []string `json:"host_aliases"`
	InstanceID     string   `json:"instance-id"`
	AgentHostname  string   `json:"agent-hostname,omitempty"`
}

Meta is the metadata nested under the meta key

type NetworkMeta

type NetworkMeta struct {
	ID string `json:"network-id"`
}

NetworkMeta is metadata about the host's network

type Payload

type Payload struct {
	Os               string            `json:"os"`
	AgentFlavor      string            `json:"agent-flavor"`
	PythonVersion    string            `json:"python"`
	SystemStats      *systemStats      `json:"systemStats"`
	Meta             *Meta             `json:"meta"`
	HostTags         *Tags             `json:"host-tags"`
	ContainerMeta    map[string]string `json:"container-meta,omitempty"`
	NetworkMeta      *NetworkMeta      `json:"network"`
	LogsMeta         *LogsMeta         `json:"logs"`
	InstallMethod    *InstallMethod    `json:"install-method"`
	InternalHostname string            `json:"internalHostname"`
}

Payload handles the JSON unmarshalling of the metadata payload

type Point

type Point struct {
	Ts    Float64MaybeStringJSON //nolint:stylecheck
	Value Float64MaybeStringJSON
}

Point represents a metric value at a specific time

func (*Point) MarshalJSON

func (p *Point) MarshalJSON() ([]byte, error)

MarshalJSON return a Point as an array of value (to be compatible with v1 API) FIXME(maxime): to be removed when v2 endpoints are available Note: it is not used with jsoniter, encodePoints takes over

func (*Point) UnmarshalJSON

func (p *Point) UnmarshalJSON(buf []byte) error

UnmarshalJSON is a custom unmarshaller for Point (used for testing)

type Serie

type Serie struct {
	Name           string        `json:"metric"`
	Points         []Point       `json:"points"`
	Tags           []string      `json:"tags"`
	Host           string        `json:"host"`
	Device         string        `json:"device,omitempty"` // FIXME(olivier): remove as soon as the v1 API can handle `device` as a regular tag
	MType          APIMetricType `json:"type"`
	Interval       int64         `json:"interval"`
	SourceTypeName string        `json:"source_type_name,omitempty"`
}

Serie holds a timeseries (w/ json serialization to DD API format)

type Series

type Series []*Serie

Series represents a list of Serie ready to be serialize

type ServiceCheck

type ServiceCheck struct {
	CheckName string             `json:"check"`
	Host      string             `json:"host_name"`
	TS        int64              `json:"timestamp"`
	Status    ServiceCheckStatus `json:"status"`
	Message   string             `json:"message"`
	Tags      []string           `json:"tags"`
}

ServiceCheck holds a service check (w/ serialization to DD api format)

type ServiceCheckStatus

type ServiceCheckStatus int

ServiceCheckStatus represents the status associated with a service check

const (
	ServiceCheckOK       ServiceCheckStatus = iota
	ServiceCheckWarning  ServiceCheckStatus = 1
	ServiceCheckCritical ServiceCheckStatus = 2
	ServiceCheckUnknown  ServiceCheckStatus = 3
)

Enumeration of the existing service check statuses, and their values

func GetServiceCheckStatus

func GetServiceCheckStatus(val int) (ServiceCheckStatus, error)

GetServiceCheckStatus returns the ServiceCheckStatus from and integer value

func (ServiceCheckStatus) String

func (s ServiceCheckStatus) String() string

String returns a string representation of ServiceCheckStatus

type ServiceChecks

type ServiceChecks []*ServiceCheck

ServiceChecks represents a list of service checks ready to be serialize

type Tags

type Tags struct {
	System              []string `json:"system,omitempty"`
	GoogleCloudPlatform []string `json:"google cloud platform,omitempty"`
}

Tags is unexported in original code, we've exported it to make testing easier.

Jump to

Keyboard shortcuts

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