acceptor

package
v1.28.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package acceptor provides marshaling structs for Instana serverless acceptor API

Index

Constants

This section is empty.

Variables

View Source
var ErrMalformedProxyURL = errors.New("malformed URL value found in INSTANA_ENDPOINT_PROXY, ignoring")

ErrMalformedProxyURL is returned by NewHTTPClient() when the INSTANA_ENDPOINT_PROXY= env var contains a malformed URL string

Functions

func NewHTTPClient added in v1.20.0

func NewHTTPClient(timeout time.Duration) (*http.Client, error)

NewHTTPClient returns an http.Client configured for sending requests to the Instana serverless acceptor. If INSTANA_ENDPOINT_PROXY= env var is populated with a vaild URL, the returned client will use it as an HTTP proxy. If the value is malformed, this setting is ignored and ErrMalformedProxyURL error is returned. The returned http.Client instance in this case is usable, but does not use a proxy to connect to the acceptor.

Types

type AWSContainerLimits

type AWSContainerLimits struct {
	CPU    int `json:"cpu"`
	Memory int `json:"memory"`
}

AWSContainerLimits is used to send container limits (CPU, memory) to the acceptor plugin

type DockerBlockIOStatsDelta added in v1.19.0

type DockerBlockIOStatsDelta struct {
	Read  int `json:"blk_read,omitempty"`
	Write int `json:"blk_write,omitempty"`
}

DockerBlockIOStatsDelta represents the difference between two block I/O usage stats

func NewDockerBlockIOStatsDelta added in v1.19.0

func NewDockerBlockIOStatsDelta(prev, next docker.ContainerBlockIOStats) *DockerBlockIOStatsDelta

NewDockerBlockIOStatsDelta sums up block I/O reads and writes and calculates the difference between two stat snapshots. It returns nil if aggregated stats are equal.

func (DockerBlockIOStatsDelta) IsZero added in v1.19.0

func (d DockerBlockIOStatsDelta) IsZero() bool

IsZero returns true if both usage stats are equal

type DockerCPUStatsDelta added in v1.19.0

type DockerCPUStatsDelta struct {
	Total           float64 `json:"total_usage,omitempty"`
	User            float64 `json:"user_usage,omitempty"`
	System          float64 `json:"system_usage,omitempty"`
	ThrottlingCount int     `json:"throttling_count,omitempty"`
	ThrottlingTime  int     `json:"throttling_time,omitempty"`
}

DockerCPUStatsDelta represents the difference between two CPU usage stats

func NewDockerCPUStatsDelta added in v1.19.0

func NewDockerCPUStatsDelta(prev, next docker.ContainerCPUStats) *DockerCPUStatsDelta

NewDockerCPUStatsDelta calculates the difference between two CPU usage stats. It returns nil if stats are equal.

type DockerData

type DockerData struct {
	ID               string                             `json:"Id"`
	Command          string                             `json:"Command"`
	CreatedAt        time.Time                          `json:"Created"`
	StartedAt        time.Time                          `json:"Started"`
	Image            string                             `json:"Image"`
	Labels           aws.ContainerLabels                `json:"Labels,omitempty"`
	Ports            string                             `json:"Ports,omitempty"`
	PortBindings     string                             `json:"PortBindings,omitempty"`
	Names            []string                           `json:"Names,omitempty"`
	NetworkMode      string                             `json:"NetworkMode,omitempty"`
	StorageDriver    string                             `json:"StorageDriver,omitempty"`
	DockerVersion    string                             `json:"docker_version,omitempty"`
	DockerAPIVersion string                             `json:"docker_api_version,omitempty"`
	Network          *DockerNetworkAggregatedStatsDelta `json:"network,omitempty"`
	CPU              *DockerCPUStatsDelta               `json:"cpu,omitempty"`
	Memory           *DockerMemoryStatsUpdate           `json:"memory,omitempty"`
	BlockIO          *DockerBlockIOStatsDelta           `json:"blkio,omitempty"`
}

DockerData is a representation of a Docker container for com.instana.plugin.docker plugin

type DockerMemoryStatsUpdate added in v1.19.0

type DockerMemoryStatsUpdate struct {
	ActiveAnon   *int `json:"active_anon,omitempty"`
	ActiveFile   *int `json:"active_file,omitempty"`
	InactiveAnon *int `json:"inactive_anon,omitempty"`
	InactiveFile *int `json:"inactive_file,omitempty"`
	TotalCache   *int `json:"total_cache,omitempty"`
	TotalRss     *int `json:"total_rss,omitempty"`
	Usage        *int `json:"usage,omitempty"`
	MaxUsage     *int `json:"max_usage,omitempty"`
	Limit        *int `json:"limit,omitempty"`
}

DockerMemoryStatsUpdate represents the memory stats that have changed since the last measurement

func NewDockerMemoryStatsUpdate added in v1.19.0

func NewDockerMemoryStatsUpdate(prev, next docker.ContainerMemoryStats) *DockerMemoryStatsUpdate

NewDockerMemoryStatsUpdate returns the fields that have been updated since the last measurement. It returns nil if nothing has changed.

type DockerNetworkAggregatedStatsDelta added in v1.19.0

type DockerNetworkAggregatedStatsDelta struct {
	Rx *DockerNetworkStatsDelta `json:"rx,omitempty"`
	Tx *DockerNetworkStatsDelta `json:"tx,omitempty"`
}

DockerNetworkAggregatedStatsDelta represents the difference between two network interface stats

func NewDockerNetworkAggregatedStatsDelta added in v1.19.0

func NewDockerNetworkAggregatedStatsDelta(prev, next map[string]docker.ContainerNetworkStats) *DockerNetworkAggregatedStatsDelta

NewDockerNetworkAggregatedStatsDelta calculates the aggregated difference between two snapshots of network interface stats. It returns nil if aggregated stats for both snapshots are equal.

type DockerNetworkStatsDelta added in v1.19.0

type DockerNetworkStatsDelta struct {
	Bytes   int `json:"bytes,omitempty"`
	Packets int `json:"packets,omitempty"`
	Dropped int `json:"dropped,omitempty"`
	Errors  int `json:"errors,omitempty"`
}

DockerNetworkStatsDelta represents the difference between two network interface stats

func (DockerNetworkStatsDelta) IsZero added in v1.19.0

func (d DockerNetworkStatsDelta) IsZero() bool

IsZero returns true is there is no difference between interface stats

type ECSContainerData

type ECSContainerData struct {
	Runtime               string             `json:"runtime"`
	Instrumented          bool               `json:"instrumented,omitempty"`
	DockerID              string             `json:"dockerId"`
	DockerName            string             `json:"dockerName"`
	ContainerName         string             `json:"containerName"`
	Image                 string             `json:"image"`
	ImageID               string             `json:"imageId"`
	TaskARN               string             `json:"taskArn"`
	TaskDefinition        string             `json:"taskDefinition"`
	TaskDefinitionVersion string             `json:"taskDefinitionVersion"`
	ClusterARN            string             `json:"clusterArn"`
	DesiredStatus         string             `json:"desiredStatus"`
	KnownStatus           string             `json:"knownStatus"`
	Limits                AWSContainerLimits `json:"limits"`
	CreatedAt             time.Time          `json:"createdAt"`
	StartedAt             time.Time          `json:"startedAt"`
	Type                  string             `json:"type"`
}

ECSContainerData is a representation of an ECS container for com.instana.plugin.aws.ecs.container plugin

type ECSTaskData

type ECSTaskData struct {
	TaskARN               string                 `json:"taskArn"`
	ClusterARN            string                 `json:"clusterArn"`
	AvailabilityZone      string                 `json:"availabilityZone,omitempty"`
	InstanaZone           string                 `json:"instanaZone,omitempty"`
	TaskDefinition        string                 `json:"taskDefinition"`
	TaskDefinitionVersion string                 `json:"taskDefinitionVersion"`
	DesiredStatus         string                 `json:"desiredStatus"`
	KnownStatus           string                 `json:"knownStatus"`
	Limits                AWSContainerLimits     `json:"limits"`
	PullStartedAt         time.Time              `json:"pullStartedAt"`
	PullStoppedAt         time.Time              `json:"pullStoppedAt"`
	Tags                  map[string]interface{} `json:"tags,omitempty"`
}

ECSTaskData is a representation of an ECS task for com.instana.plugin.aws.ecs.task plugin

type GCRServiceRevisionInstanceData added in v1.22.0

type GCRServiceRevisionInstanceData struct {
	Runtime          string `json:"runtime,omitempty"`
	Region           string `json:"region"`
	Service          string `json:"service"`
	Configuration    string `json:"configuration,omitempty"`
	Revision         string `json:"revision"`
	InstanceID       string `json:"instanceId"`
	Port             string `json:"port,omitempty"`
	NumericProjectID int    `json:"numericProjectId"`
	ProjectID        string `json:"projectId,omitempty"`
}

GCRServiceRevisionInstanceData is a representation of a Google Cloud Run service revision instance for com.instana.plugin.gcp.run.revision.instance plugin

type GoProcessData

type GoProcessData struct {
	PID      int          `json:"pid"`
	Snapshot *RuntimeInfo `json:"snapshot,omitempty"`
	Metrics  Metrics      `json:"metrics"`
}

GoProcessData is a representation of a Go process for com.instana.plugin.golang plugin

type MemoryStats

type MemoryStats struct {
	Alloc         uint64  `json:"alloc"`
	TotalAlloc    uint64  `json:"total_alloc"`
	Sys           uint64  `json:"sys"`
	Lookups       uint64  `json:"lookups"`
	Mallocs       uint64  `json:"mallocs"`
	Frees         uint64  `json:"frees"`
	HeapAlloc     uint64  `json:"heap_alloc"`
	HeapSys       uint64  `json:"heap_sys"`
	HeapIdle      uint64  `json:"heap_idle"`
	HeapInuse     uint64  `json:"heap_in_use"`
	HeapReleased  uint64  `json:"heap_released"`
	HeapObjects   uint64  `json:"heap_objects"`
	PauseTotalNs  uint64  `json:"pause_total_ns"`
	PauseNs       uint64  `json:"pause_ns"`
	NumGC         uint32  `json:"num_gc"`
	GCCPUFraction float64 `json:"gc_cpu_fraction"`
}

MemoryStats represents Go runtime memory stats to be sent to com.insana.plugin.golang

type Metrics

type Metrics struct {
	CgoCall     int64 `json:"cgo_call"`
	Goroutine   int   `json:"goroutine"`
	MemoryStats `json:"memory"`
}

Metrics represents Go process metrics to be sent to com.insana.plugin.golang

type PluginPayload

type PluginPayload struct {
	Name     string      `json:"name"`
	EntityID string      `json:"entityId"`
	Data     interface{} `json:"data"`
}

PluginPayload represents the Instana acceptor message envelope containing plugin name and entity ID

func NewAWSLambdaPluginPayload added in v1.23.0

func NewAWSLambdaPluginPayload(entityID string) PluginPayload

NewAWSLambdaPluginPayload returns payload for the AWS Lambda plugin of Instana acceptor

func NewDockerPluginPayload

func NewDockerPluginPayload(entityID string, data DockerData) PluginPayload

NewDockerPluginPayload returns payload for the Docker plugin of Instana acceptor

func NewECSContainerPluginPayload

func NewECSContainerPluginPayload(entityID string, data ECSContainerData) PluginPayload

NewECSContainerPluginPayload returns payload for the ECS container plugin of Instana acceptor

func NewECSTaskPluginPayload

func NewECSTaskPluginPayload(entityID string, data ECSTaskData) PluginPayload

NewECSTaskPluginPayload returns payload for the ECS task plugin of Instana acceptor

func NewGCRServiceRevisionInstancePluginPayload added in v1.22.0

func NewGCRServiceRevisionInstancePluginPayload(entityID string, data GCRServiceRevisionInstanceData) PluginPayload

NewGCRServiceRevisionInstancePluginPayload returns payload for the GCR service revision instance plugin of Instana acceptor

func NewGoProcessPluginPayload

func NewGoProcessPluginPayload(data GoProcessData) PluginPayload

NewGoProcessPluginPayload returns payload for the Go process plugin of Instana acceptor

func NewProcessPluginPayload

func NewProcessPluginPayload(entityID string, data ProcessData) PluginPayload

NewProcessPluginPayload returns payload for the process plugin of Instana acceptor

type ProcessCPUStatsDelta added in v1.19.0

type ProcessCPUStatsDelta struct {
	User   float64 `json:"user,omitempty"`
	System float64 `json:"sys,omitempty"`
}

ProcessCPUStatsDelta represents the CPU stats that have changed since the last measurement

func NewProcessCPUStatsDelta added in v1.19.0

func NewProcessCPUStatsDelta(prev, next process.CPUStats, ticksElapsed int) *ProcessCPUStatsDelta

NewProcessCPUStatsDelta calculates the difference between two CPU usage stats. It returns nil if stats are equal or if the stats were taken at the same time (ticks). The stats are considered to be equal if the change is less then 1%.

type ProcessData

type ProcessData struct {
	PID           int                          `json:"pid"`
	Exec          string                       `json:"exec"`
	Args          []string                     `json:"args,omitempty"`
	Env           map[string]string            `json:"env,omitempty"`
	User          string                       `json:"user,omitempty"`
	Group         string                       `json:"group,omitempty"`
	ContainerID   string                       `json:"container,omitempty"`
	ContainerPid  int                          `json:"containerPid,string,omitempty"`
	ContainerType string                       `json:"containerType,omitempty"`
	Start         int64                        `json:"start"`
	HostName      string                       `json:"com.instana.plugin.host.name"`
	HostPID       int                          `json:"com.instana.plugin.host.pid,string"`
	CPU           *ProcessCPUStatsDelta        `json:"cpu,omitempty"`
	Memory        *ProcessMemoryStatsUpdate    `json:"mem,omitempty"`
	OpenFiles     *ProcessOpenFilesStatsUpdate `json:"openFiles,omitempty"`
}

ProcessData is a representation of a running process for com.instana.plugin.process plugin

type ProcessMemoryStatsUpdate added in v1.19.0

type ProcessMemoryStatsUpdate struct {
	Total  *int `json:"virtual,omitempty"`
	Rss    *int `json:"resident,omitempty"`
	Shared *int `json:"share,omitempty"`
}

ProcessMemoryStatsUpdate represents the memory stats that have changed since the last measurement

func NewProcessMemoryStatsUpdate added in v1.19.0

func NewProcessMemoryStatsUpdate(prev, next process.MemStats) *ProcessMemoryStatsUpdate

NewProcessMemoryStatsUpdate returns the fields that have been updated since the last measurement. It returns nil if nothing has changed.

type ProcessOpenFilesStatsUpdate added in v1.19.0

type ProcessOpenFilesStatsUpdate struct {
	Current *int `json:"current,omitempty"`
	Max     *int `json:"max,omitempty"`
}

ProcessOpenFilesStatsUpdate represents the open file stats and limits that have changed since the last measurement

func NewProcessOpenFilesStatsUpdate added in v1.19.0

func NewProcessOpenFilesStatsUpdate(prev, next process.ResourceLimits) *ProcessOpenFilesStatsUpdate

NewProcessOpenFilesStatsUpdate returns the (process.ResourceLimits).OpenFiles fields that have been updated since the last measurement. It returns nil if nothing has changed.

type RuntimeInfo

type RuntimeInfo struct {
	Name          string `json:"name"`
	Version       string `json:"version"`
	Root          string `json:"goroot"`
	MaxProcs      int    `json:"maxprocs"`
	Compiler      string `json:"compiler"`
	NumCPU        int    `json:"cpu"`
	SensorVersion string `json:"iv,omitempty"`
}

RuntimeInfo represents Go runtime info to be sent to com.insana.plugin.golang

Jump to

Keyboard shortcuts

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