package integrations12import (3"context"4"net/http"56"github.com/go-kit/log"7"github.com/grafana/agent/pkg/integrations/config"8)910// Config provides the configuration and constructor for an integration.11type Config interface {12// Name returns the name of the integration and the key that will be used to13// pull the configuration from the Agent config YAML.14Name() string1516// InstanceKey should return the key that represents the config, which will be17// used to populate the value of the `instance` label for metrics.18//19// InstanceKey is given an agentKey that represents the agent process. This20// may be used if the integration being configured applies to an entire21// machine.22//23// This method may not be invoked if the instance key for a Config is24// overridden.25InstanceKey(agentKey string) (string, error)2627// NewIntegration returns an integration for the given with the given logger.28NewIntegration(l log.Logger) (Integration, error)29}3031// An Integration is a process that integrates with some external system and32// pulls telemetry data.33type Integration interface {34// MetricsHandler returns an http.Handler that will return metrics.35MetricsHandler() (http.Handler, error)3637// ScrapeConfigs returns a set of scrape configs that determine where metrics38// can be scraped.39ScrapeConfigs() []config.ScrapeConfig4041// Run should start the integration and do any required tasks, if necessary.42// For example, an Integration that requires a persistent connection to a43// database would establish that connection here. If the integration doesn't44// need to do anything, it should wait for the ctx to be canceled.45//46// An error will be returned if the integration failed. Integrations should47// not return the ctx error.48Run(ctx context.Context) error49}505152