Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix_converter_max_cache' into fi…
Browse files Browse the repository at this point in the history
…x_converter_max_cache
  • Loading branch information
mattdurham committed Nov 28, 2023
2 parents a042d21 + 87f4cb7 commit 6a34454
Show file tree
Hide file tree
Showing 185 changed files with 2,672 additions and 1,727 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
with:
go-version: "1.21"
- name: Set OTEL Exporter Endpoint
run: echo "OTEL_EXPORTER_ENDPOINT=http://172.17.0.1:8080" >> $GITHUB_ENV
run: echo "OTEL_EXPORTER_ENDPOINT=172.17.0.1:4318" >> $GITHUB_ENV
- name: Run tests
run: make integration-test
49 changes: 48 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,48 @@ internal API changes are not present.
Main (unreleased)
-----------------

### Security fixes

- Fix CVE-2023-47108 by updating `otelgrpc` from v0.45.0 to v0.46.0. (@hainenber)

### Features

- Agent Management: Introduce support for templated configuration. (@jcreixell)

### Enhancements

- Flow Windows service: Support environment variables. (@jkroepke)

- Allow disabling collection of root Cgroup stats in
`prometheus.exporter.cadvisor` (flow mode) and the `cadvisor` integration
(static mode). (@hainenber)

- Grafana Agent on Windows now automatically restarts on failure. (@hainenber)

- Added metrics, alerts and dashboard visualisations to help diagnose issues
with unhealthy components and components that take too long to evaluate. (@thampiotr)

- The `http` config block may now reference exports from any component.
Previously, only `remote.*` and `local.*` components could be referenced
without a circular dependency. (@rfratto)

- Add a `resource_to_telemetry_conversion` argument to `otelcol.exporter.prometheus`
for converting resource attributes to Prometheus labels. (@hainenber)

- `pyroscope.ebpf` support python on arm64 platforms. (@korniltsev)

### Bugfixes

- Permit `X-Faro-Session-ID` header in CORS requests for the `faro.receiver`
component (flow mode) and the `app_agent_receiver` integration (static mode).
(@cedricziel)

- Fix issue with windows_exporter defaults not being set correctly. (@mattdurham)

- Fix agent crash when process null OTel's fan out consumers. (@hainenber)

- Fix issue in `prometheus.operator.*` where targets would be dropped if two crds share a common prefix in their names. (@Paul424, @captncraig)

v0.38.0 (2023-11-21)
--------------------

Expand Down Expand Up @@ -91,7 +133,7 @@ v0.38.0 (2023-11-21)
- Make component list sortable in web UI. (@hainenber)

- Adds new metrics (`mssql_server_total_memory_bytes`, `mssql_server_target_memory_bytes`,
and `mssql_available_commit_memory_bytes`) for `mssql` integration.
and `mssql_available_commit_memory_bytes`) for `mssql` integration (@StefanKurek).

- Grafana Agent Operator: `config-reloader` container no longer runs as root.
(@rootmout)
Expand All @@ -108,6 +150,8 @@ v0.38.0 (2023-11-21)

- Allow agent to start with `module.git` config if cached before. (@hainenber)

- Adds new optional config parameter `query_config` to `mssql` integration to allow for custom metrics (@StefanKurek)

### Bugfixes

- Set exit code 1 on grafana-agentctl non-runnable command. (@fgouteroux)
Expand Down Expand Up @@ -193,6 +237,9 @@ v0.37.4 (2023-11-06)
- Fix a bug where reloading the configuration of a `loki.write` component lead
to a panic. (@tpaschalis)

- Added Kubernetes service resolver to static node's loadbalancing exporter
and to Flow's `otelcol.exporter.loadbalancing`. (@ptodev)

v0.37.3 (2023-10-26)
-----------------

Expand Down
11 changes: 11 additions & 0 deletions cmd/grafana-agent-service/config_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ type config struct {
// not included.
Args []string

// Environment holds environment variables for the Grafana Agent service.
// Each item represents an environment variable in form "key=value".
// All environments variables from the current process with be merged into Environment
Environment []string

// WorkingDirectory points to the working directory to run the Grafana Agent
// binary from.
WorkingDirectory string
Expand All @@ -42,9 +47,15 @@ func loadConfig() (*config, error) {
return nil, fmt.Errorf("failed to retrieve key Arguments: %w", err)
}

env, _, err := agentKey.GetStringsValue("Environment")
if err != nil {
return nil, fmt.Errorf("failed to retrieve key Environment: %w", err)
}

return &config{
ServicePath: servicePath,
Args: args,
Environment: env,
WorkingDirectory: filepath.Dir(servicePath),
}, nil
}
7 changes: 4 additions & 3 deletions cmd/grafana-agent-service/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ func main() {
}

cfg := serviceManagerConfig{
Path: managerConfig.ServicePath,
Args: managerConfig.Args,
Dir: managerConfig.WorkingDirectory,
Path: managerConfig.ServicePath,
Args: managerConfig.Args,
Environment: managerConfig.Environment,
Dir: managerConfig.WorkingDirectory,

// Send logs directly to the event logger.
Stdout: logger,
Expand Down
5 changes: 5 additions & 0 deletions cmd/grafana-agent-service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ type serviceManagerConfig struct {
// Args of the binary to run, not including the command itself.
Args []string

// Environment of the binary to run, including the command environment itself.
Environment []string

// Dir specifies the working directory to run the binary from. If Dir is
// empty, the working directory of the current process is used.
Dir string
Expand Down Expand Up @@ -84,5 +87,7 @@ func (svc *serviceManager) buildCommand(ctx context.Context) *exec.Cmd {
cmd.Dir = svc.cfg.Dir
cmd.Stdout = svc.cfg.Stdout
cmd.Stderr = svc.cfg.Stderr
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, svc.cfg.Environment...)
return cmd
}
11 changes: 9 additions & 2 deletions cmd/grafana-agent-service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ func Test_serviceManager(t *testing.T) {
listenHost := getListenHost(t)

mgr := newServiceManager(l, serviceManagerConfig{
Path: serviceBinary,
Args: []string{"-listen-addr", listenHost},
Path: serviceBinary,
Args: []string{"-listen-addr", listenHost},
Environment: []string{"LISTEN=" + listenHost},
})
go mgr.Run(componenttest.TestContext(t))

Expand All @@ -40,6 +41,12 @@ func Test_serviceManager(t *testing.T) {
require.NoError(t, err)
require.Equal(t, []byte("Hello, world!"), resp)
})

util.Eventually(t, func(t require.TestingT) {
resp, err := makeServiceRequest(listenHost, "/echo/env", nil)
require.NoError(t, err)
require.Contains(t, string(resp), "LISTEN="+listenHost)
})
})

t.Run("terminates service binary", func(t *testing.T) {
Expand Down
4 changes: 4 additions & 0 deletions cmd/grafana-agent-service/testdata/example_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net"
"net/http"
"os"
"strings"
)

func main() {
Expand Down Expand Up @@ -46,6 +47,9 @@ func run() error {
mux.HandleFunc("/echo/response", func(w http.ResponseWriter, r *http.Request) {
_, _ = io.Copy(w, r.Body)
})
mux.HandleFunc("/echo/env", func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(strings.Join(os.Environ(), "\n")))
})

srv := &http.Server{Handler: mux}
_ = srv.Serve(lis)
Expand Down
2 changes: 1 addition & 1 deletion component/faro/receiver/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (h *handler) Update(args ServerArguments) {
if len(args.CORSAllowedOrigins) > 0 {
h.cors = cors.New(cors.Options{
AllowedOrigins: args.CORSAllowedOrigins,
AllowedHeaders: []string{apiKeyHeader, "content-type"},
AllowedHeaders: []string{apiKeyHeader, "content-type", "x-faro-session-id"},
})
} else {
h.cors = nil // Disable cors.
Expand Down
5 changes: 2 additions & 3 deletions component/loki/source/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ import (

func init() {
component.Register(component.Registration{
Name: "loki.source.kubernetes",
Args: Arguments{},
NeedsServices: []string{cluster.ServiceName},
Name: "loki.source.kubernetes",
Args: Arguments{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
return New(opts, args.(Arguments))
Expand Down
5 changes: 2 additions & 3 deletions component/loki/source/podlogs/podlogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ import (

func init() {
component.Register(component.Registration{
Name: "loki.source.podlogs",
Args: Arguments{},
NeedsServices: []string{cluster.ServiceName},
Name: "loki.source.podlogs",
Args: Arguments{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
return New(opts, args.(Arguments))
Expand Down
11 changes: 3 additions & 8 deletions component/module/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ import (
"github.com/grafana/agent/component"
"github.com/grafana/agent/component/local/file"
"github.com/grafana/agent/component/module"
"github.com/grafana/agent/service/cluster"
"github.com/grafana/agent/service/http"
"github.com/grafana/agent/service/labelstore"
otel_service "github.com/grafana/agent/service/otel"
"github.com/grafana/river/rivertypes"
)

func init() {
component.Register(component.Registration{
Name: "module.file",
Args: Arguments{},
Exports: module.Exports{},
NeedsServices: []string{http.ServiceName, cluster.ServiceName, otel_service.ServiceName, labelstore.ServiceName},
Name: "module.file",
Args: Arguments{},
Exports: module.Exports{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
return New(opts, args.(Arguments))
Expand Down
11 changes: 3 additions & 8 deletions component/module/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ import (
"github.com/grafana/agent/component/module"
"github.com/grafana/agent/component/module/git/internal/vcs"
"github.com/grafana/agent/pkg/flow/logging/level"
"github.com/grafana/agent/service/cluster"
"github.com/grafana/agent/service/http"
"github.com/grafana/agent/service/labelstore"
otel_service "github.com/grafana/agent/service/otel"
)

func init() {
component.Register(component.Registration{
Name: "module.git",
Args: Arguments{},
Exports: module.Exports{},
NeedsServices: []string{http.ServiceName, cluster.ServiceName, otel_service.ServiceName, labelstore.ServiceName},
Name: "module.git",
Args: Arguments{},
Exports: module.Exports{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
return New(opts, args.(Arguments))
Expand Down
11 changes: 3 additions & 8 deletions component/module/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ import (
"github.com/grafana/agent/component"
"github.com/grafana/agent/component/module"
remote_http "github.com/grafana/agent/component/remote/http"
"github.com/grafana/agent/service/cluster"
http_service "github.com/grafana/agent/service/http"
"github.com/grafana/agent/service/labelstore"
otel_service "github.com/grafana/agent/service/otel"
"github.com/grafana/river/rivertypes"
)

func init() {
component.Register(component.Registration{
Name: "module.http",
Args: Arguments{},
Exports: module.Exports{},
NeedsServices: []string{http_service.ServiceName, cluster.ServiceName, otel_service.ServiceName, labelstore.ServiceName},
Name: "module.http",
Args: Arguments{},
Exports: module.Exports{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
return New(opts, args.(Arguments))
Expand Down
11 changes: 3 additions & 8 deletions component/module/string/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@ import (

"github.com/grafana/agent/component"
"github.com/grafana/agent/component/module"
"github.com/grafana/agent/service/cluster"
"github.com/grafana/agent/service/http"
"github.com/grafana/agent/service/labelstore"
otel_service "github.com/grafana/agent/service/otel"
"github.com/grafana/river/rivertypes"
)

func init() {
component.Register(component.Registration{
Name: "module.string",
Args: Arguments{},
Exports: module.Exports{},
NeedsServices: []string{http.ServiceName, cluster.ServiceName, otel_service.ServiceName, labelstore.ServiceName},
Name: "module.string",
Args: Arguments{},
Exports: module.Exports{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
return New(opts, args.(Arguments))
Expand Down
8 changes: 3 additions & 5 deletions component/otelcol/auth/basic/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package basic
import (
"github.com/grafana/agent/component"
"github.com/grafana/agent/component/otelcol/auth"
otel_service "github.com/grafana/agent/service/otel"
"github.com/grafana/river/rivertypes"
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension"
otelcomponent "go.opentelemetry.io/collector/component"
Expand All @@ -14,10 +13,9 @@ import (

func init() {
component.Register(component.Registration{
Name: "otelcol.auth.basic",
Args: Arguments{},
Exports: auth.Exports{},
NeedsServices: []string{otel_service.ServiceName},
Name: "otelcol.auth.basic",
Args: Arguments{},
Exports: auth.Exports{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
fact := basicauthextension.NewFactory()
Expand Down
8 changes: 3 additions & 5 deletions component/otelcol/auth/bearer/bearer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package bearer
import (
"github.com/grafana/agent/component"
"github.com/grafana/agent/component/otelcol/auth"
otel_service "github.com/grafana/agent/service/otel"
"github.com/grafana/river/rivertypes"
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension"
otelcomponent "go.opentelemetry.io/collector/component"
Expand All @@ -14,10 +13,9 @@ import (

func init() {
component.Register(component.Registration{
Name: "otelcol.auth.bearer",
Args: Arguments{},
Exports: auth.Exports{},
NeedsServices: []string{otel_service.ServiceName},
Name: "otelcol.auth.bearer",
Args: Arguments{},
Exports: auth.Exports{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
fact := bearertokenauthextension.NewFactory()
Expand Down
8 changes: 3 additions & 5 deletions component/otelcol/auth/headers/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/grafana/agent/component"
"github.com/grafana/agent/component/otelcol/auth"
otel_service "github.com/grafana/agent/service/otel"
"github.com/grafana/river"
"github.com/grafana/river/rivertypes"
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/headerssetterextension"
Expand All @@ -18,10 +17,9 @@ import (

func init() {
component.Register(component.Registration{
Name: "otelcol.auth.headers",
Args: Arguments{},
Exports: auth.Exports{},
NeedsServices: []string{otel_service.ServiceName},
Name: "otelcol.auth.headers",
Args: Arguments{},
Exports: auth.Exports{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
fact := headerssetterextension.NewFactory()
Expand Down
8 changes: 3 additions & 5 deletions component/otelcol/auth/oauth2/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/grafana/agent/component"
"github.com/grafana/agent/component/otelcol"
"github.com/grafana/agent/component/otelcol/auth"
otel_service "github.com/grafana/agent/service/otel"
"github.com/grafana/river/rivertypes"
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/oauth2clientauthextension"
otelcomponent "go.opentelemetry.io/collector/component"
Expand All @@ -17,10 +16,9 @@ import (

func init() {
component.Register(component.Registration{
Name: "otelcol.auth.oauth2",
Args: Arguments{},
Exports: auth.Exports{},
NeedsServices: []string{otel_service.ServiceName},
Name: "otelcol.auth.oauth2",
Args: Arguments{},
Exports: auth.Exports{},

Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
fact := oauth2clientauthextension.NewFactory()
Expand Down
Loading

0 comments on commit 6a34454

Please sign in to comment.