Path: blob/main/component/prometheus/exporter/memcached/memcached.go
4096 views
package memcached12import (3"time"45"github.com/grafana/agent/component"6"github.com/grafana/agent/component/prometheus/exporter"7"github.com/grafana/agent/pkg/integrations"8"github.com/grafana/agent/pkg/integrations/memcached_exporter"9)1011func init() {12component.Register(component.Registration{13Name: "prometheus.exporter.memcached",14Args: Arguments{},15Exports: exporter.Exports{},16Build: exporter.New(createExporter, "memcached"),17})18}1920func createExporter(opts component.Options, args component.Arguments) (integrations.Integration, error) {21a := args.(Arguments)22return a.Convert().NewIntegration(opts.Logger)23}2425// DefaultArguments holds the default arguments for the prometheus.exporter.memcached component.26var DefaultArguments = Arguments{27Address: "localhost:11211",28Timeout: time.Second,29}3031// Arguments configures the prometheus.exporter.memcached component.32type Arguments struct {33// Address is the address of the memcached server to connect to (host:port).34Address string `river:"address,attr,optional"`3536// Timeout is the timeout for the memcached exporter to use when connecting to the37// memcached server.38Timeout time.Duration `river:"timeout,attr,optional"`39}4041// UnmarshalRiver implements River unmarshalling for Arguments.42func (a *Arguments) UnmarshalRiver(f func(interface{}) error) error {43*a = DefaultArguments4445type args Arguments46return f((*args)(a))47}4849func (a Arguments) Convert() *memcached_exporter.Config {50return &memcached_exporter.Config{51MemcachedAddress: a.Address,52Timeout: a.Timeout,53}54}555657