transit

package
v0.0.0-...-83a4208 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

MonitorStatusWeightService defines weight of Monitor Status for multi-state comparison

Functions

This section is empty.

Types

type AgentIdentity

type AgentIdentity struct {
	AgentID string `json:"agentId" yaml:"agentId"`
	AppName string `json:"appName" yaml:"appName"`
	AppType string `json:"appType" yaml:"appType"`
}

AgentIdentity defines TCG Agent Identity

type BaseInfo

type BaseInfo struct {
	// The unique name of the resource
	Name string `json:"name"`
	// Type: Required. The resource type of the resource
	// General Nagios Types are hosts, whereas CloudHub can have richer complexity
	Type ResourceType `json:"type"`
	// Owner relationship for associations like hypervisor->virtual machine
	Owner string `json:"owner,omitempty"`
	// CloudHub Categorization of resources
	Category string `json:"category,omitempty"`
	// Optional description of this resource, such as Nagios notes
	Description string `json:"description,omitempty"`
	// Foundation Properties
	Properties map[string]TypedValue `json:"properties,omitempty"`
}

func (*BaseInfo) CreateProperties

func (p *BaseInfo) CreateProperties(properties map[string]interface{})

func (*BaseInfo) SetCategory

func (p *BaseInfo) SetCategory(s string)

func (*BaseInfo) SetDescription

func (p *BaseInfo) SetDescription(s string)

func (*BaseInfo) SetName

func (p *BaseInfo) SetName(s string)

func (*BaseInfo) SetOwner

func (p *BaseInfo) SetOwner(s string)

func (*BaseInfo) SetProperty

func (p *BaseInfo) SetProperty(k string, v interface{})

func (*BaseInfo) SetType

func (p *BaseInfo) SetType(s ResourceType)

type BaseResource

type BaseResource struct {
	BaseInfo
	// Device (usually IP address), leave empty if not available, will default to name
	Device string `json:"device,omitempty"`
}

func (*BaseResource) SetDevice

func (p *BaseResource) SetDevice(s string)

func (BaseResource) ToResourceRef

func (p BaseResource) ToResourceRef() ResourceRef

type ComputeType

type ComputeType string

ComputeType defines CloudHub Compute Types

const (
	Query         ComputeType = "Query"
	Regex         ComputeType = "Regex"
	Synthetic     ComputeType = "Synthetic"
	Informational ComputeType = "Informational"
	Performance   ComputeType = "Performance"
	Health        ComputeType = "Health"
)

CloudHub Compute Types

type Downtime

type Downtime struct {
	EntityType             string `json:"entityType"`
	EntityName             string `json:"entityName"`
	HostName               string `json:"hostName"`
	ServiceDescription     string `json:"serviceDescription,omitempty"`
	ScheduledDowntimeDepth int    `json:"scheduledDowntimeDepth"`
}

Downtime describes downtime schedule.

type Downtimes

type Downtimes struct {
	BizHostServiceInDowntimes []Downtime `json:"bizHostServiceInDowntimes"`
}

Downtimes defines type used for ClearInDowntime API payload.

type DowntimesRequest

type DowntimesRequest struct {
	HostNames                 []string `json:"hostNames"`
	HostGroupNames            []string `json:"hostGroupNames"`
	ServiceDescriptions       []string `json:"serviceDescriptions"`
	ServiceGroupCategoryNames []string `json:"serviceGroupCategoryNames"`
	SetHosts                  bool     `json:"setHosts"`
	SetServices               bool     `json:"setServices"`
}

DowntimesRequest defines type used for SetInDowntime API payload.

type GroundworkEvent

type GroundworkEvent struct {
	AppType             string     `json:"appType"`
	Device              string     `json:"device,omitempty"`
	Host                string     `json:"host"`
	Service             string     `json:"service,omitempty"`
	OperationStatus     string     `json:"operationStatus,omitempty"`
	MonitorStatus       string     `json:"monitorStatus"`
	Severity            string     `json:"severity,omitempty"`
	ApplicationSeverity string     `json:"applicationSeverity,omitempty"`
	Component           string     `json:"component,omitempty"`
	SubComponent        string     `json:"subComponent,omitempty"`
	Priority            string     `json:"priority,omitempty"`
	TypeRule            string     `json:"typeRule,omitempty"`
	TextMessage         string     `json:"textMessage,omitempty"`
	LastInsertDate      *Timestamp `json:"lastInsertDate,omitempty"`
	ReportDate          *Timestamp `json:"reportDate"`
	// Update level attributes (update only)
	ApplicationName   string `json:"applicationName,omitempty"`
	ConsolidationName string `json:"consolidationName,omitempty"`
	ErrorType         string `json:"errorType,omitempty"`
	LoggerName        string `json:"loggerName,omitempty"`
	LogType           string `json:"logType,omitempty"`
	MonitorServer     string `json:"monitorServer,omitempty"`
}

GroundworkEvent describes event.

func (GroundworkEvent) String

func (p GroundworkEvent) String() string

String implements Stringer interface.

type GroundworkEventAck

type GroundworkEventAck struct {
	AppType            string `json:"appType"`
	Host               string `json:"host"`
	Service            string `json:"service,omitempty"`
	AcknowledgedBy     string `json:"acknowledgedBy,omitempty"`
	AcknowledgeComment string `json:"acknowledgeComment,omitempty"`
}

GroundworkEventAck describes event ack

func (GroundworkEventAck) String

func (p GroundworkEventAck) String() string

String implements Stringer interface.

type GroundworkEventUnack

type GroundworkEventUnack struct {
	AppType string `json:"appType"`
	Host    string `json:"host"`
	Service string `json:"service,omitempty"`
}

GroundworkEventUnack describes event ack

func (GroundworkEventUnack) String

func (p GroundworkEventUnack) String() string

String implements Stringer interface.

type GroundworkEventsAckRequest

type GroundworkEventsAckRequest struct {
	Acks []GroundworkEventAck `json:"acks"`
}

GroundworkEventsAckRequest describes request payload.

type GroundworkEventsRequest

type GroundworkEventsRequest struct {
	Events []GroundworkEvent `json:"events"`
}

GroundworkEventsRequest describes request payload.

func (GroundworkEventsRequest) String

func (p GroundworkEventsRequest) String() string

String implements Stringer interface.

type GroundworkEventsUnackRequest

type GroundworkEventsUnackRequest struct {
	Unacks []GroundworkEventUnack `json:"unacks"`
}

GroundworkEventsUnackRequest describes request payload.

type GroupType

type GroupType string

GroupType defines the foundation group type

const (
	HostGroup    GroupType = "HostGroup"
	ServiceGroup GroupType = "ServiceGroup"
	CustomGroup  GroupType = "CustomGroup"
)

The group type uniquely defining corresponding foundation group type

type HostOwnershipType

type HostOwnershipType string

HostOwnershipType defines the host ownership type of inventory.

const (
	Creator HostOwnershipType = "Creator"
	Take    HostOwnershipType = "Take"
	Yield   HostOwnershipType = "Yield"
)

Take - Always take ownership, can overwrite ownership, aggressive take everything Creator - Leave ownership if already owned (owns things it creates, if I didn't create it I don't own it) Yield - Always defer ownership - don't want to own it, if someone else comes along, let them own it

type IncidentAlert

type IncidentAlert struct {
	IncidentID    string     `json:"incidentId"`
	ResourceName  string     `json:"resourceName"`
	Status        string     `json:"status"`
	StartedAt     *Timestamp `json:"startedAt"`
	EndedAt       *Timestamp `json:"endedAt,omitempty"`
	ConditionName string     `json:"conditionName"`
	URL           string     `json:"url,omitempty"`
	Summary       string     `json:"summary,omitempty"`
}

IncidentAlert describes alerts received from cloud services.

func (IncidentAlert) String

func (p IncidentAlert) String() string

String implements Stringer interface.

type InventoryRequest

type InventoryRequest struct {
	Context       *TracerContext      `json:"context,omitempty"`
	OwnershipType HostOwnershipType   `json:"ownershipType,omitempty"`
	Resources     []InventoryResource `json:"resources"`
	Groups        []ResourceGroup     `json:"groups,omitempty"`
}

InventoryRequest defines SynchronizeInventory payload

func (*InventoryRequest) AddResource

func (p *InventoryRequest) AddResource(res InventoryResource)

func (*InventoryRequest) AddResourceGroup

func (p *InventoryRequest) AddResourceGroup(gr ResourceGroup)

func (*InventoryRequest) SetContext

func (p *InventoryRequest) SetContext(c TracerContext)

func (InventoryRequest) String

func (p InventoryRequest) String() string

String implements Stringer interface

type InventoryResource

type InventoryResource struct {
	BaseResource
	// Inventory Service collection
	Services []InventoryService `json:"services"`
}

InventoryResource represents a resource that is included in a inventory scan. Examples include:

  • nagios host
  • virtual machine instance
  • RDS database
  • storage devices such as disks
  • cloud resources such as cloud apps, cloud functions(lambdas)

An InventoryResource is the representation of a specific monitored resource during an inventory scan. Each InventoryResource contains list of services (InventoryService) (no metrics are sent).

func (*InventoryResource) AddService

func (p *InventoryResource) AddService(svc InventoryService)

func (InventoryResource) String

func (p InventoryResource) String() string

String implements Stringer interface

type InventoryService

type InventoryService struct {
	BaseInfo
}

InventoryService represents a Groundwork Service that is included in a inventory scan. In cloud systems, services are usually modeled as a complex metric definition, with each sampled metric variation represented as as single metric time series. During inventory scans, TCG does not gather metric samples.

InventoryService collections are attached to an InventoryResource during inventory scans.

func (InventoryService) String

func (p InventoryService) String() string

String implements Stringer interface

type LabelDescriptor

type LabelDescriptor struct {
	// Description: A human-readable description for the label.
	Description string `json:"description,omitempty"`

	// Key: The label key.
	Key string `json:"key,omitempty"`

	// ValueType: The type of data that can be assigned to the label.
	//
	// Possible values:
	//   "STRING" - A variable-length string. This is the default.
	//   "BOOL" - Boolean; true or false.
	//   "INT64" - A 64-bit signed integer.
	ValueType ValueType `json:"valueType,omitempty"`
}

LabelDescriptor defines a Label.

func (LabelDescriptor) String

func (labelDescriptor LabelDescriptor) String() string

String implements Stringer interface

type Mapping

type Mapping struct {
	Enabled     bool           `json:"enabled"`
	Source      string         `json:"source"`
	Destination string         `json:"destination"`
	Regexp      *regexp.Regexp `json:"-"`
}

type Mappings

type Mappings struct {
	Resource     []Mapping `json:"resourceMappings"`
	HostLabel    []Mapping `json:"hostLabelMappings"`
	ServiceLabel []Mapping `json:"serviceLabelMappings"`
}

type MetricDefinition

type MetricDefinition struct {
	Name              string      `json:"name"`
	CustomName        string      `json:"customName,omitempty"`
	Description       string      `json:"description,omitempty"`
	Monitored         bool        `json:"monitored,omitempty"`
	Graphed           bool        `json:"graphed,omitempty"`
	MetricType        MetricKind  `json:"metricType"`
	ComputeType       ComputeType `json:"computeType"`
	ServiceType       string      `json:"serviceType"`
	SourceType        string      `json:"sourceType,omitempty"`
	AggregateType     string      `json:"aggregateType,omitempty"`
	WarningThreshold  int         `json:"warningThreshold"`
	CriticalThreshold int         `json:"criticalThreshold"`
	Expression        string      `json:"expression,omitempty"`
	Format            string      `json:"format,omitempty"`
}

func (MetricDefinition) String

func (metricDefinition MetricDefinition) String() string

String implements Stringer interface

type MetricDescriptor

type MetricDescriptor struct {
	// Custom Name: Override the resource type with a custom name of the metric descriptor.
	CustomName string `json:"name,omitempty"`

	// Description: A detailed description of the metric, which can be used
	// in documentation.
	Description string `json:"description,omitempty"`

	// DisplayName: A concise name for the metric, which can be displayed in
	// user interfaces. Use sentence case without an ending period, for
	// example "Request count". This field is optional but it is recommended
	// to be set for any metrics associated with user-visible concepts, such
	// as Quota.
	DisplayName string `json:"displayName,omitempty"`

	// Labels: The set of labels that can be used to describe a specific
	// instance of this metric type. For example, the
	// appengine.googleapis.com/http/server/response_latencies metric type
	// has a label for the HTTP response code, response_code, so you can
	// look at latencies for successful responses or just for responses that
	// failed.
	Labels []*LabelDescriptor `json:"labels,omitempty"`

	Thresholds []*ThresholdDescriptor `json:"thresholds,omitempty"`

	// Type: The metric type, including its DNS name prefix. The type is not
	// URL-encoded. All user-defined metric types have the DNS name
	// custom.googleapis.com or external.googleapis.com. Metric types should
	// use a natural hierarchical grouping. For
	// example:
	// "custom.googleapis.com/invoice/paid/amount"
	// "external.googlea
	// pis.com/prometheus/up"
	// "appengine.googleapis.com/http/server/response_
	// latencies"
	//
	Type string `json:"type,omitempty"`

	// Unit: The unit in which the metric value is reported. It is only
	// applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The
	// supported units are a subset of The Unified Code for Units of Measure
	// (http://unitsofmeasure.org/ucum.html) standard, added as we encounter
	// the need for them in monitoring contexts.
	Unit UnitType `json:"unit,omitempty"`

	// ValueType: Whether the measurement is an integer, a floating-point
	// number, etc. Some combinations of metric_kind and value_type might
	// not be supported.
	ValueType ValueType `json:"valueType,omitempty"`

	// Groundwork Compute Type such as Synthetic
	ComputeType ComputeType `json:"computeType,omitempty"`

	// MetricKind: Whether the metric records instantaneous values, changes
	// to a value, etc. Some combinations of metric_kind and value_type
	// might not be supported.
	//
	// Possible values:
	//   "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
	//   "GAUGE" - An instantaneous measurement of a value.
	//   "DELTA" - The change in a value during a time interval.
	//   "CUMULATIVE" - A value accumulated over a time interval. Cumulative
	// measurements in a time series should have the same start time and
	// increasing end times, until an event resets the cumulative value to
	// zero and sets a new start time for the following samples.
	MetricKind MetricKind `json:"metricKind"`
}

MetricDescriptor defines a metric type and its schema

func (MetricDescriptor) String

func (metricDescriptor MetricDescriptor) String() string

String implements Stringer interface

type MetricKind

type MetricKind string

MetricKind defines the metric kind of the time series.

const (
	MetricKindUnspecified MetricKind = "METRIC_KIND_UNSPECIFIED"
	Gauge                 MetricKind = "GAUGE"
	Delta                 MetricKind = "DELTA"
	Cumulative            MetricKind = "CUMULATIVE"
)

MetricKindUnspecified - Do not use this default value. Gauge - An instantaneous measurement of a value. Delta - The change in a value during a time interval. Cumulative - A value accumulated over a time interval. Cumulative

type MetricSampleType

type MetricSampleType string

MetricSampleType defines TimeSeries Metric Sample Possible Types

const (
	Value    MetricSampleType = "Value"
	Warning  MetricSampleType = "Warning"
	Critical MetricSampleType = "Critical"
	Min      MetricSampleType = "Min"
	Max      MetricSampleType = "Max"
)

TimeSeries Metric Sample Possible Types

type MetricsProfile

type MetricsProfile struct {
	Name        string             `json:"name"`
	ProfileType string             `json:"profileType"`
	IsTemplate  bool               `json:"isTemplate"`
	Metrics     []MetricDefinition `json:"metrics"`
}

func (MetricsProfile) String

func (metricsProfile MetricsProfile) String() string

String implements Stringer interface

type MonitorConnection

type MonitorConnection struct {
	ID          int         `json:"id"`
	Server      string      `json:"server"`
	UserName    string      `json:"userName"`
	Password    string      `json:"password"`
	SslEnabled  bool        `json:"sslEnabled"`
	URL         string      `json:"url"`
	Views       []View      `json:"views,omitempty"`
	Extensions  interface{} `json:"extensions"`
	ConnectorID int         `json:"connectorId"`
}

MonitorConnection describes the connection to the monitored system

func (MonitorConnection) String

func (monitorConnection MonitorConnection) String() string

String implements Stringer interface

type MonitorStatus

type MonitorStatus string

MonitorStatus represents Groundwork service monitor status

const (
	ServiceOk                  MonitorStatus = "SERVICE_OK"
	ServiceWarning             MonitorStatus = "SERVICE_WARNING"
	ServiceUnscheduledCritical MonitorStatus = "SERVICE_UNSCHEDULED_CRITICAL"
	ServicePending             MonitorStatus = "SERVICE_PENDING"
	ServiceScheduledCritical   MonitorStatus = "SERVICE_SCHEDULED_CRITICAL"
	ServiceUnknown             MonitorStatus = "SERVICE_UNKNOWN"
	HostUp                     MonitorStatus = "HOST_UP"
	HostUnscheduledDown        MonitorStatus = "HOST_UNSCHEDULED_DOWN"
	HostWarning                MonitorStatus = "HOST_WARNING"
	HostPending                MonitorStatus = "HOST_PENDING"
	HostScheduledDown          MonitorStatus = "HOST_SCHEDULED_DOWN"
	HostUnreachable            MonitorStatus = "HOST_UNREACHABLE"
	HostUnchanged              MonitorStatus = "HOST_UNCHANGED"
)

Groundwork Standard Monitored Resource Statuses

func CalculateResourceStatus

func CalculateResourceStatus(services []MonitoredService) MonitorStatus

func CalculateServiceStatus

func CalculateServiceStatus(metrics *[]TimeSeries) (MonitorStatus, error)

func CalculateStatus

func CalculateStatus(value *TypedValue, warning *TypedValue, critical *TypedValue) MonitorStatus

type MonitoredInfo

type MonitoredInfo struct {
	// Restrict to a Groundwork Monitor Status
	Status MonitorStatus `json:"status"`
	// The last status check time on this resource
	LastCheckTime *Timestamp `json:"lastCheckTime,omitempty"`
	// The next status check time on this resource
	NextCheckTime *Timestamp `json:"nextCheckTime,omitempty"`
	// Nagios plugin output string
	LastPluginOutput string `json:"lastPluginOutput,omitempty"`
}

func (*MonitoredInfo) SetLastCheckTime

func (p *MonitoredInfo) SetLastCheckTime(t *Timestamp)

func (*MonitoredInfo) SetLastPluginOutput

func (p *MonitoredInfo) SetLastPluginOutput(s string)

func (*MonitoredInfo) SetNextCheckTime

func (p *MonitoredInfo) SetNextCheckTime(t *Timestamp)

func (*MonitoredInfo) SetStatus

func (p *MonitoredInfo) SetStatus(s MonitorStatus)

type MonitoredResource

type MonitoredResource struct {
	BaseResource
	MonitoredInfo
	// Services state collection
	Services []MonitoredService `json:"services"`
}

A MonitoredResource defines the current status and services of a resource during a metrics scan. Examples include:

  • nagios host
  • virtual machine instance
  • RDS database
  • storage devices such as disks
  • cloud resources such as cloud apps, cloud functions(lambdas)

A MonitoredResource is the representation of a specific monitored resource during a metric scan. Each MonitoredResource contains list of services (MonitoredService). A MonitoredResource does not have metrics, only services.

func (*MonitoredResource) AddService

func (p *MonitoredResource) AddService(svc MonitoredService)

func (MonitoredResource) String

func (p MonitoredResource) String() string

String implements Stringer interface

func (MonitoredResource) ToInventoryResource

func (p MonitoredResource) ToInventoryResource() InventoryResource

type MonitoredService

type MonitoredService struct {
	BaseInfo
	MonitoredInfo
	// metrics
	Metrics []TimeSeries `json:"metrics"`
}

A MonitoredService represents a Groundwork Service creating during a metrics scan. In cloud systems, services are usually modeled as a complex metric definition, with each sampled metric variation represented as as single metric time series.

A MonitoredService contains a collection of TimeSeries Metrics. MonitoredService collections are attached to a MonitoredResource during a metrics scan.

func (*MonitoredService) AddMetric

func (p *MonitoredService) AddMetric(t TimeSeries)

func (MonitoredService) String

func (p MonitoredService) String() string

String implements Stringer interface

func (MonitoredService) ToInventoryService

func (p MonitoredService) ToInventoryService() InventoryService

type OperationResult

type OperationResult struct {
	Entity   string `json:"entity"`
	Status   string `json:"status"`
	Message  string `json:"message"`
	Location string `json:"location"`
	EntityID int    `json:"entityID"`
}

OperationResult defines API answer

func (OperationResult) String

func (operationResult OperationResult) String() string

String implements Stringer interface

type OperationResults

type OperationResults struct {
	ResourcesAdded   int                `json:"successful"`
	ResourcesDeleted int                `json:"failed"`
	EntityType       string             `json:"entityType"`
	Operation        string             `json:"operation"`
	Warning          int                `json:"warning"`
	Count            int                `json:"count"`
	Results          *[]OperationResult `json:"results"`
}

OperationResults defines API answer

func (OperationResults) String

func (operationResults OperationResults) String() string

String implements Stringer interface

type ResourceGroup

type ResourceGroup struct {
	GroupName   string        `json:"groupName"`
	Type        GroupType     `json:"type"`
	Description string        `json:"description,omitempty"`
	Resources   []ResourceRef `json:"resources"`
}

ResourceGroup defines group entity

func (*ResourceGroup) AddResource

func (p *ResourceGroup) AddResource(res ResourceRef)

func (*ResourceGroup) SetDescription

func (p *ResourceGroup) SetDescription(s string)

func (*ResourceGroup) SetName

func (p *ResourceGroup) SetName(s string)

func (*ResourceGroup) SetType

func (p *ResourceGroup) SetType(s GroupType)

func (ResourceGroup) String

func (p ResourceGroup) String() string

String implements Stringer interface

type ResourceRef

type ResourceRef struct {
	// The unique name of the resource
	Name string `json:"name"`
	// Type: Optional. The resource type uniquely defining the resource type
	// General Nagios Types are host and service, whereas CloudHub can have richer complexity
	Type ResourceType `json:"type,omitempty"`
	// Owner relationship for associations like host->service
	Owner string `json:"owner,omitempty"`
}

ResourceRef references an InventoryResource in a group collection

func (ResourceRef) String

func (p ResourceRef) String() string

String implements Stringer interface

type ResourceType

type ResourceType string

ResourceType defines the resource type

const (
	ResourceTypeHost           ResourceType = "host"
	ResourceTypeService        ResourceType = "service"
	ResourceTypeHypervisor     ResourceType = "hypervisor"
	ResourceTypeInstance       ResourceType = "instance"
	ResourceTypeVirtualMachine ResourceType = "virtual-machine"
	ResourceTypeCloudApp       ResourceType = "cloud-app"
	ResourceTypeCloudFunction  ResourceType = "cloud-function"
	ResourceTypeLoadBalancer   ResourceType = "load-balancer"
	ResourceTypeContainer      ResourceType = "container"
	ResourceTypeStorage        ResourceType = "storage"
	ResourceTypeNetwork        ResourceType = "network"
	ResourceTypeNetworkSwitch  ResourceType = "network-switch"
	ResourceTypeNetworkDevice  ResourceType = "network-device"
)

The resource type uniquely defining the resource type General Nagios Types are host and service, whereas CloudHub can have richer complexity

type ResourcesWithServicesRequest

type ResourcesWithServicesRequest struct {
	Context   *TracerContext      `json:"context,omitempty"`
	Resources []MonitoredResource `json:"resources"`
	Groups    []ResourceGroup     `json:"groups,omitempty"`
}

ResourcesWithServicesRequest defines SendResourcesWithMetrics payload

func (*ResourcesWithServicesRequest) AddResource

func (p *ResourcesWithServicesRequest) AddResource(res MonitoredResource)

func (*ResourcesWithServicesRequest) AddResourceGroup

func (p *ResourcesWithServicesRequest) AddResourceGroup(gr ResourceGroup)

func (*ResourcesWithServicesRequest) SetContext

func (ResourcesWithServicesRequest) String

String implements Stringer interface

type ServiceType

type ServiceType string

ServiceType defines the service type

const (
	ServiceTypeProcess ServiceType = "Process"
	ServiceTypeService ServiceType = "Service"
)

Possible Types

type ThresholdDescriptor

type ThresholdDescriptor struct {
	// Key: The threshold key.
	Key   string `json:"key"`
	Value int32  `json:"value"`
}

ThresholdDescriptor defines a Threshold

func (ThresholdDescriptor) String

func (thresholdDescriptor ThresholdDescriptor) String() string

String implements Stringer interface

type ThresholdValue

type ThresholdValue struct {
	SampleType MetricSampleType `json:"sampleType"`
	Label      string           `json:"label"`
	Value      *TypedValue      `json:"value"`
}

ThresholdValue describes threshold

func (*ThresholdValue) SetValue

func (p *ThresholdValue) SetValue(v interface{})

func (ThresholdValue) String

func (p ThresholdValue) String() string

String implements Stringer interface

type TimeInterval

type TimeInterval struct {
	// EndTime: Required. The end of the time interval.
	EndTime *Timestamp `json:"endTime"`

	// StartTime: Optional. The beginning of the time interval. The default
	// value for the start time is the end time. The start time must not be
	// later than the end time.
	StartTime *Timestamp `json:"startTime,omitempty"`
}

TimeInterval defines a closed time interval. It extends from the start time to the end time, and includes both: [startTime, endTime]. Valid time intervals depend on the MetricKind of the metric value. In no case can the end time be earlier than the start time. For a GAUGE metric, the StartTime value is technically optional; if no value is specified, the start time defaults to the value of the end time, and the interval represents a single point in time. Such an interval is valid only for GAUGE metrics, which are point-in-time measurements. For DELTA and CUMULATIVE metrics, the start time must be earlier than the end time. In all cases, the start time of the next interval must be at least a microsecond after the end time of the previous interval. Because the interval is closed, if the start time of a new interval is the same as the end time of the previous interval, data written at the new start time could overwrite data written at the previous end time.

func (TimeInterval) String

func (value TimeInterval) String() string

String implements Stringer interface

type TimeSeries

type TimeSeries struct {
	MetricName string           `json:"metricName"`
	SampleType MetricSampleType `json:"sampleType,omitempty"`
	// Interval: The time interval to which the data sample applies. For
	// GAUGE metrics, only the end time of the interval is used. For DELTA
	// metrics, the start and end time should specify a non-zero interval,
	// with subsequent samples specifying contiguous and non-overlapping
	// intervals. For CUMULATIVE metrics, the start and end time should
	// specify a non-zero interval, with subsequent samples specifying the
	// same start time and increasing end times, until an event resets the
	// cumulative value to zero and sets a new start time for the following
	// samples.
	Interval          *TimeInterval     `json:"interval"`
	Value             *TypedValue       `json:"value"`
	Tags              map[string]string `json:"tags,omitempty"`
	Unit              UnitType          `json:"unit,omitempty"`
	Thresholds        []ThresholdValue  `json:"thresholds,omitempty"`
	MetricComputeType ComputeType       `json:"-"`
	MetricExpression  string            `json:"-"`
}

TimeSeries defines a single Metric Sample, its time interval, and 0 or more thresholds

func (*TimeSeries) AddThreshold

func (p *TimeSeries) AddThreshold(t ThresholdValue)

func (*TimeSeries) SetIntervalEnd

func (p *TimeSeries) SetIntervalEnd(t *Timestamp)

func (*TimeSeries) SetIntervalStart

func (p *TimeSeries) SetIntervalStart(t *Timestamp)

func (*TimeSeries) SetName

func (p *TimeSeries) SetName(s string)

func (*TimeSeries) SetSampleType

func (p *TimeSeries) SetSampleType(s MetricSampleType)

func (*TimeSeries) SetTag

func (p *TimeSeries) SetTag(k string, v string)

func (*TimeSeries) SetUnit

func (p *TimeSeries) SetUnit(s UnitType)

func (*TimeSeries) SetValue

func (p *TimeSeries) SetValue(v interface{})

func (TimeSeries) String

func (p TimeSeries) String() string

String implements Stringer interface

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp wraps time.Time and adapts json.Marshaler.

Timestamp refers to the JSON representation of timestamps, for time-data interchange, as a single integer representing a modified version of whole milliseconds since the UNIX epoch (00:00:00 UTC on January 1, 1970). Individual languages (Go, C, Java) will typically implement this structure using a more-complex construction in their respective contexts, containing even finer granularity for local data storage, typically at the nanosecond level.

The "modified version" comment reflects the following simplification. Despite the already fine-grained representation as milliseconds, this data value takes no account of leap seconds; for all of our calculations, we simply pretend they don't exist. Individual feeders will typically map a 00:00:60 value for a leap second, obtained as a string so the presence of the leap second is obvious, as 00:01:00, and the fact that 00:01:00 will occur again in the following second will be silently ignored. This means that any monitoring which really wants to accurately reflect International Atomic Time (TAI), UT1, or similar time coordinates will be subject to some disruption. It also means that even in ordinary circumstances, any calculations of sub-second time differences might run into surprises, since the following timestamps could appear in temporal order:

    actual time   relative reported time in milliseconds
A:  00:00:59.000  59000
B:  00:00:60.000  60000
C:  00:00:60.700  60700
D:  00:01:00.000  60000
E:  00:01:00.300  60300
F:  00:01:01.000  61000

In such a situation, (D - C) and (E - C) would be negative numbers.

In other situations, a feeder might obtain a timestamp from a system hardware clock which, say, counts local nanoseconds and has no notion of any leap seconds having been inserted into human-readable string-time representations. So there could be some amount of offset if such values are compared across such a boundary.

Beyond that, there is always the issue of computer clocks not being directly tied to atomic clocks, using inexpensive non-temperature-compensated crystals for timekeeping. Such hardware can easily drift dramatically off course, and the local timekeeping may or may not be subject to course correction using HTP, chrony, or similar software that periodically adjusts the system time to keep it synchronized with the Internet. Also, there may be large jumps in either a positive or negative direction when a drifted clock is suddenly brought back into synchronization with the rest of the world.

In addition, we ignore here all temporal effects of Special Relativity, not to mention further adjustments needed to account for General Relativity. This is not a theoretical joke; those who monitor GPS satellites should take note of the limitations of this data type, and use some other data type for time-critical data exchange and calculations.

The point of all this being, fine resolution of clock values should never be taken too seriously unless one is sure that the clocks being compared are directly hitched together, and even then one must allow for quantum leaps into the future and time travel into the past.

Finally, note that the Go zero-value of the internal implementation object we use in that language does not have a reasonable value when interpreted as milliseconds since the UNIX epoch. For that reason, the general rule is that the JSON representation of a zero-value for any field of this type, no matter what the originating language, will be to simply omit it from the JSON string. That fact must be taken into account when marshalling and unmarshalling data structures that contain such fields.

func NewTimestamp

func NewTimestamp() *Timestamp

NewTimestamp returns reference to new timestamp setted to UTC now.

func (Timestamp) Add

func (t Timestamp) Add(d time.Duration) Timestamp

Add returns the timestamp t+d. Overrides nested time.Time Add.

func (Timestamp) AddDate

func (t Timestamp) AddDate(years int, months int, days int) Timestamp

AddDate returns the timestamp corresponding to adding the given number of years, months, and days. Overrides nested time.Time AddDate.

func (Timestamp) In

func (t Timestamp) In(loc *time.Location) Timestamp

In returns a copy of t with location set to loc. Overrides nested time.Time In.

func (Timestamp) Local

func (t Timestamp) Local() Timestamp

Local returns a copy of t with the location set to local time. Overrides nested time.Time Local.

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. Overrides nested time.Time MarshalJSON.

func (Timestamp) Round

func (t Timestamp) Round(d time.Duration) Timestamp

Round returns a copy of t rounded to the nearest multiple of d. Overrides nested time.Time Round.

func (Timestamp) String

func (t Timestamp) String() string

String implements fmt.Stringer. Overrides nested time.Time String.

func (Timestamp) Truncate

func (t Timestamp) Truncate(d time.Duration) Timestamp

Truncate returns a copy t rounded down to a multiple of d. Overrides nested time.Time Truncate.

func (Timestamp) UTC

func (t Timestamp) UTC() Timestamp

UTC returns a copy of t with the location set to UTC. Overrides nested time.Time UTC.

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler. Overrides nested time.Time UnmarshalJSON.

type TracerContext

type TracerContext struct {
	AppType    string        `json:"appType"`
	AgentID    string        `json:"agentId"`
	TraceToken string        `json:"traceToken"`
	TimeStamp  *Timestamp    `json:"timeStamp"`
	Version    VersionString `json:"version"`
}

TracerContext describes a Transit call

func (*TracerContext) SetContext

func (p *TracerContext) SetContext(c TracerContext)

SetContext sets values if not empty

func (TracerContext) String

func (p TracerContext) String() string

String implements Stringer interface

type TypedValue

type TypedValue struct {
	ValueType ValueType `json:"valueType"`

	// BoolValue: A Boolean value: true or false.
	BoolValue *bool `json:"boolValue,omitempty"`

	// DoubleValue: A 64-bit double-precision floating-point number. Its
	// magnitude is approximately &plusmn;10<sup>&plusmn;300</sup> and it
	// has 16 significant digits of precision.
	DoubleValue *float64 `json:"doubleValue,omitempty"`

	// Int64Value: A 64-bit integer. Its range is approximately
	// &plusmn;9.2x10<sup>18</sup>.
	IntegerValue *int64 `json:"integerValue,omitempty"`

	// StringValue: A variable-length string value.
	StringValue *string `json:"stringValue,omitempty"`

	// a time stored as full timestamp
	TimeValue *Timestamp `json:"timeValue,omitempty"`
}

TypedValue defines a single strongly-typed value.

func NewTypedValue

func NewTypedValue(v interface{}) *TypedValue

NewTypedValue returns a reference to TypedValue or nil

func (TypedValue) String

func (value TypedValue) String() string

String implements Stringer interface

type UnitType

type UnitType string

UnitType - Supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard, added as we encounter the need for them in monitoring contexts.

const (
	UnitCounter UnitType = "1"
	PercentCPU  UnitType = "%{cpu}"
	KB          UnitType = "KB"
	MB          UnitType = "MB"
	GB          UnitType = "GB"
)

Supported units

type ValueType

type ValueType string

ValueType defines the data type of the value of a metric

const (
	IntegerType     ValueType = "IntegerType"
	DoubleType      ValueType = "DoubleType"
	StringType      ValueType = "StringType"
	BooleanType     ValueType = "BooleanType"
	TimeType        ValueType = "TimeType"
	UnspecifiedType ValueType = "UnspecifiedType"
)

Data type of the value of a metric

type VersionString

type VersionString string

VersionString defines type of constant

const (
	ModelVersion VersionString = "1.0.0"
)

ModelVersion defines versioning

type View

type View struct {
	Name        string                 `json:"name"`
	DisplayName string                 `json:"displayName"`
	Enabled     bool                   `json:"enabled"`
	Extensions  map[string]interface{} `json:"extensions,omitempty"`
}

Jump to

Keyboard shortcuts

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