agent

module
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0

README

Deprecation notice: Grafana Agent has been deprecated and is now in Long-Term Support mode. We recommend migrating to the new Grafana Alloy collector, which is built on the foundation of Grafana Agent Flow.

For more information, read our blog posts about Alloy and how to easily migrate from Agent to Alloy:

Grafana Agent logo

Grafana Agent is an OpenTelemetry Collector distribution with configuration inspired by Terraform. It is designed to be flexible, performant, and compatible with multiple ecosystems such as Prometheus and OpenTelemetry.

Grafana Agent is based around components. Components are wired together to form programmable observability pipelines for telemetry collection, processing, and delivery.

NOTE: This page focuses mainly on "Flow mode," the Terraform-inspired revision of Grafana Agent.

Grafana Agent can collect, transform, and send data to:

Why use Grafana Agent?

  • Vendor-neutral: Fully compatible with the Prometheus, OpenTelemetry, and Grafana open source ecosystems.
  • Every signal: Collect telemetry data for metrics, logs, traces, and continuous profiles.
  • Scalable: Deploy on any number of machines to collect millions of active series and terabytes of logs.
  • Battle-tested: Grafana Agent extends the existing battle-tested code from the Prometheus and OpenTelemetry Collector projects.
  • Powerful: Write programmable pipelines with ease, and debug them using a built-in UI.
  • Batteries included: Integrate with systems like MySQL, Kubernetes, and Apache to get telemetry that's immediately useful.

Getting started

Check out our documentation to see:

Example

// Discover Kubernetes pods to collect metrics from.
discovery.kubernetes "pods" {
  role = "pod"
}

// Collect metrics from Kubernetes pods.
prometheus.scrape "default" {
  targets    = discovery.kubernetes.pods.targets
  forward_to = [prometheus.remote_write.default.receiver]
}

// Get an API key from disk.
local.file "apikey" {
  filename  = "/var/data/my-api-key.txt"
  is_secret = true
}

// Send metrics to a Prometheus remote_write endpoint.
prometheus.remote_write "default" {
  endpoint {
    url = "http://localhost:9009/api/prom/push"

    basic_auth {
      username = "MY_USERNAME"
      password = local.file.apikey.content
    }
  }
}

We maintain an example Docker Compose environment that can be used to launch dependencies to play with Grafana Agent locally.

Release cadence

A new minor release is planned every six weeks.

The release cadence is best-effort: if necessary, releases may be performed outside of this cadence, or a scheduled release date can be moved forwards or backwards.

Minor releases published on cadence include updating dependencies for upstream OpenTelemetry Collector code if new versions are available. Minor releases published outside of the release cadence may not include these dependency updates.

Patch and security releases may be created at any time.

Community

To engage with the Grafana Agent community:

Contribute

Refer to our contributors guide to learn how to contribute.

Directories

Path Synopsis
cmd
grafana-agent-flow
Command grafana-agent-flow is an Flow mode-only binary.
Command grafana-agent-flow is an Flow mode-only binary.
grafana-agent-service
Command grafana-agent-service is a Windows binary which manages Grafana Agent as a Windows service.
Command grafana-agent-service is a Windows binary which manages Grafana Agent as a Windows service.
grafana-agentctl
Command grafana-agentctl provides utilities for interacting with Grafana Agent.
Command grafana-agentctl provides utilities for interacting with Grafana Agent.
e2e module
internal
cmd/rivereval
Command rivereval reads a River file from disk, evaluates it as an expression, and prints the result as a River value.
Command rivereval reads a River file from disk, evaluates it as an expression, and prints the result as a River value.
component
Package component describes the interfaces which Flow components implement.
Package component describes the interfaces which Flow components implement.
component/all
Package all imports all known component packages.
Package all imports all known component packages.
component/common/config
Package config contains types from github.com/prometheus/common/config, but modifies them to be serializable with River.
Package config contains types from github.com/prometheus/common/config, but modifies them to be serializable with River.
component/common/net
Package http contains a River serializable definition of the dskit config in https://github.com/grafana/dskit/blob/main/server/server.go#L72.
Package http contains a River serializable definition of the dskit config in https://github.com/grafana/dskit/blob/main/server/server.go#L72.
component/discovery/docker
Package docker implements the discovery.docker component.
Package docker implements the discovery.docker component.
component/discovery/gce
Package gce implements the discovery.gce component.
Package gce implements the discovery.gce component.
component/discovery/kubelet
Package kubelet implements a discovery.kubelet component.
Package kubelet implements a discovery.kubelet component.
component/discovery/kubernetes
Package kubernetes implements a discovery.kubernetes component.
Package kubernetes implements a discovery.kubernetes component.
component/loki/process
The code in this package is adapted/ported over from grafana/loki/clients/pkg/logentry.
The code in this package is adapted/ported over from grafana/loki/clients/pkg/logentry.
component/loki/source/kubernetes
Package kubernetes implements the loki.source.kubernetes component.
Package kubernetes implements the loki.source.kubernetes component.
component/loki/source/kubernetes/kubetail
Package kubetail implements a log file tailer using the Kubernetes API.
Package kubetail implements a log file tailer using the Kubernetes API.
component/loki/source/kubernetes_events
Package kubernetes_events implements the loki.source.kubernetes_events component.
Package kubernetes_events implements the loki.source.kubernetes_events component.
component/module/git
Package git implements the module.git component.
Package git implements the module.git component.
component/otelcol/auth
Package auth provides utilities to create a Flow component from OpenTelemetry Collector authentication extensions.
Package auth provides utilities to create a Flow component from OpenTelemetry Collector authentication extensions.
component/otelcol/auth/basic
Package basic provides an otelcol.auth.basic component.
Package basic provides an otelcol.auth.basic component.
component/otelcol/auth/bearer
Package bearer provides an otelcol.auth.bearer component.
Package bearer provides an otelcol.auth.bearer component.
component/otelcol/auth/headers
Package headers provides an otelcol.auth.headers component.
Package headers provides an otelcol.auth.headers component.
component/otelcol/connector
Package connector exposes utilities to create a Flow component from OpenTelemetry Collector connectors.
Package connector exposes utilities to create a Flow component from OpenTelemetry Collector connectors.
component/otelcol/connector/host_info
Package host_info provides an otelcol.connector.host_info component.
Package host_info provides an otelcol.connector.host_info component.
component/otelcol/connector/spanlogs
Package spanlogs provides an otelcol.connector.spanlogs component.
Package spanlogs provides an otelcol.connector.spanlogs component.
component/otelcol/connector/spanmetrics
Package spanmetrics provides an otelcol.connector.spanmetrics component.
Package spanmetrics provides an otelcol.connector.spanmetrics component.
component/otelcol/exporter
Package exporter exposes utilities to create a Flow component from OpenTelemetry Collector exporters.
Package exporter exposes utilities to create a Flow component from OpenTelemetry Collector exporters.
component/otelcol/exporter/loadbalancing
Package loadbalancing provides an otelcol.exporter.loadbalancing component.
Package loadbalancing provides an otelcol.exporter.loadbalancing component.
component/otelcol/exporter/logging
Package logging provides an otelcol.exporter.logging component.
Package logging provides an otelcol.exporter.logging component.
component/otelcol/exporter/loki
Package loki provides an otelcol.exporter.loki component.
Package loki provides an otelcol.exporter.loki component.
component/otelcol/exporter/loki/internal/convert
Package convert implements conversion utilities to convert between OpenTelemetry Collector and Loki data.
Package convert implements conversion utilities to convert between OpenTelemetry Collector and Loki data.
component/otelcol/exporter/otlp
Package otlp provides an otelcol.exporter.otlp component.
Package otlp provides an otelcol.exporter.otlp component.
component/otelcol/exporter/otlphttp
Package otlphttp provides an otelcol.exporter.otlphttp component.
Package otlphttp provides an otelcol.exporter.otlphttp component.
component/otelcol/exporter/prometheus
Package prometheus provides an otelcol.exporter.prometheus component.
Package prometheus provides an otelcol.exporter.prometheus component.
component/otelcol/exporter/prometheus/internal/convert
Package convert implements conversion utilities to convert between OpenTelemetry Collector data and Prometheus data.
Package convert implements conversion utilities to convert between OpenTelemetry Collector data and Prometheus data.
component/otelcol/extension
Package extension provides utilities to create a Flow component from OpenTelemetry Collector extensions.
Package extension provides utilities to create a Flow component from OpenTelemetry Collector extensions.
component/otelcol/internal/lazyconsumer
Package lazyconsumer implements a lazy OpenTelemetry Collector consumer which can lazily forward request to another consumer implementation.
Package lazyconsumer implements a lazy OpenTelemetry Collector consumer which can lazily forward request to another consumer implementation.
component/otelcol/internal/scheduler
Package scheduler exposes utilities for scheduling and running OpenTelemetry Collector components.
Package scheduler exposes utilities for scheduling and running OpenTelemetry Collector components.
component/otelcol/processor
Package processor exposes utilities to create a Flow component from OpenTelemetry Collector processors.
Package processor exposes utilities to create a Flow component from OpenTelemetry Collector processors.
component/otelcol/processor/attributes
Package attributes provides an otelcol.processor.attributes component.
Package attributes provides an otelcol.processor.attributes component.
component/otelcol/processor/batch
Package batch provides an otelcol.processor.batch component.
Package batch provides an otelcol.processor.batch component.
component/otelcol/processor/discovery
Package discovery provides an otelcol.processor.discovery component.
Package discovery provides an otelcol.processor.discovery component.
component/otelcol/processor/k8sattributes
Package attributes provides an otelcol.processor.k8sattributes component.
Package attributes provides an otelcol.processor.k8sattributes component.
component/otelcol/processor/memorylimiter
Package memorylimiter provides an otelcol.processor.memory_limiter component.
Package memorylimiter provides an otelcol.processor.memory_limiter component.
component/otelcol/processor/probabilistic_sampler
Package probabilistic_sampler provides an otelcol.processor.probabilistic_sampler component.
Package probabilistic_sampler provides an otelcol.processor.probabilistic_sampler component.
component/otelcol/processor/span
Package span provides an otelcol.processor.span component.
Package span provides an otelcol.processor.span component.
component/otelcol/processor/tail_sampling
Package tail_sampling provides an otelcol.processor.tail_sampling component.
Package tail_sampling provides an otelcol.processor.tail_sampling component.
component/otelcol/processor/transform
Package transform provides an otelcol.processor.transform component.
Package transform provides an otelcol.processor.transform component.
component/otelcol/receiver
Package receiver utilities to create a Flow component from OpenTelemetry Collector receivers.
Package receiver utilities to create a Flow component from OpenTelemetry Collector receivers.
component/otelcol/receiver/jaeger
Package jaeger provides an otelcol.receiver.jaeger component.
Package jaeger provides an otelcol.receiver.jaeger component.
component/otelcol/receiver/kafka
Package kafka provides an otelcol.receiver.kafka component.
Package kafka provides an otelcol.receiver.kafka component.
component/otelcol/receiver/loki
Package loki provides an otelcol.receiver.loki component.
Package loki provides an otelcol.receiver.loki component.
component/otelcol/receiver/opencensus
Package opencensus provides an otelcol.receiver.opencensus component.
Package opencensus provides an otelcol.receiver.opencensus component.
component/otelcol/receiver/otlp
Package otlp provides an otelcol.receiver.otlp component.
Package otlp provides an otelcol.receiver.otlp component.
component/otelcol/receiver/prometheus
Package prometheus provides an otelcol.receiver.prometheus component.
Package prometheus provides an otelcol.receiver.prometheus component.
component/otelcol/receiver/prometheus/internal
Package internal is a near copy of https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.87.0/receiver/prometheusreceiver/internal A copy was made because the upstream package is internal.
Package internal is a near copy of https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.87.0/receiver/prometheusreceiver/internal A copy was made because the upstream package is internal.
component/otelcol/receiver/vcenter
Package vcenter provides an otelcol.receiver.vcenter component.
Package vcenter provides an otelcol.receiver.vcenter component.
component/otelcol/receiver/zipkin
Package zipkin provides an otelcol.receiver.zipkin component.
Package zipkin provides an otelcol.receiver.zipkin component.
component/pyroscope/scrape/internal/fastdelta
Package fastdelta tries to match up samples between two pprof profiles and take their difference.
Package fastdelta tries to match up samples between two pprof profiles and take their difference.
component/pyroscope/scrape/internal/pproflite
Package pproflite implements zero-allocation pprof encoding and decoding.
Package pproflite implements zero-allocation pprof encoding and decoding.
component/remote/http
Package http implements the remote.http component.
Package http implements the remote.http component.
component/remote/kubernetes
Package kubernetes implements the logic for remote.kubernetes.secret and remote.kubernetes.configmap component.
Package kubernetes implements the logic for remote.kubernetes.secret and remote.kubernetes.configmap component.
converter
Package converter exposes utilities to convert config files from other programs to Grafana Agent Flow configurations.
Package converter exposes utilities to convert config files from other programs to Grafana Agent Flow configurations.
converter/diag
Package diag exposes error types used throughout converter and a method to pretty-print them to the screen.
Package diag exposes error types used throughout converter and a method to pretty-print them to the screen.
featuregate
Package featuregate provides a way to gate features in the collector based on different options, such as the feature's stability level and user-defined minimum allowed stability level.
Package featuregate provides a way to gate features in the collector based on different options, such as the feature's stability level and user-defined minimum allowed stability level.
flow
Package flow implements the Flow component graph system.
Package flow implements the Flow component graph system.
flow/componenttest
Package componenttest provides utilities for testing Flow components.
Package componenttest provides utilities for testing Flow components.
flow/internal/dag
Package dag defines a Directed Acyclic Graph.
Package dag defines a Directed Acyclic Graph.
flow/internal/testcomponents
Package testcomponents contains components useful for testing.
Package testcomponents contains components useful for testing.
flow/internal/testservices
Package testservices contains services useful for testing.
Package testservices contains services useful for testing.
flow/tracing
Package tracing implements the tracing subsystem of Grafana Agent Flow.
Package tracing implements the tracing subsystem of Grafana Agent Flow.
flow/tracing/internal/jaegerremote
Package jaegerremote implements the Jaeger Remote protocol.
Package jaegerremote implements the Jaeger Remote protocol.
flowmode
Package flowmode is the entrypoint for Grafana Agent Flow.
Package flowmode is the entrypoint for Grafana Agent Flow.
runner
Package runner provides an API for generic goroutine scheduling.
Package runner provides an API for generic goroutine scheduling.
service
Package service defines a pluggable service for the Flow system.
Package service defines a pluggable service for the Flow system.
service/cluster
Package cluster implements the cluster service for Flow, where multiple instances of Flow connect to each other for work distribution.
Package cluster implements the cluster service for Flow, where multiple instances of Flow connect to each other for work distribution.
service/http
Package http implements the HTTP service for Flow.
Package http implements the HTTP service for Flow.
service/otel
Package otel implements the otel service for Flow.
Package otel implements the otel service for Flow.
service/ui
Package ui implements the UI service.
Package ui implements the UI service.
useragent
package useragent provides a consistent way to get a user agent for outbound http requests from Grafana Agent.
package useragent provides a consistent way to get a user agent for outbound http requests from Grafana Agent.
util/k8s
Package k8s spins up a Kubernetes cluster for testing.
Package k8s spins up a Kubernetes cluster for testing.
util/structwalk
Package structwalk allows you to "walk" the hierarchy of a struct.
Package structwalk allows you to "walk" the hierarchy of a struct.
util/subset
Package subset implements functions to check if one value is a subset of another.
Package subset implements functions to check if one value is a subset of another.
util/testappender
Package testappender exposes utilities to test code which writes to Prometheus storage.Appenders.
Package testappender exposes utilities to test code which writes to Prometheus storage.Appenders.
util/zapadapter
Package zapadapter allows github.com/go-kit/log to be used as a Zap core.
Package zapadapter allows github.com/go-kit/log to be used as a Zap core.
vcs
web/api
Package api implements the HTTP API used for the Grafana Agent Flow UI.
Package api implements the HTTP API used for the Grafana Agent Flow UI.
web/ui
Package ui exposes utilities to get a Handler for the Grafana Agent Flow UI.
Package ui exposes utilities to get a Handler for the Grafana Agent Flow UI.
cmd/agentlint Module
static
client
Package client provides a client interface to the Agent HTTP API.
Package client provides a client interface to the Agent HTTP API.
config/features
Package features enables a way to encode enabled features in a flag.FlagSet.
Package features enables a way to encode enabled features in a flag.FlagSet.
integrations/agent
Package agent is an "example" integration that has very little functionality, but is still useful in practice.
Package agent is an "example" integration that has very little functionality, but is still useful in practice.
integrations/apache_http
Package apache_http embeds https://github.com/Lusitaniae/apache_exporter
Package apache_http embeds https://github.com/Lusitaniae/apache_exporter
integrations/config
Package config provides common configuration structs shared among implementations of integrations.Integration.
Package config provides common configuration structs shared among implementations of integrations.Integration.
integrations/consul_exporter
Package consul_exporter embeds https://github.com/prometheus/consul_exporter
Package consul_exporter embeds https://github.com/prometheus/consul_exporter
integrations/dnsmasq_exporter
Package dnsmasq_exporter embeds https://github.com/google/dnsmasq_exporter
Package dnsmasq_exporter embeds https://github.com/google/dnsmasq_exporter
integrations/elasticsearch_exporter
Package elasticsearch_exporter instantiates the exporter from github.com/justwatchcom/elasticsearch_exporter - replaced for github.com/prometheus-community/elasticsearch_exporter Using the YAML config provided by the agent
Package elasticsearch_exporter instantiates the exporter from github.com/justwatchcom/elasticsearch_exporter - replaced for github.com/prometheus-community/elasticsearch_exporter Using the YAML config provided by the agent
integrations/install
Package install registers all in-source integrations for use.
Package install registers all in-source integrations for use.
integrations/memcached_exporter
Package memcached_exporter embeds https://github.com/google/memcached_exporter
Package memcached_exporter embeds https://github.com/google/memcached_exporter
integrations/mysqld_exporter
Package mysqld_exporter embeds https://github.com/prometheus/mysqld_exporter
Package mysqld_exporter embeds https://github.com/prometheus/mysqld_exporter
integrations/postgres_exporter
Package postgres_exporter embeds https://github.com/prometheus/postgres_exporter
Package postgres_exporter embeds https://github.com/prometheus/postgres_exporter
integrations/process_exporter
Package process_exporter embeds https://github.com/ncabatoff/process-exporter
Package process_exporter embeds https://github.com/ncabatoff/process-exporter
integrations/redis_exporter
Package redis_exporter embeds https://github.com/oliver006/redis_exporter
Package redis_exporter embeds https://github.com/oliver006/redis_exporter
integrations/snmp_exporter
Package snmp_exporter embeds https://github.com/prometheus/snmp_exporter
Package snmp_exporter embeds https://github.com/prometheus/snmp_exporter
integrations/statsd_exporter
Package statsd_exporter embeds https://github.com/prometheus/statsd_exporter
Package statsd_exporter embeds https://github.com/prometheus/statsd_exporter
integrations/v2
Package integrations provides a way to run and manage Grafana Agent "integrations," which integrate some external system (such as MySQL) to Grafana Agent's existing metrics, logging, and tracing subsystems.
Package integrations provides a way to run and manage Grafana Agent "integrations," which integrate some external system (such as MySQL) to Grafana Agent's existing metrics, logging, and tracing subsystems.
integrations/v2/agent
Package agent is an "example" integration that has very little functionality, but is still useful in practice.
Package agent is an "example" integration that has very little functionality, but is still useful in practice.
integrations/v2/apache_http
Package apache_http embeds https://github.com/Lusitaniae/apache_exporter
Package apache_http embeds https://github.com/Lusitaniae/apache_exporter
integrations/v2/autoscrape
Package autoscrape implements a scraper for integrations.
Package autoscrape implements a scraper for integrations.
integrations/v2/eventhandler
Package eventhandler watches for Kubernetes Event objects and hands them off to Agent's Logs subsystem (embedded promtail)
Package eventhandler watches for Kubernetes Event objects and hands them off to Agent's Logs subsystem (embedded promtail)
integrations/v2/snmp_exporter
Package snmp_exporter embeds https://github.com/prometheus/snmp_exporter
Package snmp_exporter embeds https://github.com/prometheus/snmp_exporter
logs
Package logs implements logs support for the Grafana Agent.
Package logs implements logs support for the Grafana Agent.
metrics
Package metrics implements a Prometheus-lite client for service discovery, scraping metrics into a WAL, and remote_write.
Package metrics implements a Prometheus-lite client for service discovery, scraping metrics into a WAL, and remote_write.
metrics/instance
Package instance provides a mini Prometheus scraper and remote_writer.
Package instance provides a mini Prometheus scraper and remote_writer.
metrics/instance/configstore
Package configstore abstracts the concepts of where instance files get retrieved.
Package configstore abstracts the concepts of where instance files get retrieved.
operator/assets
Package assets contains helper types used for loading in static assets when configuring the Grafana Agent.
Package assets contains helper types used for loading in static assets when configuring the Grafana Agent.
operator/config
Package config generates Grafana Agent configuration based on Kubernetes resources.
Package config generates Grafana Agent configuration based on Kubernetes resources.
operator/hierarchy
Package hierarchy provides tools to discover a resource hierarchy.
Package hierarchy provides tools to discover a resource hierarchy.
operator/logutil
Package logutil implements an adaptor for the go-kit logger, which is used in the Grafana Agent project, and go-logr, which is used in controller-runtime.
Package logutil implements an adaptor for the go-kit logger, which is used in the Grafana Agent project, and go-logr, which is used in controller-runtime.
server
Package server implements the HTTP and gRPC server used throughout Grafana Agent.
Package server implements the HTTP and gRPC server used throughout Grafana Agent.
tools
agentlint Module

Jump to

Keyboard shortcuts

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