Documentation ¶
Index ¶
- Constants
- Variables
- type Entity
- func (e *Entity) AddAttributes(attributes ...attribute.Attribute)
- func (e *Entity) AddEvent(evnt *event.Event) error
- func (e *Entity) Key() (EntityKey, error)
- func (e *Entity) NewMetricSet(eventType string, nameSpacingAttributes ...attribute.Attribute) *metric.Set
- func (e *Entity) SameAs(b *Entity) bool
- func (e *Entity) SetInventoryItem(key string, field string, value interface{}) error
- type EntityKey
- type EntityMetadata
- type IDAttribute
- type IDAttributes
- type Integration
- func (i *Integration) Clear()
- func (i *Integration) CreateUniqueID() string
- func (i *Integration) Entity(name, namespace string, idAttributes ...IDAttribute) (e *Entity, err error)
- func (i *Integration) EntityReportedBy(reportingEntity EntityKey, reportedEntityName, reportedEntityNamespace string, ...) (e *Entity, err error)
- func (i *Integration) EntityReportedVia(endpoint, reportedEntityName, reportedEntityNamespace string, ...) (e *Entity, err error)
- func (i *Integration) LocalEntity() *Entity
- func (i *Integration) Logger() log.Logger
- func (i *Integration) MarshalJSON() (output []byte, err error)
- func (i *Integration) Publish() error
- type Option
Constants ¶
const ( CustomAttrPrefix = "NRI_" CustomAttrCluster = "cluster_name" CustomAttrService = "service_name" )
Custom attribute keys:
const ( AttrReportingEntity = "reportingEntityKey" AttrReportingEndpoint = "reportingEndpoint" )
Standard attributes
Variables ¶
var EmptyKey = EntityKey("")
EmptyKey empty entity key.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity struct { Metadata *EntityMetadata `json:"entity,omitempty"` Metrics []*metric.Set `json:"metrics"` Inventory *inventory.Inventory `json:"inventory"` Events []*event.Event `json:"events"` AddHostname bool `json:"add_hostname,omitempty"` // add hostname to metadata at agent level // 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) AddAttributes ¶
AddAttributes adds attributes to every entity metric-set.
func (*Entity) NewMetricSet ¶
func (e *Entity) NewMetricSet(eventType string, nameSpacingAttributes ...attribute.Attribute) *metric.Set
NewMetricSet returns a new instance of Set with its sample attached to the integration.
type EntityKey ¶
type EntityKey string
EntityKey unique identifier for an entity within a New Relic customer account.
type EntityMetadata ¶
type EntityMetadata struct { Name string `json:"name"` Namespace string `json:"type"` // For compatibility reasons we keep the type. IDAttrs IDAttributes `json:"id_attributes"` // For entity Key uniqueness // contains filtered or unexported fields }
EntityMetadata stores entity Metadata
func (*EntityMetadata) EqualsTo ¶
func (m *EntityMetadata) EqualsTo(b *EntityMetadata) bool
EqualsTo returns true when both metadata are equal.
func (*EntityMetadata) Key ¶
func (m *EntityMetadata) Key() (EntityKey, error)
Key generates the entity key based on the entity metadata.
type IDAttribute ¶
IDAttribute identifier attribute key-value pair.
func NewIDAttribute ¶
func NewIDAttribute(key, value string) IDAttribute
NewIDAttribute creates new identifier attribute.
type IDAttributes ¶
type IDAttributes []IDAttribute
IDAttributes list of identifier attributes used to provide uniqueness for an entity key.
func (IDAttributes) Less ¶
func (a IDAttributes) Less(i, j int) bool
Less is part of sort.Interface.
type Integration ¶
type Integration struct { Name string `json:"name"` ProtocolVersion string `json:"protocol_version"` IntegrationVersion string `json:"integration_version"` Entities []*Entity `json:"data"` // 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) 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) CreateUniqueID ¶
func (i *Integration) CreateUniqueID() string
CreateUniqueID will generate an md5 string from integration arguments to unique identify the integration instance.
func (*Integration) Entity ¶
func (i *Integration) Entity(name, namespace string, idAttributes ...IDAttribute) (e *Entity, err error)
Entity method creates or retrieves an already created entity.
func (*Integration) EntityReportedBy ¶
func (i *Integration) EntityReportedBy(reportingEntity EntityKey, reportedEntityName, reportedEntityNamespace string, idAttributes ...IDAttribute) (e *Entity, err error)
EntityReportedBy entity being reported from another entity that is not producing the actual entity data.
func (*Integration) EntityReportedVia ¶
func (i *Integration) EntityReportedVia(endpoint, reportedEntityName, reportedEntityNamespace string, idAttributes ...IDAttribute) (e *Entity, err error)
EntityReportedVia entity being reported from a known endpoint.
func (*Integration) LocalEntity ¶
func (i *Integration) LocalEntity() *Entity
LocalEntity retrieves default (local) entity to monitorize.
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) Publish ¶
func (i *Integration) Publish() error
Publish runs all necessary tasks before publishing the data. Currently, it stores the Storer, prints the JSON representation of the integration using a writer (stdout by default) and re-initializes the integration object (allowing re-use it during the execution of your code).
type Option ¶
type Option func(*Integration) error
Option sets an option on integration level.
func Args ¶
func Args(a interface{}) Option
Args sets the destination struct (pointer) where the command-line flags will be parsed to.
func InMemoryStore ¶
func InMemoryStore() Option
InMemoryStore replaces the metrics storage by an ephemeral in-memory store.