azuremonitorexporter

package module
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: Apache-2.0 Imports: 19 Imported by: 4

README

Azure Monitor Exporter

This exporter sends logs and trace data to Azure Monitor.

Configuration

The following settings are required:

  • instrumentation_key (no default): Application Insights instrumentation key, which can be found in the Application Insights resource in the Azure Portal.

The following settings can be optionally configured:

  • endpoint (default = "https://dc.services.visualstudio.com/v2/track"): The endpoint URL where data will be submitted.
  • maxbatchsize (default = 1024): The maximum number of telemetry items that can be submitted in each request. If this many items are buffered, the buffer will be flushed before maxbatchinterval expires.
  • maxbatchinterval (default = 10s): The maximum time to wait before sending a batch of telemetry.

Example:

exporters:
  azuremonitor:
    instrumentation_key: b1cd0778-85fc-4677-a3fa-79d3c23e0efd

Attribute mapping

Traces

This exporter maps OpenTelemetry trace data to Application Insights data model using the following schema.

The OpenTelemetry SpanKind determines the Application Insights telemetry type.

OpenTelemetry SpanKind Application Insights telemetry type
CLIENT, PRODUCER, INTERNAL Dependency
SERVER, CONSUMER Request

The exporter follows the semantic conventions to fill the Application Insights specific telemetry properties. The following table shows a basic mapping.

Application Insights property OpenTelemetry attribute Default
Request.Name http.method, http.route or rpc.system span name
Request.Url http.scheme, http.host, http.target
Request.Source http.client_ip or net.peer.name
Request.ResponseCode http.status_code or status_code "0"
Request.Success http.status_code or status_code true
Dependency.Name http.method, http.route span name
Dependency.Data http.url or span name or db.statement
Dependency.Type "HTTP" or rpc.system or db.system or "InProc"
Dependency.Target host of http.url or net.peer.name
Dependency.ResultCode http.status_code or status_code "0"
Dependency.Success http.status_code or status_code true

The exact mapping can be found here.

All attributes are also mapped to custom properties if they are booleans or strings and to custom measurements if they are ints or doubles.

Logs

This exporter saves log records to Application Insights traces table. OpenTelemetry Log Data Model TraceId is mapped to operation_id column. TraceId and SpanId are also mapped to TraceId and SpanId tags in customDimensions column.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accept added in v0.6.0

func Accept(traces ptrace.Traces, v TraceVisitor)

Accept method is called to start the iteration process

func NewFactory added in v0.8.0

func NewFactory() component.ExporterFactory

NewFactory returns a factory for Azure Monitor exporter.

Types

type Config

type Config struct {
	config.ExporterSettings `mapstructure:",squash"`
	Endpoint                string        `mapstructure:"endpoint"`
	InstrumentationKey      string        `mapstructure:"instrumentation_key"`
	MaxBatchSize            int           `mapstructure:"maxbatchsize"`
	MaxBatchInterval        time.Duration `mapstructure:"maxbatchinterval"`
}

Config defines configuration for Azure Monitor

type DatabaseAttributes added in v0.6.0

type DatabaseAttributes struct {
	DBSystem              string
	DBConnectionString    string
	DBUser                string
	DBName                string
	DBStatement           string
	DBOperation           string
	DBMSSQLInstanceName   string
	DBJDBCDriverClassName string
	DBCassandraKeyspace   string
	DBHBaseNamespace      string
	DBRedisDatabaseIndex  string
	DBMongoDBCollection   string
	NetworkAttributes     NetworkAttributes
}

DatabaseAttributes is the set of known attributes for Database Spans

func (*DatabaseAttributes) MapAttribute added in v0.6.0

func (attrs *DatabaseAttributes) MapAttribute(k string, v pcommon.Value) bool

MapAttribute attempts to map a Span attribute to one of the known types

type HTTPAttributes added in v0.6.0

type HTTPAttributes struct {
	// common attributes
	// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#common-attributes
	HTTPMethod                            string
	HTTPURL                               string
	HTTPTarget                            string
	HTTPHost                              string
	HTTPScheme                            string
	HTTPStatusCode                        int64
	HTTPStatusText                        string
	HTTPFlavor                            string
	HTTPUserAgent                         string
	HTTPRequestContentLength              int64
	HTTPRequestContentLengthUncompressed  int64
	HTTPResponseContentLength             int64
	HTTPResponseContentLengthUncompressed int64

	// Server Span specific
	// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-server-semantic-conventions
	HTTPRoute      string
	HTTPServerName string
	HTTPClientIP   string

	// any net.*
	NetworkAttributes NetworkAttributes
}

HTTPAttributes is the set of known attributes for HTTP Spans

func (*HTTPAttributes) MapAttribute added in v0.6.0

func (attrs *HTTPAttributes) MapAttribute(k string, v pcommon.Value) bool

MapAttribute attempts to map a Span attribute to one of the known types

type MessagingAttributes added in v0.6.0

type MessagingAttributes struct {
	MessagingSystem                       string
	MessagingDestination                  string
	MessagingDestinationKind              string
	MessagingTempDestination              string
	MessagingProtocol                     string
	MessagingProtocolVersion              string
	MessagingURL                          string
	MessagingMessageID                    string
	MessagingConversationID               string
	MessagingMessagePayloadSize           int64
	MessagingMessagePayloadCompressedSize int64
	MessagingOperation                    string
	NetworkAttributes                     NetworkAttributes
}

MessagingAttributes is the set of known attributes for Messaging Spans

func (*MessagingAttributes) MapAttribute added in v0.6.0

func (attrs *MessagingAttributes) MapAttribute(k string, v pcommon.Value) bool

MapAttribute attempts to map a Span attribute to one of the known types

type NetworkAttributes added in v0.6.0

NetworkAttributes is the set of known network attributes

func (*NetworkAttributes) MapAttribute added in v0.6.0

func (attrs *NetworkAttributes) MapAttribute(k string, v pcommon.Value) bool

MapAttribute attempts to map a Span attribute to one of the known types

type RPCAttributes added in v0.6.0

type RPCAttributes struct {
	RPCSystem         string
	RPCService        string
	RPCMethod         string
	RPCGRPCStatusCode int64
	NetworkAttributes NetworkAttributes
}

RPCAttributes is the set of known attributes for RPC Spans

func (*RPCAttributes) MapAttribute added in v0.6.0

func (attrs *RPCAttributes) MapAttribute(k string, v pcommon.Value) bool

MapAttribute attempts to map a Span attribute to one of the known types

type TraceVisitor added in v0.6.0

type TraceVisitor interface {
	// contains filtered or unexported methods
}

TraceVisitor interface defines a iteration callback when walking through traces

Jump to

Keyboard shortcuts

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