Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into andriikushch/update-cloudwatch-ex…
Browse files Browse the repository at this point in the history
…porter-dependency-

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
andriikushch committed May 16, 2024
2 parents b2d50c6 + 4b1eb1b commit 4a109b3
Show file tree
Hide file tree
Showing 370 changed files with 1,851 additions and 590 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/bump-formula-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ jobs:
name: homebrew-grafana
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.ALLOYBOT_APP_ID }}
private-key: ${{ secrets.ALLOYBOT_PRIVATE_KEY }}
owner: grafana
repositories: alloy,homebrew-grafana

- name: Get latest release
uses: rez0n/actions-github-release@main
id: latest_release
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ steps.app-token.outputs.token }}
repository: "${{ github.repository }}"
type: "stable"

Expand All @@ -21,7 +29,7 @@ jobs:
uses: dawidd6/action-homebrew-bump-formula@v3
with:
# Required, custom GitHub access token with the 'public_repo' and 'workflow' scopes
token: ${{secrets.HOMEBREW_FORMULA_GH_TOKEN}}
token: ${{ steps.app-token.outputs.token }}
# Optional, defaults to homebrew/core
tap: grafana/grafana
# Formula name, required
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@d710430a6722f083d3b36b8339ff66b32f22ee55
uses: aquasecurity/trivy-action@b2933f565dbc598b29947660e66259e3c7bc8561
with:
image-ref: 'grafana/alloy:main'
format: 'template'
Expand Down
22 changes: 14 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,28 @@ Main (unreleased)
- 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)

### Breaking changes

- Cloudwatch exporter is not allowing aliases for the namespaces as `type` value. For example: "s3" is not allowed, "AWS/S3" should be used. (@kgeckhart, @andriikushch)

### Features
### Enhancements

- A new parameter `aws_sdk_version` is added for the cloudwatch exporters configuration. It enables the use of aws sdk v2 which is expected to come with performance benefits. (@kgeckhart, @andriikushch)
- (_Public preview_) Add native histogram support to `otelcol.receiver.prometheus`. (@wildum)

### Bugfixes

- Fix panic when component ID contains `/` in `otelcomponent.MustNewType(ID)`.(@qclaogui)

- Fixed an issue with `prometheus.scrape` in which targets that move from one
cluster instance to another could have a staleness marker inserted and result
in a gap in metrics (@thampiotr)

v1.1.0-rc.0
-----------
- Exit Alloy immediately if the port it runs on is not available.
This port can be configured with `--server.http.listen-addr` or using
the default listen address`127.0.0.1:12345`. (@mattdurham)

### Other changes

- `prometheus.exporter.snmp`: Updating SNMP exporter from v0.24.1 to v0.26.0.

v1.1.0
------

### Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The `prometheus.exporter.snmp` component embeds
[`snmp_exporter`](https://github.com/prometheus/snmp_exporter). `snmp_exporter` lets you collect SNMP data and expose them as Prometheus metrics.

{{< admonition type="note" >}}
`prometheus.exporter.snmp` uses the latest configuration introduced in version 0.23 of the Prometheus `snmp_exporter`.
`prometheus.exporter.snmp` uses the latest configuration introduced in version 0.26 of the Prometheus `snmp_exporter`.
{{< /admonition >}}

## Usage
Expand Down
18 changes: 18 additions & 0 deletions docs/sources/reference/components/prometheus.scrape.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ present.

## Example

### Set up scrape jobs for `blackbox exporter` targets

The following example sets up the scrape job with certain attributes (scrape
endpoint, scrape interval, query parameters) and lets it scrape two instances
of the [blackbox exporter](https://github.com/prometheus/blackbox_exporter/).
Expand Down Expand Up @@ -286,6 +288,22 @@ http://blackbox-exporter:9115/probe?target=grafana.com&module=http_2xx
http://blackbox-exporter:9116/probe?target=grafana.com&module=http_2xx
```

### Authentication with the Kubernetes API server

The following example shows you how to authenticate with the Kubernetes API server.

```alloy
prometheus.scrape "kubelet" {
scheme = "https"
tls_config {
server_name = "kubernetes"
ca_file = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify = false
}
bearer_token_file = "/var/run/secrets/kubernetes.io/serviceaccount/token"
}
```

### Technical details

`prometheus.scrape` supports [gzip](https://en.wikipedia.org/wiki/Gzip) compression.
Expand Down
52 changes: 52 additions & 0 deletions docs/sources/reference/config-blocks/import.http.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,52 @@ Name | Type | Description | Def
`poll_frequency` | `duration` | Frequency to poll the URL. | `"1m"` | no
`poll_timeout` | `duration` | Timeout when polling the URL. | `"10s"` | no

## Blocks

The following blocks are supported inside the definition of `import.http`:

Hierarchy | Block | Description | Required
-----------------------------|-------------------|----------------------------------------------------------|---------
client | [client][] | HTTP client settings when connecting to the endpoint. | no
client > basic_auth | [basic_auth][] | Configure basic_auth for authenticating to the endpoint. | no
client > authorization | [authorization][] | Configure generic authorization to the endpoint. | no
client > oauth2 | [oauth2][] | Configure OAuth2 for authenticating to the endpoint. | no
client > oauth2 > tls_config | [tls_config][] | Configure TLS settings for connecting to the endpoint. | no
client > tls_config | [tls_config][] | Configure TLS settings for connecting to the endpoint. | no

The `>` symbol indicates deeper levels of nesting.
For example, `client > basic_auth` refers to an `basic_auth` block defined inside a `client` block.

### client block

The `client` block configures settings used to connect to the HTTP server.

{{< docs/shared lookup="reference/components/http-client-config-block.md" source="alloy" version="<ALLOY_VERSION>" >}}

### basic_auth block

The `basic_auth` block configures basic authentication to use when polling the configured URL.

{{< docs/shared lookup="reference/components/basic-auth-block.md" source="alloy" version="<ALLOY_VERSION>" >}}

### authorization block

The `authorization` block configures custom authorization to use when polling the configured URL.

{{< docs/shared lookup="reference/components/authorization-block.md" source="alloy" version="<ALLOY_VERSION>" >}}

### oauth2 block

The `oauth2` block configures OAuth2 authorization to use when polling the configured URL.

{{< docs/shared lookup="reference/components/oauth2-block.md" source="alloy" version="<ALLOY_VERSION>" >}}

### tls_config block

The `tls_config` block configures TLS settings for connecting to HTTPS servers.

{{< docs/shared lookup="reference/components/tls-config-block.md" source="alloy" version="<ALLOY_VERSION>" >}}

## Example

This example imports custom components from an HTTP response and instantiates a custom component for adding two numbers:
Expand Down Expand Up @@ -57,3 +103,9 @@ math.add "default" {
}
```
{{< /collapse >}}

[client]: #client-block
[basic_auth]: #basic_auth-block
[authorization]: #authorization-block
[oauth2]: #oauth2-block
[tls_config]: #tls_config-block
1 change: 1 addition & 0 deletions docs/sources/tasks/configure/configure-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ To change the set of command-line arguments passed to the {{< param "PRODUCT_NAM
1. Double-click on the value called **Arguments***.

1. In the dialog box, enter the new set of arguments to pass to the {{< param "PRODUCT_NAME" >}} binary.
Make sure that each argument is is on its own line.

1. Restart the {{< param "PRODUCT_NAME" >}} service:

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ require (
github.com/grafana/jfr-parser/pprof v0.0.0-20240126072739-986e71dc0361
github.com/grafana/jsonparser v0.0.0-20240209175146-098958973a2d
github.com/grafana/kafka_exporter v0.0.0-20240409084445-5e3488ad9f9a
github.com/grafana/loki v1.6.2-0.20240221085104-f9d188620153 // k190 branch
github.com/grafana/loki v1.6.2-0.20240510183741-cef4c2826b4b // k190 branch
github.com/grafana/loki/pkg/push v0.0.0-20231212100434-384e5c2dc872 // k180 branch
github.com/grafana/pyroscope-go/godeltaprof v0.1.7
github.com/grafana/pyroscope/api v0.4.0
Expand Down Expand Up @@ -156,7 +156,7 @@ require (
github.com/prometheus/node_exporter v1.6.0
github.com/prometheus/procfs v0.12.0
github.com/prometheus/prometheus v1.99.0
github.com/prometheus/snmp_exporter v0.24.1
github.com/prometheus/snmp_exporter v0.26.0
github.com/prometheus/statsd_exporter v0.22.8
github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052
github.com/rs/cors v1.10.1
Expand Down Expand Up @@ -433,7 +433,7 @@ require (
github.com/googleapis/gax-go/v2 v2.12.2 // indirect
github.com/gophercloud/gophercloud v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gosnmp/gosnmp v1.36.0 // indirect
github.com/gosnmp/gosnmp v1.37.0 // indirect
github.com/grafana/go-offsets-tracker v0.1.7 // indirect
github.com/grafana/gomemcache v0.0.0-20231204155601-7de47a8c3cb0 // indirect
github.com/grafana/jfr-parser v0.8.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1024,8 +1024,8 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gosnmp/gosnmp v1.36.0 h1:1Si+MImHcKIqFc3/kJEs2LOULP1nlFKlzPFyrMOk5Qk=
github.com/gosnmp/gosnmp v1.36.0/go.mod h1:iLcZxN2MxKhH0jPQDVMZaSNypw1ykqVi27O79koQj6w=
github.com/gosnmp/gosnmp v1.37.0 h1:/Tf8D3b9wrnNuf/SfbvO+44mPrjVphBhRtcGg22V07Y=
github.com/gosnmp/gosnmp v1.37.0/go.mod h1:GDH9vNqpsD7f2HvZhKs5dlqSEcAS6s6Qp099oZRCR+M=
github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
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=
Expand Down Expand Up @@ -1054,8 +1054,8 @@ github.com/grafana/jsonparser v0.0.0-20240209175146-098958973a2d h1:YwbJJ/PrVWVd
github.com/grafana/jsonparser v0.0.0-20240209175146-098958973a2d/go.mod h1:796sq+UcONnSlzA3RtlBZ+b/hrerkZXiEmO8oMjyRwY=
github.com/grafana/kafka_exporter v0.0.0-20240409084445-5e3488ad9f9a h1:jqM4NNdx8LSquKo8bPx+XWn91S2b+sgNvEcFfSJQtHY=
github.com/grafana/kafka_exporter v0.0.0-20240409084445-5e3488ad9f9a/go.mod h1:ZXGGyeTUMenf/H1CDBK9lv3azjswfa0nVzLoQAYmnDc=
github.com/grafana/loki v1.6.2-0.20240221085104-f9d188620153 h1:C191g5Ls8lIf9lkJEoScTQgoVDwUdK4HXKP5XtL+zAM=
github.com/grafana/loki v1.6.2-0.20240221085104-f9d188620153/go.mod h1:j2XCl3SmslPf+3Vs7uyoaJE/QkmUlL9JzTBTShSOSiU=
github.com/grafana/loki v1.6.2-0.20240510183741-cef4c2826b4b h1:x5JsSnExxRl9kTMNqHebMCv0fn+V1+T16z7Tgz6xYf4=
github.com/grafana/loki v1.6.2-0.20240510183741-cef4c2826b4b/go.mod h1:j2XCl3SmslPf+3Vs7uyoaJE/QkmUlL9JzTBTShSOSiU=
github.com/grafana/loki/pkg/push v0.0.0-20231212100434-384e5c2dc872 h1:6kPX7bngjBgUlHqADwZ6249UtzMaoQW5n0H8bOtnYeM=
github.com/grafana/loki/pkg/push v0.0.0-20231212100434-384e5c2dc872/go.mod h1:f3JSoxBTPXX5ec4FxxeC19nTBSxoTz+cBgS3cYLMcr0=
github.com/grafana/mysqld_exporter v0.12.2-0.20231005125903-364b9c41e595 h1:I9sRknI5ajd8whPOX0nBDXy5B6xUfhItClMy+6R4oqE=
Expand Down Expand Up @@ -1982,8 +1982,8 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/prometheus/snmp_exporter v0.24.1 h1:AihTbJHurMo8bjtjJde8U+4gMEvpvYvT21Xbd4SzJgY=
github.com/prometheus/snmp_exporter v0.24.1/go.mod h1:j6uIGkdR0DXvKn7HJtSkeDj//UY0sWmdd6XhvdBjln0=
github.com/prometheus/snmp_exporter v0.26.0 h1:7THSh/mAIMmHkiVhmsrAwiH1XNGiFelhPCKBe8PXg8U=
github.com/prometheus/snmp_exporter v0.26.0/go.mod h1:GJEhIONojqxbjn3eyCykWeGVXQJg9pdYSX2scFLpEA0=
github.com/prometheus/statsd_exporter v0.22.8 h1:Qo2D9ZzaQG+id9i5NYNGmbf1aa/KxKbB9aKfMS+Yib0=
github.com/prometheus/statsd_exporter v0.22.8/go.mod h1:/DzwbTEaFTE0Ojz5PqcSk6+PFHOPWGxdXVr6yC8eFOM=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
Expand Down
2 changes: 1 addition & 1 deletion internal/alloycli/cluster_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/grafana/alloy/internal/service/cluster"
"github.com/grafana/ckit/advertise"
"github.com/hashicorp/go-discover"
Expand Down
24 changes: 12 additions & 12 deletions internal/alloycli/cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ import (
"github.com/KimMachineGun/automemlimit/memlimit"
"github.com/fatih/color"
"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy"
"github.com/grafana/alloy/internal/alloy/logging"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/alloy/tracing"
"github.com/grafana/alloy/internal/alloyseed"
"github.com/grafana/alloy/internal/boringcrypto"
"github.com/grafana/alloy/internal/component"
"github.com/grafana/alloy/internal/converter"
convert_diag "github.com/grafana/alloy/internal/converter/diag"
"github.com/grafana/alloy/internal/featuregate"
alloy_runtime "github.com/grafana/alloy/internal/runtime"
"github.com/grafana/alloy/internal/runtime/logging"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/grafana/alloy/internal/runtime/tracing"
"github.com/grafana/alloy/internal/service"
httpservice "github.com/grafana/alloy/internal/service/http"
"github.com/grafana/alloy/internal/service/labelstore"
Expand Down Expand Up @@ -227,7 +227,7 @@ func (fr *alloyRun) Run(configPath string) error {
// To work around this, we lazily create variables for the functions the HTTP
// service needs and set them after the Alloy controller exists.
var (
reload func() (*alloy.Source, error)
reload func() (*alloy_runtime.Source, error)
ready func() bool
)

Expand Down Expand Up @@ -257,7 +257,7 @@ func (fr *alloyRun) Run(configPath string) error {
Gatherer: prometheus.DefaultGatherer,

ReadyFunc: func() bool { return ready() },
ReloadFunc: func() (*alloy.Source, error) { return reload() },
ReloadFunc: func() (*alloy_runtime.Source, error) { return reload() },

HTTPListenAddr: fr.httpListenAddr,
MemoryListenAddr: fr.inMemoryAddr,
Expand All @@ -284,7 +284,7 @@ func (fr *alloyRun) Run(configPath string) error {
labelService := labelstore.New(l, reg)
alloyseed.Init(fr.storagePath, l)

f := alloy.New(alloy.Options{
f := alloy_runtime.New(alloy_runtime.Options{
Logger: l,
Tracer: t,
DataPath: fr.storagePath,
Expand All @@ -301,7 +301,7 @@ func (fr *alloyRun) Run(configPath string) error {
})

ready = f.Ready
reload = func() (*alloy.Source, error) {
reload = func() (*alloy_runtime.Source, error) {
alloySource, err := loadAlloySource(configPath, fr.configFormat, fr.configBypassConversionErrors, fr.configExtraArgs)
defer instrumentation.InstrumentSHA256(alloySource.SHA256())
defer instrumentation.InstrumentLoad(err == nil)
Expand Down Expand Up @@ -390,7 +390,7 @@ func (fr *alloyRun) Run(configPath string) error {
}

// getEnabledComponentsFunc returns a function that gets the current enabled components
func getEnabledComponentsFunc(f *alloy.Alloy) func() map[string]interface{} {
func getEnabledComponentsFunc(f *alloy_runtime.Runtime) func() map[string]interface{} {
return func() map[string]interface{} {
components := component.GetAllComponents(f, component.InfoOptions{})
componentNames := map[string]struct{}{}
Expand All @@ -404,7 +404,7 @@ func getEnabledComponentsFunc(f *alloy.Alloy) func() map[string]interface{} {
}
}

func loadAlloySource(path string, converterSourceFormat string, converterBypassErrors bool, configExtraArgs string) (*alloy.Source, error) {
func loadAlloySource(path string, converterSourceFormat string, converterBypassErrors bool, configExtraArgs string) (*alloy_runtime.Source, error) {
fi, err := os.Stat(path)
if err != nil {
return nil, err
Expand Down Expand Up @@ -436,7 +436,7 @@ func loadAlloySource(path string, converterSourceFormat string, converterBypassE
return nil, err
}

return alloy.ParseSources(sources)
return alloy_runtime.ParseSources(sources)
}

bb, err := os.ReadFile(path)
Expand All @@ -460,7 +460,7 @@ func loadAlloySource(path string, converterSourceFormat string, converterBypassE

instrumentation.InstrumentConfig(bb)

return alloy.ParseSource(path, bb)
return alloy_runtime.ParseSource(path, bb)
}

func interruptContext() (context.Context, context.CancelFunc) {
Expand Down
2 changes: 1 addition & 1 deletion internal/alloycli/resources_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/shirou/gopsutil/v3/net"
"github.com/shirou/gopsutil/v3/process"
Expand Down
2 changes: 1 addition & 1 deletion internal/alloyseed/alloyseed.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/go-kit/log"
"github.com/google/uuid"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/common/version"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/alloy-service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"testing"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/componenttest"
"github.com/grafana/alloy/internal/runtime/componenttest"
"github.com/grafana/alloy/internal/util"
"github.com/phayes/freeport"
"github.com/stretchr/testify/require"
Expand Down
Loading

0 comments on commit 4a109b3

Please sign in to comment.