sdk

module
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0

README

sdk Go Reference codecov experimental

WIP SDK from go-faster for instrumentation.

Packages

Package Description
autometer Automatic OpenTelemetry MeterProvider from environment
autotracer Automatic OpenTelemetry TracerProvider from environment
profiler Explicit pprof routes
zctx context.Context and tracing support for zap
gold Golden files in tests
app Automatic setup observability and run daemon

Environment variables

⚠️ The pprof listener is disabled by default and should be explicitly enabled by PPROF_ADDR.

Metrics and pprof can be served from same address if needed, set both addresses to the same value.

Name Description Example Default
OTEL_RESOURCE_ATTRIBUTES OTEL Resource attributes service.name=app
OTEL_SERVICE_NAME OTEL Service name app unknown_service
OTEL_EXPORTER_OTLP_PROTOCOL OTLP protocol to use http grpc
OTEL_PROPAGATORS OTEL Propagators none tracecontext,baggage
PPROF_ROUTES List of enabled pprof routes cmdline,profile See below
PPROF_ADDR Enable pprof and listen on addr 0.0.0.0:9010 N/A
OTEL_LOG_LEVEL Log level debug info
METRICS_ADDR Prometheus addr (fallback) localhost:9464 Prometheus addr
OTEL_METRICS_EXPORTER Metrics exporter to use prometheus otlp
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL Metrics OTLP protocol to use http grpc
OTEL_EXPORTER_PROMETHEUS_HOST Host of prometheus addr 0.0.0.0 localhost
OTEL_EXPORTER_PROMETHEUS_PORT Port of prometheus addr 9090 9464
OTEL_TRACES_EXPORTER Traces exporter to use otlp otlp
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL Traces OTLP protocol to use http grpc
Routes for pprof

List of enabled pprof routes

Name: PPROF_ROUTES

Default: profile,symbol,trace,goroutine,heap,threadcreate,block

TODO

  • Use slog
  • Support for short-lived tasks
    • Metric, trace push
    • No need for http listeners for profiling
  • Pyroscope compat

Code coverage

codecov

Directories

Path Synopsis
Package app implements OTEL, prometheus, graceful shutdown and other common application features for go-faster projects.
Package app implements OTEL, prometheus, graceful shutdown and other common application features for go-faster projects.
Package autometer provides an OpenTelemetry MeterProvider creation function.
Package autometer provides an OpenTelemetry MeterProvider creation function.
Package autotracer provides an OpenTelemetry TracerProvider creation function.
Package autotracer provides an OpenTelemetry TracerProvider creation function.
cmd
Package gold implements golden files.
Package gold implements golden files.
Package otelenv provides helpers for working with OTEL_RESOURCE_ATTRIBUTES.
Package otelenv provides helpers for working with OTEL_RESOURCE_ATTRIBUTES.
Package profiler implements pprof routes.
Package profiler implements pprof routes.
Package zctx is a context-aware zap logger.
Package zctx is a context-aware zap logger.

Jump to

Keyboard shortcuts

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