-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamic integration registration system (#278)
* add dynamic integration registration system This commit adds a dynamic integration registration system similar to (and mostly copied from) Prometheus' SD registration mechanism. * fix lint error * fix runtime errors * refactor integrations 1. Integration interface moved to integrations 2. Integration Config interface now responsible for providing name/config * marshal manager config with embedded integrations
- Loading branch information
Showing
29 changed files
with
742 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Package install registers all in-source integrations for use. | ||
package install | ||
|
||
import ( | ||
_ "github.com/grafana/agent/pkg/integrations/agent" // register agent | ||
_ "github.com/grafana/agent/pkg/integrations/consul_exporter" // register consul_exporter | ||
_ "github.com/grafana/agent/pkg/integrations/dnsmasq_exporter" // register dnsmasq_exporter | ||
_ "github.com/grafana/agent/pkg/integrations/memcached_exporter" // register memcached_exporter | ||
_ "github.com/grafana/agent/pkg/integrations/mysqld_exporter" // register mysqld_exporter | ||
_ "github.com/grafana/agent/pkg/integrations/node_exporter" // register node_exporter | ||
_ "github.com/grafana/agent/pkg/integrations/postgres_exporter" // register postgres_exporter | ||
_ "github.com/grafana/agent/pkg/integrations/process_exporter" // register process_exporter | ||
_ "github.com/grafana/agent/pkg/integrations/redis_exporter" // register redis_exporter | ||
_ "github.com/grafana/agent/pkg/integrations/statsd_exporter" // register statsd_exporter | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package integrations | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/go-kit/kit/log" | ||
"github.com/gorilla/mux" | ||
"github.com/grafana/agent/pkg/integrations/config" | ||
) | ||
|
||
// Config provides the configuration and constructor for an integration. | ||
type Config interface { | ||
// Name returns the name of the integration and the key that will be used to | ||
// pull the configuration from the Agent config YAML. | ||
Name() string | ||
|
||
// CommonConfig returns the set of common configuration values present across | ||
// all integrations. | ||
CommonConfig() config.Common | ||
|
||
// NewIntegration returns an integration for the given with the given logger. | ||
NewIntegration(l log.Logger) (Integration, error) | ||
} | ||
|
||
// An Integration is a process that integrates with some external system and | ||
// pulls telemetry data. | ||
type Integration interface { | ||
// RegisterRoutes should register any HTTP handlers needed for the | ||
// integrations. The mux router provided will be a subrouter for the path | ||
// /integrations/<integration name>, where the integration name is retrieved | ||
// by the config that created this integration. | ||
RegisterRoutes(r *mux.Router) error | ||
|
||
// ScrapeConfigs returns a set of scrape configs that determine where metrics | ||
// can be scraped. | ||
ScrapeConfigs() []config.ScrapeConfig | ||
|
||
// Run should start the integration and do any required tasks, if necessary. | ||
// For example, an Integration that requires a persistent connection to a | ||
// database would establish that connection here. If the integration doesn't | ||
// need to do anything, it should wait for the ctx to be canceled. | ||
Run(ctx context.Context) error | ||
} |
Oops, something went wrong.