service

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APMZProxy

type APMZProxy struct {
	Printer format.Printer
	Clients []apmz.TelemetryClient
}

APMZProxy will proxy calls to the APMZ client or print if running locally

func (APMZProxy) Close added in v0.5.0

func (apmzp APMZProxy) Close(ctx context.Context)

Close will flush and close the underlying App Insights clients

func (APMZProxy) Track

func (apmzp APMZProxy) Track(item apmz.Telemetry)

Track will either send to the client or print depending if the proxy printer is set

type APMer

type APMer interface {
	Track(telemetry apmz.Telemetry)
	Close(ctx context.Context)
}

APMer provides the behaviors needed to send events to Azure Application Insights

type CommandServicer

type CommandServicer interface {
	GetMetadater() (Metadater, error)
	GetAPMer() (APMer, error)
	GetPrinter() format.Printer
	GetKeys() []string
}

CommandServicer provides all functionality needed for command execution

type Event

type Event struct {
	Type string         `json:"type,omitempty"`
	Item apmz.Telemetry `json:"item,omitempty"`
}

Event is a typed batch event

func (*Event) UnmarshalJSON

func (evt *Event) UnmarshalJSON(b []byte) error

UnmarshalJSON takes json bytes and turns them into an event

type EventType

type EventType string

EventType represents the enumeration of all the event types the Batch command understands

const (
	// Trace is a "traces" event type in Application Insights
	Trace EventType = "trace"
	// Metric is a "customMetrics" event type in Application Insights
	Metric EventType = "metric"
)

type Metadater added in v0.5.0

type Metadater interface {
	GetInstance(ctx context.Context, middleware ...azmeta.MiddlewareFunc) (*azmeta.Instance, error)
	GetAttestation(ctx context.Context, nonce string, middleware ...azmeta.MiddlewareFunc) (*azmeta.Attestation, error)
	GetScheduledEvents(ctx context.Context, middleware ...azmeta.MiddlewareFunc) (*azmeta.ScheduledEvents, error)
	AckScheduledEvents(ctx context.Context, acks azmeta.AckEvents, middleware ...azmeta.MiddlewareFunc) error
	GetIdentityToken(ctx context.Context, tokenReq azmeta.ResourceAndIdentity, middleware ...azmeta.MiddlewareFunc) (*azmeta.IdentityToken, error)
}

Metadater abstracts the underlying implementation of the instance metadata service

type Registry

type Registry struct {
	APMerFactory    func() (APMer, error)
	PrinterFactory  func() format.Printer
	APIKeysFactory  func() []string
	MetadataFactory func() (Metadater, error)
}

Registry holds the factories and services needed for command execution

func (*Registry) GetAPMer

func (r *Registry) GetAPMer() (APMer, error)

GetAPMer returns an instance of an Azure Application Insights client

func (*Registry) GetKeys added in v0.5.0

func (r *Registry) GetKeys() []string

GetKeys will return the api keys for application insights

func (*Registry) GetMetadater added in v0.5.0

func (r *Registry) GetMetadater() (Metadater, error)

GetMetadater returns an instance of an instance metadata service

func (*Registry) GetPrinter

func (r *Registry) GetPrinter() format.Printer

GetPrinter will return a printer for printing command output

Jump to

Keyboard shortcuts

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