Skip to content

Commit

Permalink
V0.40.0 rc.2 update refs (#6519)
Browse files Browse the repository at this point in the history
* loki.write: fix duplicate metrics collector registration (#6511)

Fix an issue where re-creating a write client led to a duplicate
metrics collector registration panic.

Fixes #6510

(cherry picked from commit 34d9517)

* Update refs for v0.40.0-rc.2 (#6517)

- Update references in preparation for v0.40.0-rc.2 release

(cherry picked from commit 412a503)

---------

Co-authored-by: Robert Fratto <[email protected]>
  • Loading branch information
jcreixell and rfratto authored Feb 26, 2024
1 parent 299d17b commit 29e380e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 9 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ changes that impact end-user behavior are listed; changes to documentation or
internal API changes are not present.


v0.40.0-rc.1 (2024-02-23)

v0.40.0-rc.2 (2024-02-26)
-------------------------

### Breaking changes
Expand All @@ -25,7 +26,7 @@ v0.40.0-rc.1 (2024-02-23)

### Features

- Modules have been redesigned to split the import logic from the instantiation.
- Modules have been redesigned to split the import logic from the instantiation.
You can now define custom components via the `declare` config block and import modules via `import.git`, `import.http`, `import.string`, `import.file`. (@wildum)

- A new `discovery.process` component for discovering Linux OS processes on the current host. (@korniltsev)
Expand All @@ -38,7 +39,7 @@ v0.40.0-rc.1 (2024-02-23)
- Expose track_timestamps_staleness on Prometheus scraping, to fix the issue where container metrics live for 5 minutes after the container disappears. (@ptodev)

- Introduce the `remotecfg` service that enables loading configuration from a
remote endpoint. (@tpaschalis)
remote endpoint. (@tpaschalis)

- Add `otelcol.connector.host_info` component to gather usage metrics for cloud users. (@rlankfo, @jcreixell)

Expand Down Expand Up @@ -98,7 +99,7 @@ v0.40.0-rc.1 (2024-02-23)
- Fix an issue where agent logs are emitted before the logging format
is correctly determined. (@hainenber)

- Fix divide-by-zero issue when sharding targets. (@hainenber)
- Fix divide-by-zero issue when sharding targets. (@hainenber)

- Fix bug where custom headers were not actually being set in loki client. (@captncraig)

Expand All @@ -112,6 +113,8 @@ v0.40.0-rc.1 (2024-02-23)

- Fix an issue where the configuration of the `http` and `remotecfg` blocks get ignored after loading a module. (@erikbaranowski)

- Fix an issue where changing the configuration of `loki.write` would cause a panic. (@rfratto)

### Other changes

- Removed support for Windows 2012 in line with Microsoft end of life. (@mattdurham)
Expand Down
7 changes: 5 additions & 2 deletions component/common/loki/client/internal/metrics.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package internal

import "github.com/prometheus/client_golang/prometheus"
import (
"github.com/grafana/agent/pkg/util"
"github.com/prometheus/client_golang/prometheus"
)

type MarkerMetrics struct {
lastMarkedSegment *prometheus.GaugeVec
Expand All @@ -19,7 +22,7 @@ func NewMarkerMetrics(reg prometheus.Registerer) *MarkerMetrics {
),
}
if reg != nil {
reg.MustRegister(m.lastMarkedSegment)
m.lastMarkedSegment = util.MustRegisterOrGet(reg, m.lastMarkedSegment).(*prometheus.GaugeVec)
}
return m
}
Expand Down
22 changes: 22 additions & 0 deletions component/common/loki/client/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,28 @@ var (
metrics = NewMetrics(prometheus.DefaultRegisterer)
)

// TestManager_NoDuplicateMetricsPanic ensures that creating two managers does
// not lead to duplicate metrics registration.
func TestManager_NoDuplicateMetricsPanic(t *testing.T) {
var (
host, _ = url.Parse("http://localhost:3100")

reg = prometheus.NewRegistry()
metrics = NewMetrics(reg)
)

require.NotPanics(t, func() {
for i := 0; i < 2; i++ {
_, err := NewManager(metrics, log.NewLogfmtLogger(os.Stdout), testLimitsConfig, reg, wal.Config{
WatchConfig: wal.DefaultWatchConfig,
}, NilNotifier, Config{
URL: flagext.URLValue{URL: host},
})
require.NoError(t, err)
}
})
}

func TestManager_ErrorCreatingWhenNoClientConfigsProvided(t *testing.T) {
for _, walEnabled := range []bool{true, false} {
t.Run(fmt.Sprintf("wal-enabled = %t", walEnabled), func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: Grafana Agent
description: Grafana Agent is a flexible, performant, vendor-neutral, telemetry collector
weight: 350
cascade:
AGENT_RELEASE: v0.40.0-rc.1
AGENT_RELEASE: v0.40.0-rc.2
OTEL_VERSION: v0.87.0
---

Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package operator

// Supported versions of the Grafana Agent.
var (
DefaultAgentVersion = "v0.40.0-rc.1"
DefaultAgentVersion = "v0.40.0-rc.2"
DefaultAgentBaseImage = "grafana/agent"
DefaultAgentImage = DefaultAgentBaseImage + ":" + DefaultAgentVersion
)
Expand Down
2 changes: 1 addition & 1 deletion tools/gen-versioned-files/agent-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.40.0-rc.1
v0.40.0-rc.2

0 comments on commit 29e380e

Please sign in to comment.