Documentation ¶
Overview ¶
Package apm combines traces/metrics/logs and error aggregators to provide app observability
Index ¶
- Variables
- func OtelGRPCNewServerHandler(ignoredMethods ...string) stats.Handler
- func SetGlobal(apm *APM)
- type APM
- type HTTPMiddleware
- type Meter
- func (m *Meter) CounterAdd(ctx context.Context, name string, amount float64, attrs ...attribute.KeyValue)
- func (m *Meter) HistogramRecord(ctx context.Context, name string, value float64, attrs ...attribute.KeyValue)
- func (m *Meter) Observe(name string, collect func() float64, attrs ...attribute.KeyValue)
- type Options
- type Tracer
Constants ¶
This section is empty.
Variables ¶
var ( // TimeBucketsFast suits if expected response time is very high: 1ms..100ms // This buckets suits for cache storages (in-memory cache, Memcache, Redis) TimeBucketsFast = []float64{1, 3, 7, 15, 50, 100, 200, 500, 1000, 2000, 5000} // TimeBucketsMedium suits for most of GO APIs, where response time is between 50ms..500ms. // Works for wide range of systems because provides near-logarithmic buckets distribution. TimeBucketsMedium = []float64{1, 5, 15, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3500, 5000} // TimeBucketsSlow suits for relatively slow services, where expected response time is > 500ms. TimeBucketsSlow = []float64{50, 100, 200, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500, 3000, 4000, 5000} )
Functions ¶
Types ¶
type APM ¶
type APM struct {
// contains filtered or unexported fields
}
APM is the application performance monitoring service
func New ¶
New initializes APM service using options provided It has an internal tracer and meter created for the application It can also access the tracerprovider and meteterprovider, so we can integrate otel with other client (redis/kakfa...)
func (*APM) GetMeterProvider ¶
func (s *APM) GetMeterProvider() metric.MeterProvider
Use this to integrate otel with other client pkg (redis/kafka)
func (*APM) GetTracerProvider ¶
func (s *APM) GetTracerProvider() trace.TracerProvider
Use this to integrate otel with other client pkg (redis/kafka)
type HTTPMiddleware ¶
func NewHTTPMiddleware ¶
func NewHTTPMiddleware(opts ...otelhttp.Option) HTTPMiddleware
type Meter ¶
Meter - metric service
func NewMeter ¶
NewMeter create a global meter provider and a custom meter obj for the application's own usage we need both obj because the provider helps us integrate with other third party sdk like redis/kafka
func (*Meter) CounterAdd ¶
func (m *Meter) CounterAdd(ctx context.Context, name string, amount float64, attrs ...attribute.KeyValue)
CounterAdd lazily increments certain counter metric. The label set passed on the first time should be present every time, no sparse keys
type Options ¶
type Options struct { Debug bool Environment string ServiceName string ServiceVersion string TracesSampleRate float64 CollectorURL string PrometheusScrapePort uint16 // UseStdOut if true, will set the metrics exporter and trace exporter as stdout UseStdOut bool }
Options used for apm initialization
type Tracer ¶
Tracer represents common wrapper on any customTracer
func NewTracer ¶
func NewTracer(ctx context.Context, opts *Options, exporter sdktrace.SpanExporter) (trace.TracerProvider, *Tracer)
New create a global tracerProvider and a custom tracer for the application own usage we need both obj because tracerProvider is the way to integrate with other otel sdk