Documentation ¶
Index ¶
- Constants
- func Count(timestamp time.Time, metricName string, value float64) (metric.Metric, error)
- func CumulativeCount(timestamp time.Time, metricName string, value float64) (metric.Metric, error)
- func CumulativeRate(timestamp time.Time, metricName string, value float64) (metric.Metric, error)
- func Gauge(timestamp time.Time, metricName string, value float64) (metric.Metric, error)
- func PrometheusHistogram(timestamp time.Time, metricName string, sampleCount uint64, sampleSum float64) (*metric.PrometheusHistogram, error)
- func PrometheusSummary(timestamp time.Time, metricName string, sampleCount uint64, sampleSum float64) (*metric.PrometheusSummary, error)
- func Rate(timestamp time.Time, metricName string, value float64) (metric.Metric, error)
- func Summary(timestamp time.Time, metricName string, count float64, average float64, ...) (metric.Metric, error)
- type Common
- type Entity
- func (e *Entity) AddCommonDimension(key string, value string)
- func (e *Entity) AddCommonInterval(timestamp time.Duration)
- func (e *Entity) AddCommonTimestamp(timestamp time.Time)
- func (e *Entity) AddEvent(event *event.Event)
- func (e *Entity) AddInventoryItem(key string, field string, value interface{}) error
- func (e *Entity) AddMetadata(key string, value interface{}) error
- func (e *Entity) AddMetric(metric metric.Metric)
- func (e *Entity) AddTag(key string, value interface{}) error
- func (e *Entity) GetMetadata() metadata.Map
- func (e *Entity) Name() string
- func (e *Entity) SameAs(b *Entity) bool
- func (e *Entity) SetIgnoreEntity(value bool)
- type Integration
- func (i *Integration) AddEntity(e *Entity)
- func (i *Integration) Clear()
- func (i *Integration) FindEntity(name string) (*Entity, bool)
- func (i *Integration) GetHostID() string
- func (i *Integration) Logger() log.Logger
- func (i *Integration) MarshalJSON() (output []byte, err error)
- func (i *Integration) NewEntity(name string, entityType string, displayName string) (e *Entity, err error)
- func (i *Integration) Publish() error
- type Metadata
- type Option
Constants ¶
const (
CustomAttrPrefix = "NRI_"
)
Custom attribute keys:
Variables ¶
This section is empty.
Functions ¶
func CumulativeCount ¶
CumulativeCount creates metric of type cumulative count
func CumulativeRate ¶
CumulativeRate creates a metric of type cumulative rate
func PrometheusHistogram ¶
func PrometheusHistogram(timestamp time.Time, metricName string, sampleCount uint64, sampleSum float64) (*metric.PrometheusHistogram, error)
PrometheusHistogram creates a metric of type prometheus histogram
func PrometheusSummary ¶
func PrometheusSummary(timestamp time.Time, metricName string, sampleCount uint64, sampleSum float64) (*metric.PrometheusSummary, error)
PrometheusSummary creates a metric of type prometheus summary
Types ¶
type Common ¶
type Common struct { Timestamp *int64 `json:"timestamp,omitempty"` Interval *int64 `json:"interval.ms,omitempty"` // Attributes are optional, they represent additional information that // can be attached to an event. Attributes map[string]interface{} `json:"attributes,omitempty"` }
Common is the producer of the common dimensions/attributes.
type Entity ¶
type Entity struct { CommonDimensions Common `json:"common"` // dimensions common to every entity metric Metadata *metadata.Metadata `json:"entity,omitempty"` Metrics metric.Metrics `json:"metrics"` Inventory *inventory.Inventory `json:"inventory"` Events event.Events `json:"events"` // IgnoreEntity defines if the Entity should be registered within the infra agent, if true // the Entity will not be attached to the infra agent entity neither registered. IgnoreEntity bool `json:"ignore_entity"` // contains filtered or unexported fields }
Entity is the producer of the data. Entity could be a host, a container, a pod, or whatever unit of meaning.
func (*Entity) AddCommonDimension ¶ added in v4.1.0
AddCommonDimension adds a new dimension to every metric within the entity.
func (*Entity) AddCommonInterval ¶ added in v4.1.1
AddCommonInterval adds a common interval in milliseconds from a time.Duration (nanoseconds).
func (*Entity) AddCommonTimestamp ¶ added in v4.1.1
AddCommonTimestamp adds a new common timestamp to the entity.
func (*Entity) AddInventoryItem ¶
AddInventoryItem method sets the inventory item (only one allowed).
func (*Entity) AddMetadata ¶
AddMetadata adds a new metadata to the entity
func (*Entity) GetMetadata ¶
GetMetadata returns all the Entity's metadata
func (*Entity) SetIgnoreEntity ¶ added in v4.2.0
SetIgnoreEntity set if the infra agent should register the entity
type Integration ¶
type Integration struct { ProtocolVersion string `json:"protocol_version"` Metadata Metadata `json:"integration"` Entities []*Entity `json:"data"` // HostEntity is an "entity" that serves as dumping ground for metrics not associated with a specific entity HostEntity *Entity `json:"-"` //skip json serializing // contains filtered or unexported fields }
Integration defines the format of the output JSON that integrations will return for protocol 2.
func New ¶
func New(name, version string, opts ...Option) (i *Integration, err error)
New creates new integration with sane default values.
func (*Integration) AddEntity ¶
func (i *Integration) AddEntity(e *Entity)
AddEntity adds an entity to the list of entities. No check for "duplicates" is performed
func (*Integration) Clear ¶
func (i *Integration) Clear()
Clear re-initializes the Inventory, Metrics and Events for this integration. Used after publishing so the object can be reused.
func (*Integration) FindEntity ¶
func (i *Integration) FindEntity(name string) (*Entity, bool)
FindEntity finds ad return an entity by name. returns false if entity does not exist in the integration
func (*Integration) GetHostID ¶ added in v4.2.0
func (i *Integration) GetHostID() string
GetHostID returns NriHostID or an empty string if not set
func (*Integration) Logger ¶
func (i *Integration) Logger() log.Logger
Logger returns the integration logger instance.
func (*Integration) MarshalJSON ¶
func (i *Integration) MarshalJSON() (output []byte, err error)
MarshalJSON serializes integration to JSON, fulfilling Marshaler interface.
func (*Integration) NewEntity ¶
func (i *Integration) NewEntity(name string, entityType string, displayName string) (e *Entity, err error)
NewEntity method creates a new (uniquely named) Entity. The `name` of the Entity must be unique for the account otherwise it will cause conflicts
func (*Integration) Publish ¶
func (i *Integration) Publish() error
Publish writes the data to output (stdout) and resets the integration "object"