appinsightsexporter

package
v0.0.0-...-4d33260 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetAttributeAsPropertyOrMeasurement

func SetAttributeAsPropertyOrMeasurement(
	kv attribute.KeyValue,
	properties map[string]string,
	measurements map[string]float64)

func SetListener

func SetListener(listener func(s string))

Sets the diagnostics logging listener for telemetry related warnings. This is NOT thread-safe, and thus should be set once, early in application lifecycle.

func SpanToEnvelope

func SpanToEnvelope(span trace.ReadOnlySpan) *contracts.Envelope

Converts an OpenTelemetry span into an ApplicationInsights envelope suitable for transmission.

Types

type BackendResponse

type BackendResponse struct {
	ItemsReceived int                     `json:"itemsReceived"`
	ItemsAccepted int                     `json:"itemsAccepted"`
	Errors        ItemTransmissionResults `json:"errors"`
}

Structures returned by data collector

type EndpointConfig

type EndpointConfig struct {
	EndpointUrl        string
	InstrumentationKey string
}

func NewEndpointConfig

func NewEndpointConfig(connectionString string) (EndpointConfig, error)

NewEndpointConfig parses a connection string, returning the endpoint configuration from the connection string.

The connection string schema for AppInsights can be found at https://learn.microsoft.com/azure/azure-monitor/app/sdk-connection-string?tabs=net#schema

type ItemTransmissionResult

type ItemTransmissionResult struct {
	Index      int    `json:"index"`
	StatusCode int    `json:"statusCode"`
	Message    string `json:"message"`
}

func (*ItemTransmissionResult) CanRetry

func (result *ItemTransmissionResult) CanRetry() bool

type ItemTransmissionResults

type ItemTransmissionResults []*ItemTransmissionResult

This needs to be its own type because it implements sort.Interface

func (ItemTransmissionResults) Len

func (results ItemTransmissionResults) Len() int

func (ItemTransmissionResults) Less

func (results ItemTransmissionResults) Less(i, j int) bool

func (ItemTransmissionResults) Swap

func (results ItemTransmissionResults) Swap(i, j int)

type TelemetryItems

type TelemetryItems []contracts.Envelope

func (*TelemetryItems) Deserialize

func (items *TelemetryItems) Deserialize(serialized []byte)

func (TelemetryItems) Serialize

func (items TelemetryItems) Serialize() []byte

type TransmissionResult

type TransmissionResult struct {
	StatusCode int
	RetryAfter *time.Time
	Response   *BackendResponse
}

func (*TransmissionResult) CanRetry

func (result *TransmissionResult) CanRetry() bool

func (*TransmissionResult) GetRetryItems

func (result *TransmissionResult) GetRetryItems(payload []byte, items TelemetryItems) ([]byte, TelemetryItems)

func (*TransmissionResult) IsFailure

func (result *TransmissionResult) IsFailure() bool

func (*TransmissionResult) IsPartialSuccess

func (result *TransmissionResult) IsPartialSuccess() bool

func (*TransmissionResult) IsSuccess

func (result *TransmissionResult) IsSuccess() bool

func (*TransmissionResult) IsThrottled

func (result *TransmissionResult) IsThrottled() bool

type Transmitter

type Transmitter interface {
	Transmit(payload []byte, items TelemetryItems) (*TransmissionResult, error)
}

func NewTransmitter

func NewTransmitter(endpointAddress string, client *http.Client) Transmitter

Jump to

Keyboard shortcuts

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