Skip to content

Commit

Permalink
Update remotecfg dep to use alloy-remote-config over `agent-remote-…
Browse files Browse the repository at this point in the history
…config` (#748)

* alloy-remote-config instead of agent-remote-config dependency

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>

* clean up go.mod

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>

---------

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
  • Loading branch information
erikbaranowski authored May 13, 2024
1 parent 12fb273 commit 6a195d6
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 49 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ internal API changes are not present.
Main (unreleased)
-----------------

### Breaking changes to non-GA functionality

- Update Public preview `remotecfg` to use `alloy-remote-config` instead of `agent-remote-config`. The
API has been updated to use the term `collector` over `agent`. (@erikbaranowski)

### Bugfixes

- Fixed an issue with `prometheus.scrape` in which targets that move from one
Expand Down
15 changes: 15 additions & 0 deletions docs/sources/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,18 @@ The release notes provide information about deprecations and breaking changes in
For a complete list of changes to {{< param "FULL_PRODUCT_NAME" >}}, with links to pull requests and related issues when available, refer to the [Changelog][].

[Changelog]: https://github.com/grafana/alloy/blob/main/CHANGELOG.md

## v1.2

### Breaking change: `remotecfg` block updated for Agent rename

{{< admonition type="note" >}}
This feature is in [Public preview][] and is not covered by {{< param "FULL_PRODUCT_NAME" >}} [backward compatibility][] guarantees.

[Public preview]: https://grafana.com/docs/release-life-cycle/
[backward compatibility]: ../introduction/backward-compatibility/
{{< /admonition >}}

The `remotecfg` block has been updated to use [alloy-remote-config](https://github.com/grafana/alloy-remote-config)
over [agent-remote-config](https://github.com/grafana/agent-remote-config). This change
aligns `remotecfg` API terminology with Alloy and includes updated endpoints.
27 changes: 13 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ require (
github.com/Shopify/sarama v1.38.1
github.com/alecthomas/kingpin/v2 v2.4.0
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9
github.com/aws/aws-sdk-go v1.51.22 // indirect
github.com/aws/aws-sdk-go-v2 v1.26.1
github.com/aws/aws-sdk-go-v2/config v1.27.11
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1
Expand All @@ -29,7 +28,6 @@ require (
github.com/cespare/xxhash/v2 v2.3.0
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
github.com/coreos/go-systemd/v22 v22.5.0
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dimchansky/utfbom v1.1.1
github.com/docker/docker v25.0.5+incompatible
github.com/docker/go-connections v0.5.0
Expand All @@ -54,7 +52,7 @@ require (
github.com/google/renameio/v2 v2.0.0
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/grafana/agent-remote-config v0.0.2
github.com/grafana/alloy-remote-config v0.0.4
github.com/grafana/alloy/syntax v0.1.0
github.com/grafana/beyla v1.5.1
github.com/grafana/ckit v0.0.0-20230906125525-c046c99a5c04
Expand All @@ -73,9 +71,7 @@ require (
github.com/grafana/snowflake-prometheus-exporter v0.0.0-20221213150626-862cad8e9538
github.com/grafana/tail v0.0.0-20230510142333-77b18831edf0
github.com/grafana/vmware_exporter v0.0.5-beta
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/hashicorp/consul/api v1.28.2
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-discover v0.0.0-20230724184603-e89ebd1b2f65
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/golang-lru v1.0.2
Expand All @@ -98,7 +94,6 @@ require (
github.com/lib/pq v1.10.9
github.com/miekg/dns v1.1.58
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
github.com/natefinch/atomic v1.0.1
github.com/ncabatoff/process-exporter v0.7.10
Expand All @@ -120,7 +115,6 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure v0.99.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/loki v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.99.0
Expand All @@ -131,14 +125,12 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filestatsreceiver v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/vcenterreceiver v0.99.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.99.0
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e // indirect
github.com/opentracing-contrib/go-stdlib v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/ory/dockertest/v3 v3.8.1
github.com/oschwald/geoip2-golang v1.9.0
github.com/oschwald/maxminddb-golang v1.11.0
Expand Down Expand Up @@ -198,7 +190,6 @@ require (
go.opentelemetry.io/collector/config/configtls v0.99.0
go.opentelemetry.io/collector/confmap v0.99.0
go.opentelemetry.io/collector/confmap/converter/expandconverter v0.99.0
go.opentelemetry.io/collector/confmap/provider/fileprovider v0.99.0 // indirect
go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.99.0
go.opentelemetry.io/collector/connector v0.99.0
go.opentelemetry.io/collector/consumer v0.99.0
Expand Down Expand Up @@ -248,7 +239,6 @@ require (
gopkg.in/yaml.v3 v3.0.1
gotest.tools v2.2.0+incompatible
k8s.io/api v0.29.3
k8s.io/apiextensions-apiserver v0.29.2 // indirect
k8s.io/apimachinery v0.29.3
k8s.io/client-go v0.29.3
k8s.io/component-base v0.29.2
Expand All @@ -258,8 +248,6 @@ require (
sigs.k8s.io/yaml v1.4.0
)

require github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filestatsreceiver v0.99.0

require (
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
Expand Down Expand Up @@ -311,6 +299,7 @@ require (
github.com/armon/go-metrics v0.4.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/avvmoto/buf-readerat v0.0.0-20171115124131-a17c8cb89270 // indirect
github.com/aws/aws-sdk-go v1.51.22 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.0 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.11 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.0 // indirect
Expand Down Expand Up @@ -363,6 +352,7 @@ require (
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dennwc/btrfs v0.0.0-20230312211831-a1f570bd01a1 // indirect
github.com/dennwc/ioctl v1.0.0 // indirect
github.com/dennwc/varint v1.0.0 // indirect
Expand Down Expand Up @@ -447,10 +437,12 @@ require (
github.com/grafana/gomemcache v0.0.0-20231204155601-7de47a8c3cb0 // indirect
github.com/grafana/jfr-parser v0.8.0 // indirect
github.com/grobie/gomemcache v0.0.0-20230213081705-239240bbc445 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/cronexpr v1.1.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-envparse v0.1.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
Expand Down Expand Up @@ -535,6 +527,7 @@ require (
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mna/redisc v1.3.2 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
Expand Down Expand Up @@ -563,6 +556,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.99.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.99.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.99.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure v0.99.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.99.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.99.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.99.0 // indirect
Expand All @@ -573,6 +567,9 @@ require (
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/openshift/api v3.9.0+incompatible // indirect
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e // indirect
github.com/opentracing-contrib/go-stdlib v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openzipkin/zipkin-go v0.4.2 // indirect
github.com/ovh/go-ovh v1.4.3 // indirect
github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c // indirect
Expand Down Expand Up @@ -653,6 +650,7 @@ require (
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector/config/internal v0.99.0 // indirect
go.opentelemetry.io/collector/confmap/provider/envprovider v0.99.0 // indirect
go.opentelemetry.io/collector/confmap/provider/fileprovider v0.99.0 // indirect
go.opentelemetry.io/collector/confmap/provider/httpprovider v0.99.0 // indirect
go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.99.0 // indirect
go.opentelemetry.io/collector/filter v0.99.0 // indirect
Expand Down Expand Up @@ -684,6 +682,7 @@ require (
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
howett.net/plist v1.0.0 // indirect
k8s.io/apiextensions-apiserver v0.29.2 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,8 @@ github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
github.com/gosnmp/gosnmp v1.36.0 h1:1Si+MImHcKIqFc3/kJEs2LOULP1nlFKlzPFyrMOk5Qk=
github.com/gosnmp/gosnmp v1.36.0/go.mod h1:iLcZxN2MxKhH0jPQDVMZaSNypw1ykqVi27O79koQj6w=
github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
github.com/grafana/agent-remote-config v0.0.2 h1:s3FKgVzfY5Ij+xG0wVKgVvtDrh/Bz0ZvB3D5MM7LJxU=
github.com/grafana/agent-remote-config v0.0.2/go.mod h1:amyG3pVNXKcMo+kNN46yhnAXAz/m/9Ew9MRf53n7XBg=
github.com/grafana/alloy-remote-config v0.0.4 h1:XqpZ5ZmaVc1E1MZwWoQ4pTPtDQq1L2I2TEhN5JpH8nY=
github.com/grafana/alloy-remote-config v0.0.4/go.mod h1:kHE1usYo2WAVCikQkIXuoG1Clz8BSdiz3kF+DZSCQ4k=
github.com/grafana/beyla v1.5.1 h1:7CTTXSUmDcobGoJ3fvwdpfCgMxpRsW13V+Remxgl5aU=
github.com/grafana/beyla v1.5.1/go.mod h1:y6zU7/QV3db6SVXx3PYOLOp2s/PlwWyIDzUzOrfcI6o=
github.com/grafana/cadvisor v0.0.0-20231110094609-5f7917925dea h1:Q5f5/nJJ0SbusZjA6F6XkJuHDbl2/PqdTGw6wHsuccA=
Expand Down
26 changes: 13 additions & 13 deletions internal/service/remotecfg/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ import (
"errors"

"connectrpc.com/connect"
agentv1 "github.com/grafana/agent-remote-config/api/gen/proto/go/agent/v1"
collectorv1 "github.com/grafana/alloy-remote-config/api/gen/proto/go/collector/v1"
)

type noopClient struct{}

// GetConfig returns the agent's configuration.
func (c noopClient) GetConfig(context.Context, *connect.Request[agentv1.GetConfigRequest]) (*connect.Response[agentv1.GetConfigResponse], error) {
// GetConfig returns the collector's configuration.
func (c noopClient) GetConfig(context.Context, *connect.Request[collectorv1.GetConfigRequest]) (*connect.Response[collectorv1.GetConfigResponse], error) {
return nil, errors.New("noop client")
}

// GetAgent returns information about the agent.
func (c noopClient) GetAgent(context.Context, *connect.Request[agentv1.GetAgentRequest]) (*connect.Response[agentv1.Agent], error) {
// GetCollector returns information about the collector.
func (c noopClient) GetCollector(context.Context, *connect.Request[collectorv1.GetCollectorRequest]) (*connect.Response[collectorv1.Collector], error) {
return nil, errors.New("noop client")
}

// ListAgents returns information about all agents.
func (c noopClient) ListAgents(context.Context, *connect.Request[agentv1.ListAgentsRequest]) (*connect.Response[agentv1.Agents], error) {
// ListCollectors returns information about all collectors.
func (c noopClient) ListCollectors(context.Context, *connect.Request[collectorv1.ListCollectorsRequest]) (*connect.Response[collectorv1.Collectors], error) {
return nil, errors.New("noop client")
}

// CreateAgent registers a new agent.
func (c noopClient) CreateAgent(context.Context, *connect.Request[agentv1.CreateAgentRequest]) (*connect.Response[agentv1.Agent], error) {
// CreateCollector registers a new collector.
func (c noopClient) CreateCollector(context.Context, *connect.Request[collectorv1.CreateCollectorRequest]) (*connect.Response[collectorv1.Collector], error) {
return nil, errors.New("noop client")
}

// UpdateAgent updates an existing agent.
func (c noopClient) UpdateAgent(context.Context, *connect.Request[agentv1.UpdateAgentRequest]) (*connect.Response[agentv1.Agent], error) {
// UpdateCollector updates an existing collector.
func (c noopClient) UpdateCollector(context.Context, *connect.Request[collectorv1.UpdateCollectorRequest]) (*connect.Response[collectorv1.Collector], error) {
return nil, errors.New("noop client")
}

// DeleteAgent deletes an existing agent.
func (c noopClient) DeleteAgent(context.Context, *connect.Request[agentv1.DeleteAgentRequest]) (*connect.Response[agentv1.DeleteAgentResponse], error) {
// DeleteCollector deletes an existing collector.
func (c noopClient) DeleteCollector(context.Context, *connect.Request[collectorv1.DeleteCollectorRequest]) (*connect.Response[collectorv1.DeleteCollectorResponse], error) {
return nil, errors.New("noop client")
}
10 changes: 5 additions & 5 deletions internal/service/remotecfg/remotecfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

"connectrpc.com/connect"
"github.com/go-kit/log"
agentv1 "github.com/grafana/agent-remote-config/api/gen/proto/go/agent/v1"
"github.com/grafana/agent-remote-config/api/gen/proto/go/agent/v1/agentv1connect"
collectorv1 "github.com/grafana/alloy-remote-config/api/gen/proto/go/collector/v1"
"github.com/grafana/alloy-remote-config/api/gen/proto/go/collector/v1/collectorv1connect"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/alloyseed"
"github.com/grafana/alloy/internal/component/common/config"
Expand Down Expand Up @@ -43,7 +43,7 @@ type Service struct {
ctrl service.Controller

mut sync.RWMutex
asClient agentv1connect.AgentServiceClient
asClient collectorv1connect.CollectorServiceClient
ch <-chan time.Time
ticker *time.Ticker
dataPath string
Expand Down Expand Up @@ -193,7 +193,7 @@ func (s *Service) Update(newConfig any) error {
if err != nil {
return err
}
s.asClient = agentv1connect.NewAgentServiceClient(
s.asClient = collectorv1connect.NewCollectorServiceClient(
httpClient,
newArgs.URL,
)
Expand Down Expand Up @@ -260,7 +260,7 @@ func (s *Service) fetchLocal() {

func (s *Service) getAPIConfig() ([]byte, error) {
s.mut.RLock()
req := connect.NewRequest(&agentv1.GetConfigRequest{
req := connect.NewRequest(&collectorv1.GetConfigRequest{
Id: s.args.ID,
Metadata: s.args.Metadata,
})
Expand Down
Loading

0 comments on commit 6a195d6

Please sign in to comment.