metrics

package
v0.0.0-...-1ae16a7 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MeterName  = "github.com/probe-lab/ants-watch"
	TracerName = "github.com/probe-lab/ants-watch"
)

Variables

View Source
var HealthStatus = atomic.NewBool(false)

HealthStatus is a global variable that indicates the health of the current process. This could either be "hey, I've started crawling and everything works fine" or "hey, I'm monitoring the network and all good".

Functions

func ListenAndServe

func ListenAndServe(host string, port int)

ListenAndServe starts an HTTP server and exposes prometheus and pprof metrics. It also exposes a health endpoint that can be probed with `ants health`.

func NewMeterProvider

func NewMeterProvider() (metric.MeterProvider, error)

NewMeterProvider initializes a new opentelemetry meter provider that exports metrics using prometheus. To serve the prometheus endpoint call ListenAndServe down below.

func NewTracerProvider

func NewTracerProvider(ctx context.Context, host string, port int) (trace.TracerProvider, error)

NewTracerProvider initializes a new tracer provider to send traces to the given host and port combination. If any of the two values is the zero value this function will return a no-op tracer provider which effectively disables tracing.

Types

type Telemetry

type Telemetry struct {
	Tracer                  trace.Tracer
	AntsCountGauge          metric.Int64Gauge
	TrackedRequestsCounter  metric.Int64Counter
	BulkInsertCounter       metric.Int64Counter
	BulkInsertSizeHist      metric.Int64Histogram
	BulkInsertLatencyMsHist metric.Int64Histogram
	DroppedRequestsCounter  metric.Int64Counter
	ConnectCounter          metric.Int64Counter
	DisconnectCounter       metric.Int64Counter
}

func NewTelemetry

func NewTelemetry(tp trace.TracerProvider, mp metric.MeterProvider) (*Telemetry, error)

Jump to

Keyboard shortcuts

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