go.d Helper Packages
This directory contains go.d-specific reusable helpers. go.d collectors also use
shared Go helpers from src/go/pkg/* and logging helpers from src/go/logger.
For new go.d collectors, start with
src/go/plugin/go.d/docs/how-to-write-a-collector.md. For when and why to use
helper packages, read src/go/plugin/go.d/docs/helper-packages.md.
V2 Metrics And Charts
New go.d collectors MUST use framework V2:
src/go/pkg/metrixfor metric instruments andCollectorStore.src/go/plugin/framework/charttplforcharts.yamltemplates.src/go/plugin/framework/chartenginefor chart-template runtime behavior.src/go/plugin/framework/collectorapiforCollectorV2registration and lifecycle contracts.
If an existing V1 collector is being migrated, use
src/go/plugin/go.d/docs/migrate-v1-to-v2.md.
Common Collector Helpers
src/go/plugin/go.d/pkg/ndexecruns external commands.src/go/plugin/go.d/pkg/iprangeparses and checks IP ranges.src/go/plugin/go.d/pkg/logshelps parse application log files.src/go/pkg/matcherprovides selector/matcher implementations.src/go/pkg/confoptprovides duration and tri-state config option types.src/go/pkg/webprovides HTTP client configuration helpers.src/go/pkg/prometheusparses Prometheus endpoints; use it withsrc/go/pkg/web.src/go/pkg/tlscfgprovides TLS support.src/go/plugin/go.d/pkg/sqlqueryprovides reusable SQL row/query helpers.src/go/plugin/go.d/pkg/socketprovides TCP/UDP/Unix line-protocol clients.src/go/plugin/go.d/pkg/cloudauthprovides shared cloud authentication config/credential helpers.src/go/plugin/go.d/pkg/pingerprovides shared ping probing and latency/jitter calculations.
Legacy V1 Helpers
src/go/pkg/stmconverts structs intomap[string]int64. This is V1-shaped and MUST NOT be used as the metric path for new V2 collectors. It MAY be useful while maintaining legacy V1 collectors or building temporary migration parity tests that are removed from the final runtime path.src/go/plugin/go.d/pkg/oldmetrixprovides V1 metric vector helper types used by existing V1 collectors. New V2 collectors SHOULD usesrc/go/pkg/metrixinstead.