telemetry

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 11 Imported by: 0

README

Conduit Telemetry

The goal is to gain information about how our users use Conduit in the wild. This currently does not include things like logging (logrus) or metrics (Prometheus and Datadog for internal performance tests).

Implementation

Telemetry related utilities are in this directory.

Configurations

The conduit.yml config file includes a telemetry boolean, and optional fields to enter the OpenSearch URI, credentials (username/password), and Index name. When true, telemetry.Config is initialized with the optional fields. The GUID is generated when the pipeline is started, and saved to the pipeline's metadata.json. If the GUID already exists, it will be read from the file.

Client

The configuration and client is represented by the telemetry.Client interface and will use the official Go opensearch client by default. Users can also define their own clients to send telemetry events. This will also have client functions to write to OpenSearch using the official Go client. Currently, the default telemetry client marshalls the marshalls the telemetry.Event struct into JSON before sending the event.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	MakeTelemetryStartupEvent() Event
	SendEvent(event Event) error
}

Client represents the Telemetry client and config

type Config

type Config struct {
	Enable    bool
	SendToLog bool
	URI       string
	Name      string
	GUID      string
	Index     string
	UserName  string
	Password  string
}

Config represents the configuration of Telemetry logging

func MakeTelemetryConfig

func MakeTelemetryConfig(telemetryURI, index, username, password string) Config

MakeTelemetryConfig initializes a new TelemetryConfig.

type Event

type Event struct {
	// Time at which the event was created
	Time time.Time `json:"timestamp"`
	// Event message
	Message string `json:"message"`
	// Unique ID assigned to the pipeline upon initialization
	GUID string `json:"guid"`
	// Version of conduit
	Version string `json:"version"`
}

Event represents a single event to be emitted to OpenSearch

type OpenSearchClient

type OpenSearchClient struct {
	Client          *opensearch.Client
	TelemetryConfig Config
}

OpenSearchClient holds the OpenSearch client and TelemetryConfig

func MakeOpenSearchClient

func MakeOpenSearchClient(cfg Config) (*OpenSearchClient, error)

MakeOpenSearchClient initializes a new TelemetryState.

func (*OpenSearchClient) MakeTelemetryStartupEvent

func (t *OpenSearchClient) MakeTelemetryStartupEvent() Event

MakeTelemetryStartupEvent sends a startup event when the pipeline is initialized.

func (*OpenSearchClient) SendEvent

func (t *OpenSearchClient) SendEvent(event Event) error

SendEvent sends a TelemetryEvent to OpenSearch.

Jump to

Keyboard shortcuts

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