agent

module
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: Apache-2.0

README

Grafana Agent logo

Grafana Agent is a telemetry collector for sending metrics, logs, and trace data to the opinionated Grafana observability stack. It works best with:

Users of Prometheus operating at a massive scale (i.e., millions of active series) can struggle to run an unsharded singleton Prometheus instance: it becomes a single point of failure and requires a giant machine with a lot of resources allocated to it. Even with proper sharding across multiple Prometheus instances, using Prometheus to send data to a cloud vendor can seem redundant: why pay for cloud storage if data is already stored locally?

The Grafana Agent uses the same code as Prometheus, but tackles these issues by only using the most relevant parts of Prometheus for interaction with hosted metrics:

  1. Service Discovery
  2. Scraping
  3. Write Ahead Log (WAL)
  4. Remote Write

On top of these, the Grafana Agent enables easier sharding mechanisms that enable users to shard Agents across their cluster and lower the memory requirements per machine.

A typical deployment of the Grafana Agent for Prometheus metrics can see up to a 40% reduction in memory usage with equal scrape loads.

The Grafana Agent it can be used to send Prometheus metrics to any system that supports the Prometheus remote_write API.

Trade-offs

By heavily optimizing Prometheus for remote write and resource reduction, some trade-offs have been made:

  • You can't query the Agent; you can only query metrics from the remote write storage.
  • Recording rules aren't supported.
  • Alerts aren't supported.
  • When sharding the Agent, if your node has problems that interrupt metric availability, metrics tracking that node won't be sent for alerting on.

While the Agent can't use recording rules and alerts, remote_write systems such as Cortex currently support server-side rules and alerts. Note that this trade-off means that reliability of alerts are tied to the reliability of the remote system and alerts will be delayed at least by the time it takes for samples to reach the remote system.

Getting Started

When using Kubernetes this link offers the best guide.

Other installation methods can be found in our Production documentation.

More detailed documentation is provided as part of the repository.

Example

The example/ folder contains docker-compose configs and a local k3d/Tanka environment. Both examples deploy the Agent, Cortex and Grafana for testing the agent. See the docker-compose README and the k3d example README for more information.

Prometheus Vendoring

The Grafana Agent vendors a downstream Prometheus repository maintained by Grafana Labs. This is done so experimental features Grafana Labs wants to contribute upstream can first be tested and iterated on quickly within the Agent. We aim to always base our vendor off of a recent official Prometheus release and to keep the experimental changes not available in the upstream repository to a minimum.

Please refer to the pinned Prometheus Vendor Update Tracking issue for our current vendored Prometheus release.

For more context on our vendoring strategy, read our repo maintenance guide.

Getting Help

If you have any questions or feedback regarding the Grafana Agent:

Contributing

Any contributions are welcome and details can be found in our developers guide.

Directories

Path Synopsis
cmd
agentctl
Command agentctl provides utilities for interacting with Grafana Agent
Command agentctl provides utilities for interacting with Grafana Agent
grafana-agent-crow
Comand grafana-agent-crow is a correctness checker tool that validates that scraped metrics are delivered to a remote_write endpoint.
Comand grafana-agent-crow is a correctness checker tool that validates that scraped metrics are delivered to a remote_write endpoint.
e2e module
internal
cmd/agentlint Module
pkg
client
Package client provides a client interface to the Agent HTTP API.
Package client provides a client interface to the Agent HTTP API.
client/grafanacloud
Package grafanacloud provides an interface to the Grafana Cloud API.
Package grafanacloud provides an interface to the Grafana Cloud API.
crow
Package crow implements a correctness checker tool similar to Loki Canary.
Package crow implements a correctness checker tool similar to Loki Canary.
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/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
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/statsd_exporter
Package statsd_exporter embeds https://github.com/prometheus/statsd_exporter
Package statsd_exporter embeds https://github.com/prometheus/statsd_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/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.
util/structwalk
Package structwalk allows you to "walk" the hierarchy of a struct.
Package structwalk allows you to "walk" the hierarchy of a struct.
tools
agentlint Module

Jump to

Keyboard shortcuts

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