Skip to content

Commit

Permalink
Merge branch 'main' into dhalperin-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
clayton-cornell authored Jul 25, 2023
2 parents 5fb6511 + bfb5638 commit 9b3deba
Show file tree
Hide file tree
Showing 178 changed files with 4,666 additions and 851 deletions.
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,44 @@ Main (unreleased)
### Enhancements

- Add [godeltaprof](https://github.com/grafana/godeltaprof) profiling types (`godeltaprof_memory`, `godeltaprof_mutex`, `godeltaprof_block`) to `pyroscope.scrape` component
- Integrations: make `udev` data path configurable in the `node_exporter` integration. (@sduranc)
- Clustering: Enable peer discovery with the go-discover package. (@tpaschalis)

- New Grafana Agent Flow components:

- `prometheus.exporter.gcp` - scrape GCP metrics (@tburgessdev)
- `otelcol.processor.span` - accepts traces telemetry data from other `otelcol`
components and modifies the names and attributes of the spans. (@ptodev)

### Bugfixes

- Rename `GrafanaAgentManagement` mixin rules to `GrafanaAgentConfig` and update individual alerts to be more accurate. (@spartan0x117)

- Fix issue where the flow mode UI would show an empty page when navigating to
an unhealthy `prometheus.operator` component or a healthy
`prometheus.operator` component which discovered no custom resources.
(@rfratto)

- Fix panic when using `oauth2` without specifying `tls_config`. (@mattdurham)

- Fix potential goroutine leak in log file tailing in static mode. (@thampiotr)

- Fix incorrect display of trace IDs in the automatic_logging processor of static mode's traces subsystem.
Users of the static mode's service graph processor are also advised to upgrade,
although the bug should theoretically not affect them. (@ptodev)

### Other changes

- Compile journald support into builds of `grafana-agentctl` so
`grafana-agentctl test-logs` functions as expected when testing tailing the
systemd journal. (@rfratto)

v0.35.0 (2023-07-18)
--------------------

> **BREAKING CHANGES**: This release has breaking changes. Please read entries
> carefully and consult the [upgrade guide][] for specific instructions.
### Breaking changes

- The algorithm for the "hash" action of `otelcol.processor.attributes` has changed.
Expand Down
1 change: 1 addition & 0 deletions cmd/grafana-agentctl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOOS="$TARGETOS" GOARCH="$TARGETARCH" GOARM="${TARGETVARIANT#v}" \
RELEASE_BUILD="${RELEASE_BUILD}" VERSION="${VERSION}" \
GO_TAGS="promtail_journal_enabled" \
make agentctl

FROM ubuntu:lunar
Expand Down
5 changes: 4 additions & 1 deletion cmd/internal/flowmode/cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ depending on the nature of the reload error.
StringVar(&r.clusterAdvAddr, "cluster.advertise-address", r.clusterAdvAddr, "Address to advertise to the cluster")
cmd.Flags().
StringVar(&r.clusterJoinAddr, "cluster.join-addresses", r.clusterJoinAddr, "Comma-separated list of addresses to join the cluster at")
cmd.Flags().
StringVar(&r.clusterDiscoverPeers, "cluster.discover-peers", r.clusterDiscoverPeers, "List of key-value tuples for discovering peers")
cmd.Flags().
BoolVar(&r.disableReporting, "disable-reporting", r.disableReporting, "Disable reporting of enabled components to Grafana.")
cmd.Flags().StringVar(&r.configFormat, "config.format", r.configFormat, "The format of the source file. Supported formats: 'flow', 'prometheus'.")
Expand All @@ -113,6 +115,7 @@ type flowRun struct {
clusterNodeName string
clusterAdvAddr string
clusterJoinAddr string
clusterDiscoverPeers string
configFormat string
configBypassConversionErrors bool
}
Expand Down Expand Up @@ -163,7 +166,7 @@ func (fr *flowRun) Run(configFile string) error {
reg := prometheus.DefaultRegisterer
reg.MustRegister(newResourcesCollector(l))

clusterer, err := cluster.New(l, reg, fr.clusterEnabled, fr.clusterNodeName, fr.httpListenAddr, fr.clusterAdvAddr, fr.clusterJoinAddr)
clusterer, err := cluster.New(l, reg, fr.clusterEnabled, fr.clusterNodeName, fr.httpListenAddr, fr.clusterAdvAddr, fr.clusterJoinAddr, fr.clusterDiscoverPeers)
if err != nil {
return fmt.Errorf("building clusterer: %w", err)
}
Expand Down
2 changes: 2 additions & 0 deletions component/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import (
_ "github.com/grafana/agent/component/otelcol/processor/attributes" // Import otelcol.processor.attributes
_ "github.com/grafana/agent/component/otelcol/processor/batch" // Import otelcol.processor.batch
_ "github.com/grafana/agent/component/otelcol/processor/memorylimiter" // Import otelcol.processor.memory_limiter
_ "github.com/grafana/agent/component/otelcol/processor/span" // Import otelcol.processor.span
_ "github.com/grafana/agent/component/otelcol/processor/tail_sampling" // Import otelcol.processor.tail_sampling
_ "github.com/grafana/agent/component/otelcol/receiver/jaeger" // Import otelcol.receiver.jaeger
_ "github.com/grafana/agent/component/otelcol/receiver/kafka" // Import otelcol.receiver.kafka
Expand All @@ -71,6 +72,7 @@ import (
_ "github.com/grafana/agent/component/prometheus/exporter/consul" // Import prometheus.exporter.consul
_ "github.com/grafana/agent/component/prometheus/exporter/dnsmasq" // Import prometheus.exporter.dnsmasq
_ "github.com/grafana/agent/component/prometheus/exporter/elasticsearch" // Import prometheus.exporter.elasticsearch
_ "github.com/grafana/agent/component/prometheus/exporter/gcp" // Import prometheus.exporter.gcp
_ "github.com/grafana/agent/component/prometheus/exporter/github" // Import prometheus.exporter.github
_ "github.com/grafana/agent/component/prometheus/exporter/kafka" // Import prometheus.exporter.kafka
_ "github.com/grafana/agent/component/prometheus/exporter/memcached" // Import prometheus.exporter.memcached
Expand Down
7 changes: 5 additions & 2 deletions component/common/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,19 @@ func (o *OAuth2Config) Convert() *config.OAuth2 {
if o == nil {
return nil
}
return &config.OAuth2{
oa := &config.OAuth2{
ClientID: o.ClientID,
ClientSecret: config.Secret(o.ClientSecret),
ClientSecretFile: o.ClientSecretFile,
Scopes: o.Scopes,
TokenURL: o.TokenURL,
EndpointParams: o.EndpointParams,
TLSConfig: *o.TLSConfig.Convert(),
ProxyConfig: config.ProxyConfig{
ProxyURL: o.ProxyURL.Convert(),
},
}
if o.TLSConfig != nil {
oa.TLSConfig = *o.TLSConfig.Convert()
}
return oa
}
18 changes: 18 additions & 0 deletions component/common/config/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,24 @@ func TestHTTPClientConfigOath2ClientSecretFile(t *testing.T) {
require.NoError(t, err)
}

func TestOath2TLSConvert(t *testing.T) {
var exampleRiverConfig = `
oauth2 {
client_id = "client_id"
client_secret_file = "/path/to/file.oath2"
scopes = ["scope1", "scope2"]
token_url = "token_url"
endpoint_params = {"param1" = "value1", "param2" = "value2"}
}
`

var httpClientConfig HTTPClientConfig
err := river.Unmarshal([]byte(exampleRiverConfig), &httpClientConfig)
require.NoError(t, err)
newCfg := httpClientConfig.Convert()
require.NotNil(t, newCfg)
}

func TestHTTPClientBadConfig(t *testing.T) {
var exampleRiverConfig = `
bearer_token = "token"
Expand Down
1 change: 1 addition & 0 deletions component/otelcol/exporter/jaeger/jaeger.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ var DefaultGRPCClientArguments = GRPCClientArguments{
Headers: map[string]string{},
Compression: otelcol.CompressionTypeGzip,
WriteBufferSize: 512 * 1024,
BalancerName: "pick_first",
}

// SetToDefault implements river.Defaulter.
Expand Down
1 change: 1 addition & 0 deletions component/otelcol/exporter/loadbalancing/loadbalancing.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ var DefaultGRPCClientArguments = GRPCClientArguments{
Headers: map[string]string{},
Compression: otelcol.CompressionTypeGzip,
WriteBufferSize: 512 * 1024,
BalancerName: "pick_first",
}

// SetToDefault implements river.Defaulter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestConfigConversion(t *testing.T) {
Compression: "gzip",
WriteBufferSize: 512 * 1024,
Headers: map[string]configopaque.String{},
BalancerName: "pick_first",
},
},
}
Expand Down Expand Up @@ -108,6 +109,7 @@ func TestConfigConversion(t *testing.T) {
Compression: "gzip",
WriteBufferSize: 512 * 1024,
Headers: map[string]configopaque.String{},
BalancerName: "pick_first",
},
},
},
Expand Down
1 change: 1 addition & 0 deletions component/otelcol/exporter/otlp/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ var DefaultGRPCClientArguments = GRPCClientArguments{
Headers: map[string]string{},
Compression: otelcol.CompressionTypeGzip,
WriteBufferSize: 512 * 1024,
BalancerName: "pick_first",
}

// SetToDefault implements river.Defaulter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ type Arguments struct {
}

type ArgumentsSource struct {
Content string `river:"content,attr,optional"`
Remote *otelcol.GRPCClientArguments `river:"remote,block,optional"`
File string `river:"file,attr,optional"`
ReloadInterval time.Duration `river:"reload_interval,attr,optional"`
Content string `river:"content,attr,optional"`
Remote *GRPCClientArguments `river:"remote,block,optional"`
File string `river:"file,attr,optional"`
ReloadInterval time.Duration `river:"reload_interval,attr,optional"`
}

var (
Expand All @@ -72,7 +72,7 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
HTTPServerSettings: (*otelcol.HTTPServerArguments)(args.HTTP).Convert(),
GRPCServerSettings: (*otelcol.GRPCServerArguments)(args.GRPC).Convert(),
Source: jaegerremotesampling.Source{
Remote: args.Source.Remote.Convert(),
Remote: (*otelcol.GRPCClientArguments)(args.Source.Remote).Convert(),
File: args.Source.File,
ReloadInterval: args.Source.ReloadInterval,
Contents: args.Source.Content,
Expand Down Expand Up @@ -132,3 +132,22 @@ func (args *GRPCServerArguments) SetToDefault() {
func (args *HTTPServerArguments) SetToDefault() {
*args = DefaultHTTPServerArguments
}

// GRPCClientArguments is used to configure
// otelcol.extension.jaeger_remote_sampling with
// component-specific defaults.
type GRPCClientArguments otelcol.GRPCClientArguments

// DefaultGRPCClientArguments holds component-specific
// default settings for GRPCClientArguments.
var DefaultGRPCClientArguments = GRPCClientArguments{
Headers: map[string]string{},
Compression: otelcol.CompressionTypeGzip,
WriteBufferSize: 512 * 1024,
BalancerName: "pick_first",
}

// SetToDefault implements river.Defaulter.
func (args *GRPCClientArguments) SetToDefault() {
*args = DefaultGRPCClientArguments
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"
"time"

"github.com/grafana/agent/component/otelcol"
"github.com/grafana/agent/component/otelcol/extension/jaeger_remote_sampling"
"github.com/grafana/agent/pkg/flow/componenttest"
"github.com/grafana/agent/pkg/river"
Expand Down Expand Up @@ -199,6 +200,32 @@ func TestUnmarshalUsesDefaults(t *testing.T) {
Source: jaeger_remote_sampling.ArgumentsSource{File: "remote.json"},
},
},
// tests source grpc defaults
{
cfg: `
grpc {
endpoint = "blerg"
transport = "blarg"
}
source {
remote {
endpoint = "TestRemoteEndpoint"
}
}
`,
expected: jaeger_remote_sampling.Arguments{
GRPC: &jaeger_remote_sampling.GRPCServerArguments{Endpoint: "blerg", Transport: "blarg"},
Source: jaeger_remote_sampling.ArgumentsSource{
Remote: &jaeger_remote_sampling.GRPCClientArguments{
Endpoint: "TestRemoteEndpoint",
Headers: map[string]string{},
Compression: otelcol.CompressionTypeGzip,
WriteBufferSize: 512 * 1024,
BalancerName: "pick_first",
},
},
},
},
}

for _, tc := range tcs {
Expand Down
Loading

0 comments on commit 9b3deba

Please sign in to comment.