Skip to content

Commit

Permalink
Merge pull request #31 from grafana/sync-grafana-agent-2023-03-13-1
Browse files Browse the repository at this point in the history
Merge grafana/agent:main into grafana/alloy:main (2024-03-13)
  • Loading branch information
rfratto authored Mar 13, 2024
2 parents 6b660b8 + d9ec7ee commit 77dde60
Show file tree
Hide file tree
Showing 47 changed files with 1,204 additions and 91 deletions.
38 changes: 19 additions & 19 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ steps:
- commands:
- apt-get update -y && apt-get install -y libsystemd-dev
- make lint
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Lint
trigger:
event:
Expand All @@ -23,7 +23,7 @@ platform:
steps:
- commands:
- make GO_TAGS="nodocker" test
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Run Go tests
trigger:
event:
Expand All @@ -38,7 +38,7 @@ platform:
steps:
- commands:
- K8S_USE_DOCKER_NETWORK=1 make test
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Run Go tests
volumes:
- name: docker
Expand All @@ -61,7 +61,7 @@ platform:
steps:
- commands:
- go test -tags="nodocker,nonetwork" ./...
image: grafana/agent-build-image:0.33.0-windows
image: grafana/agent-build-image:0.40.2-windows
name: Run Go tests
trigger:
ref:
Expand All @@ -76,7 +76,7 @@ platform:
steps:
- commands:
- make agent-image
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build container
volumes:
- name: docker
Expand All @@ -102,7 +102,7 @@ platform:
steps:
- commands:
- '& "C:/Program Files/git/bin/bash.exe" ./tools/ci/docker-containers-windows agent'
image: grafana/agent-build-image:0.33.0-windows
image: grafana/agent-build-image:0.40.2-windows
name: Build container
volumes:
- name: docker
Expand All @@ -129,7 +129,7 @@ steps:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM=
make agent
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -146,7 +146,7 @@ steps:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM=
make agent
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -163,7 +163,7 @@ steps:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=ppc64le GOARM=
make agent
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -180,7 +180,7 @@ steps:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=s390x GOARM=
make agent
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -196,7 +196,7 @@ steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make agent
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -212,7 +212,7 @@ steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make agent
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -228,7 +228,7 @@ steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make agent
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -244,7 +244,7 @@ steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make agent
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -261,7 +261,7 @@ steps:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM=
GOEXPERIMENT=boringcrypto make agent-boringcrypto
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -278,7 +278,7 @@ steps:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM=
GOEXPERIMENT=boringcrypto make agent-boringcrypto
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Build
trigger:
event:
Expand All @@ -295,7 +295,7 @@ steps:
- make generate-ui
- GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= GOEXPERIMENT=cngcrypto
make agent-windows-boringcrypto
image: grafana/agent-build-image:0.33.0-boringcrypto
image: grafana/agent-build-image:0.40.2-boringcrypto
name: Build
trigger:
event:
Expand All @@ -311,7 +311,7 @@ steps:
- commands:
- DOCKER_OPTS="" make dist/grafana-agent-linux-amd64
- DOCKER_OPTS="" make test-packages
image: grafana/agent-build-image:0.33.0
image: grafana/agent-build-image:0.40.2
name: Test Linux system packages
volumes:
- name: docker
Expand Down Expand Up @@ -407,6 +407,6 @@ kind: secret
name: updater_private_key
---
kind: signature
hmac: 509aa746729e5eaf86e4cbb02b07f125399aabefcc3bf5b1693ea2cca2eaa4e1
hmac: 59c741cd4e3cd3f555cbf0165da386b269a7f54987fe5a2aba621edc6ebb09a5

...
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Main (unreleased)

- Add support for importing directories as single module to `import.git`. (@wildum)

- Improve converter diagnostic output by including a Footer and removing lower
level diagnostics when a configuration fails to generate. (@erikbaranowski)

### Features

- Added a new CLI flag `--stability.level` which defines the minimum stability
Expand All @@ -29,10 +32,14 @@ Main (unreleased)

- Fix a bug where structured metadata and parsed field are not passed further in `loki.source.api` (@marchellodev)

- Change `import.git` to use Git pulls rather than fetches to fix scenarios where the local code did not get updated. (@mattdurham)

### Other changes

- Clustering for Grafana Agent in Flow mode has graduated from beta to stable.

- Upgrade to Go 1.22.1 (@thampiotr)

v0.40.2 (2024-03-05)
--------------------

Expand All @@ -49,7 +56,6 @@ v0.40.2 (2024-03-05)

- Fix an issue where Loki could reject a batch of logs when structured metadata feature is used. (@thampiotr)

=======
- Fix a duplicate metrics registration panic when recreating static
mode metric instance's write handler. (@rfratto, @hainenber)

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<p align="center"><img src="docs/sources/assets/logo_and_name.png" alt="Grafana Alloy logo"></p>

[Grafana Alloy][] is a vendor-neutral, batteries-included telemetry collector with
configuration inspired by [Terraform][]. It is designed to be flexible,
performant, and compatible with multiple ecosystems such as Prometheus and
OpenTelemetry.
[Grafana Alloy][] is an OpenTelemetry Collector distribution with configuration
inspired by [Terraform][]. It is designed to be flexible, performant, and
compatible with multiple ecosystems such as Prometheus and OpenTelemetry.

Grafana Alloy is based around **components**. Components are wired together to
form programmable observability **pipelines** for telemetry collection,
Expand Down
2 changes: 1 addition & 1 deletion build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# default when running `docker buildx build` or when DOCKER_BUILDKIT=1 is set
# in environment variables.

# NOTE: The GO_RUNTIME is used to switch between the default google go runtime and mcr.microsoft.com/oss/go/microsoft/golang:1.22.1-bullseye which is a microsoft
# NOTE: The GO_RUNTIME is used to switch between the default Google go runtime and mcr.microsoft.com/oss/go/microsoft/golang:1.22.1-bullseye which is a Microsoft
# fork of go that allows using windows crypto instead of boring crypto. Details at https://github.com/microsoft/go/tree/microsoft/main/eng/doc/fips
ARG GO_RUNTIME=mustoverride

Expand Down
2 changes: 1 addition & 1 deletion build-image/windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM library/golang:1.22.0-windowsservercore-1809
FROM library/golang:1.22.1-windowsservercore-1809

SHELL ["powershell", "-command"]

Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# default when running `docker buildx build` or when DOCKER_BUILDKIT=1 is set
# in environment variables.

FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.33.0 as build
FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.40.2 as build
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG TARGETOS
Expand Down
9 changes: 7 additions & 2 deletions cmd/grafana-agent/Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM grafana/agent-build-image:0.33.0-windows as builder
FROM grafana/agent-build-image:0.40.2-windows as builder
ARG VERSION
ARG RELEASE_BUILD=1

Expand All @@ -10,7 +10,12 @@ SHELL ["cmd", "/S", "/C"]
# Creating new layers can be really slow on Windows so we clean up any caches
# we can before moving on to the next step.
RUN ""C:\Program Files\git\bin\bash.exe" -c "RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} make generate-ui && rm -rf web/ui/node_modules && yarn cache clean --all""
RUN ""C:\Program Files\git\bin\bash.exe" -c "RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} GO_TAGS='builtinassets' make agent && go clean -cache -modcache""

RUN ""C:\Program Files\git\bin\bash.exe" -c "RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} GO_TAGS='builtinassets' make agent""
# In this case, we're separating the clean command from make agent to avoid an issue where access to some mod cache
# files is denied immediately after make agent, for example:
# "go: remove C:\go\pkg\mod\golang.org\[email protected]\bin\go.exe: Access is denied."
RUN ""C:\Program Files\git\bin\bash.exe" -c "go clean -cache -modcache""

# Use the smallest container possible for the final image
FROM mcr.microsoft.com/windows/nanoserver:1809
Expand Down
4 changes: 2 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ include docs.mk
docs: check-cloudwatch-integration

check-cloudwatch-integration:
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.21-bullseye go run internal/static/integrations/cloudwatch_exporter/docs/doc.go check /docs/sources/reference/components/prometheus.exporter.cloudwatch.md
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.22.1-bullseye go run internal/static/integrations/cloudwatch_exporter/docs/doc.go check /docs/sources/reference/components/prometheus.exporter.cloudwatch.md

generate-cloudwatch-integration:
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.21-bullseye go run internal/static/integrations/cloudwatch_exporter/docs/doc.go generate
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.22.1-bullseye go run internal/static/integrations/cloudwatch_exporter/docs/doc.go generate

sources/assets/hierarchy.svg: sources/operator/hierarchy.dot
cat $< | $(PODMAN) run --rm -i nshine/dot dot -Tsvg > $@
2 changes: 1 addition & 1 deletion docs/sources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cascade:

# {{% param "PRODUCT_NAME" %}}

{{< param "PRODUCT_NAME" >}} is a vendor-neutral, batteries-included telemetry collector with configuration inspired by [Terraform][].
{{< param "PRODUCT_NAME" >}} is an OpenTelemetry Collector distribution with configuration inspired by [Terraform][].
It is designed to be flexible, performant, and compatible with multiple ecosystems such as Prometheus and OpenTelemetry.

{{< param "PRODUCT_NAME" >}} is based around **components**. Components are wired together to form programmable observability **pipelines** for telemetry collection, processing, and delivery.
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/_index.md.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cascade:

# {{% param "PRODUCT_NAME" %}}

{{< param "PRODUCT_NAME" >}} is a vendor-neutral, batteries-included telemetry collector with configuration inspired by [Terraform][].
{{< param "PRODUCT_NAME" >}} is an OpenTelemetry Collector distribution with configuration inspired by [Terraform][].
It is designed to be flexible, performant, and compatible with multiple ecosystems such as Prometheus and OpenTelemetry.

{{< param "PRODUCT_NAME" >}} is based around **components**. Components are wired together to form programmable observability **pipelines** for telemetry collection, processing, and delivery.
Expand Down
25 changes: 17 additions & 8 deletions docs/sources/reference/components/otelcol.auth.oauth2.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,26 @@ otelcol.auth.oauth2 "LABEL" {

## Arguments

Name | Type | Description | Default | Required
------------------|---------------------|------------------------------------------------------------|---------|---------
`client_id` | `string` | The client identifier issued to the client. | | yes
`client_secret` | `secret` | The secret string associated with the client identifier. | | yes
`token_url` | `string` | The server endpoint URL from which to get tokens. | | yes
`endpoint_params` | `map(list(string))` | Additional parameters that are sent to the token endpoint. | `{}` | no
`scopes` | `list(string)` | Requested permissions associated for the client. | `[]` | no
`timeout` | `duration` | The timeout on the client connecting to `token_url`. | `"0s"` | no
Name | Type | Description | Default | Required
-------------------- | ------------------- | ---------------------------------------------------------------------------------- | ------- | --------
`client_id` | `string` | The client identifier issued to the client. | | no
`client_id_file` | `string` | The file path to retrieve the client identifier issued to the client. | | no
`client_secret` | `secret` | The secret string associated with the client identifier. | | no
`client_secret_file` | `secret` | The file path to retrieve the secret string associated with the client identifier. | | no
`token_url` | `string` | The server endpoint URL from which to get tokens. | | yes
`endpoint_params` | `map(list(string))` | Additional parameters that are sent to the token endpoint. | `{}` | no
`scopes` | `list(string)` | Requested permissions associated for the client. | `[]` | no
`timeout` | `duration` | The timeout on the client connecting to `token_url`. | `"0s"` | no

The `timeout` argument is used both for requesting initial tokens and for refreshing tokens. `"0s"` implies no timeout.

At least one of the `client_id` and `client_id_file` pair of arguments must be
set. In case both are set, `client_id_file` takes precedence.

Similarly, at least one of the `client_secret` and `client_secret_file` pair of
arguments must be set. In case both are set, `client_secret_file` also takes
precedence.

## Blocks

The following blocks are supported inside the definition of
Expand Down
8 changes: 7 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
module github.com/grafana/agent

go 1.21.0
go 1.22.1

retract (
v1.3.191 // Published accidentally
v1.2.99 // Published accidentally
v1.2.99-rc1 // Published accidentally
)

require (
cloud.google.com/go/pubsub v1.33.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 as build
FROM golang:1.22.1 as build
WORKDIR /app/
COPY go.mod go.sum ./
COPY syntax/go.mod syntax/go.sum ./syntax/
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/integration-tests/configs/prom-gen/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 as build
FROM golang:1.22.1 as build
WORKDIR /app/
COPY go.mod go.sum ./
COPY syntax/go.mod syntax/go.sum ./syntax/
Expand Down
32 changes: 18 additions & 14 deletions internal/component/otelcol/auth/oauth2/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,31 @@ func init() {

// Arguments configures the otelcol.auth.oauth2 component.
type Arguments struct {
ClientID string `river:"client_id,attr"`
ClientSecret rivertypes.Secret `river:"client_secret,attr"`
TokenURL string `river:"token_url,attr"`
EndpointParams url.Values `river:"endpoint_params,attr,optional"`
Scopes []string `river:"scopes,attr,optional"`
TLSSetting otelcol.TLSClientArguments `river:"tls,block,optional"`
Timeout time.Duration `river:"timeout,attr,optional"`
ClientID string `river:"client_id,attr,optional"`
ClientIDFile string `river:"client_id_file,attr,optional"`
ClientSecret rivertypes.Secret `river:"client_secret,attr,optional"`
ClientSecretFile string `river:"client_secret_file,attr,optional"`
TokenURL string `river:"token_url,attr"`
EndpointParams url.Values `river:"endpoint_params,attr,optional"`
Scopes []string `river:"scopes,attr,optional"`
TLSSetting otelcol.TLSClientArguments `river:"tls,block,optional"`
Timeout time.Duration `river:"timeout,attr,optional"`
}

var _ auth.Arguments = Arguments{}

// Convert implements auth.Arguments.
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &oauth2clientauthextension.Config{
ClientID: args.ClientID,
ClientSecret: configopaque.String(args.ClientSecret),
TokenURL: args.TokenURL,
EndpointParams: args.EndpointParams,
Scopes: args.Scopes,
TLSSetting: *args.TLSSetting.Convert(),
Timeout: args.Timeout,
ClientID: args.ClientID,
ClientIDFile: args.ClientIDFile,
ClientSecret: configopaque.String(args.ClientSecret),
ClientSecretFile: args.ClientSecretFile,
TokenURL: args.TokenURL,
EndpointParams: args.EndpointParams,
Scopes: args.Scopes,
TLSSetting: *args.TLSSetting.Convert(),
Timeout: args.Timeout,
}, nil
}

Expand Down
Loading

0 comments on commit 77dde60

Please sign in to comment.