metrics

package
v8.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package metrics implements Relay's integration with OpenCensus.

Index

Constants

This section is empty.

Variables

View Source
var (

	// BrowserConns is a Measure representing the current number of active stream connections from browsers.
	BrowserConns = Measure{/* contains filtered or unexported fields */}

	// MobileConns is a Measure representing the current number of active stream connections from mobile SDKs.
	MobileConns = Measure{/* contains filtered or unexported fields */}

	// ServerConns is a is a Measure representing the current number of active stream connections from server-side SDKs.
	ServerConns = Measure{/* contains filtered or unexported fields */}

	// NewBrowserConns is a Measure representing the cumulative number of stream connections from browsers.
	NewBrowserConns = Measure{/* contains filtered or unexported fields */}

	// NewMobileConns is a Measure representing the cumulative number of stream connections from mobile SDKs.
	NewMobileConns = Measure{/* contains filtered or unexported fields */}

	// NewServerConns is a Measure representing the cumulative number of stream connections from server-side SDKs.
	NewServerConns = Measure{/* contains filtered or unexported fields */}

	// BrowserRequests is a Measure representing the number of HTTP requests from browsers.
	BrowserRequests = Measure{/* contains filtered or unexported fields */}

	// MobileRequests is a Measure representing the number of HTTP requests from mobile SDKs.
	MobileRequests = Measure{/* contains filtered or unexported fields */}

	// ServerRequests is a Measure representing the number of HTTP requests from server-side SDKs.
	ServerRequests = Measure{/* contains filtered or unexported fields */}

	// PollingRequests is a Measure representing the total number of polling style requests received from server-side SDKs.
	PollingRequests = Measure{/* contains filtered or unexported fields */}
)

Functions

func WithCount

func WithCount(ctx context.Context, userAgent string, f func(), measure Measure)

WithCount runs a function and records a single-unit increment for the specified metric.

func WithGauge

func WithGauge(ctx context.Context, userAgent string, f func(), measure Measure)

WithGauge increments the specified metric before running the function and then decrements it (for use with the active connection metrics).

func WithRouteCount

func WithRouteCount(ctx context.Context, userAgent, route, method string, f func(), measure Measure)

WithRouteCount records a route hit and starts a trace. For stream connections, the duration of the stream connection is recorded

Types

type EnvironmentManager

type EnvironmentManager struct {
	// contains filtered or unexported fields
}

EnvironmentManager controls the metrics exporter activity for a specific LD environment.

func (*EnvironmentManager) FlushEventsExporter

func (em *EnvironmentManager) FlushEventsExporter()

FlushEventsExporter is used in testing to trigger the events exporter to post data to the event publisher.

func (*EnvironmentManager) GetOpenCensusContext

func (em *EnvironmentManager) GetOpenCensusContext() context.Context

GetOpenCensusContext returns the Context for this EnvironmentManager's OpenCensus operations.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is the top-level object that controls all of our metrics exporter activity. It should be created and retained by the Relay instance, and closed when the Relay instance is closed.

func NewManager

func NewManager(
	metricsConfig config.MetricsConfig,
	flushInterval time.Duration,
	loggers ldlog.Loggers,
) (*Manager, error)

NewManager creates a Manager instance.

func (*Manager) AddEnvironment

func (m *Manager) AddEnvironment(envName string, publisher events.EventPublisher) (*EnvironmentManager, error)

AddEnvironment creates a new EnvironmentManager with its own OpenCensus context that includes a tag for the environment name, and registers its exporter.

func (*Manager) Close

func (m *Manager) Close()

Close shuts down the Manager and all of its EnvironmentManager instances.

func (*Manager) RemoveEnvironment

func (m *Manager) RemoveEnvironment(em *EnvironmentManager)

RemoveEnvironment shuts down this EnvironmentManager and removes it from the Manager.

type Measure

type Measure struct {
	// contains filtered or unexported fields
}

Measure represents one of the types of metrics that can be passed to WithCount, WithGauge, or WithRouteCount.

Jump to

Keyboard shortcuts

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