telemetry

package
v0.0.0-...-5f38cae Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WgFederatedGraphId = attribute.Key("wg.federated_graph.id")
	WgOrganizationId   = attribute.Key("wg.organization.id")
)
View Source
const (
	DefaultServerName = "cosmo-graphqlmetrics"
)
View Source
const (
	RequestCount = "http.requests.total"
)

Variables

This section is empty.

Functions

func NewPrometheusServer

func NewPrometheusServer(logger *zap.Logger, listenAddr string, path string, registry *prometheus.Registry) *http.Server

Types

type Config

type Config struct {
	// Name represents the service name for metrics. The default value is cosmo-router.
	Name string
	// Version represents the service version for metrics. The default value is dev.
	Version string
	// Prometheus includes the Prometheus configuration
	Prometheus PrometheusConfig
	// CustomMetrics to be collected
	CustomMetrics CustomMetrics
	// MetricStore the store to collect the metrics in
	MetricStore Provider
}

Config represents the telemetry configuration.

func NewTelemetryConfig

func NewTelemetryConfig(serviceVersion string, prometheusConfig PrometheusConfig) *Config

NewTelemetryConfig creates the config to be used for the telemetry inside graphqlmetrics.

func (*Config) IsEnabled

func (c *Config) IsEnabled() bool

func (*Config) NewPrometheusMeterProvider

func (c *Config) NewPrometheusMeterProvider(ctx context.Context) (*sdkmetric.MeterProvider, *prometheus.Registry, error)

func (*Config) ObservabilityInterceptor

func (c *Config) ObservabilityInterceptor() connect.UnaryInterceptorFunc

type CustomMetrics

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

type PromMetricStore

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

func (*PromMetricStore) MeasureRequestCount

func (h *PromMetricStore) MeasureRequestCount(ctx context.Context, attr ...attribute.KeyValue)

type PrometheusConfig

type PrometheusConfig struct {
	Enabled      bool
	ListenAddr   string
	Path         string
	TestRegistry *prometheus.Registry
}

type Provider

type Provider interface {
	MeasureRequestCount(ctx context.Context, attr ...attribute.KeyValue)
}

func NewPromMetricStore

func NewPromMetricStore(logger *zap.Logger, meterProvider *metric.MeterProvider, baseAttributes []attribute.KeyValue) (Provider, error)

Jump to

Keyboard shortcuts

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