Skip to content

Commit

Permalink
Release 0.34.1 (#4135)
Browse files Browse the repository at this point in the history
* Fix windows exporter defaults not being set correctly (#4109)

* trying to find root cause

* Update windows exporter to use fork and allow defaults and multiple usages.

* Update windows exporter to use fork and allow defaults and multiple usages.

* Revert useapi usage.

* Remove unused SValue

* Change some verbiage and add comments.

* Update to newest version

* Update go.mod

* add indirect

* Fix tests

* Add test that checks for defaults

* Fix tidy

* go mod tidy

* remote.http: fail early and add logs for failed requests (#4103)

This updates `remote.http` to return an error if polling after Update
fails. Returning an error following Update is important to make sure
that background failures don't cause issues to propagate across
components:

If a component expects remote.http to have a non-empty body, remote.http
should be unhealthy on first evaluation to prevent downstream components
from evaluating.

In addition to failing early, failed requests are now logged to assist
with user debugging.

Fixes #4084.

Co-authored-by: Erik Baranowski <[email protected]>

* changelog

* prometheus.operator.servicemonitors: allow servicemonitors to set bearerTokenFile (#4118)

* version updates for 0.34.1

---------

Co-authored-by: mattdurham <[email protected]>
Co-authored-by: Robert Fratto <[email protected]>
Co-authored-by: Erik Baranowski <[email protected]>
  • Loading branch information
4 people authored Jun 12, 2023
1 parent 2915ea5 commit 371470b
Show file tree
Hide file tree
Showing 24 changed files with 265 additions and 115 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ This document contains a historical list of changes between releases. Only
changes that impact end-user behavior are listed; changes to documentation or
internal API changes are not present.

v0.34.1 (2023-06-12)
--------------------

### Bugfixes

- Fixed application of sub-collector defaults using the `windows_exporter` integration or `prometheus.exporter.windows`. (@mattdurham)

- Fix issue where `remote.http` did not fail early if the initial request
failed. This caused failed requests to initially export empty values, which
could lead to propagating issues downstream to other components which expect
the export to be non-empty. (@rfratto)

- Allow `bearerTokenFile` field to be used in ServiceMonitors. (@captncraig)

### Other changes

- Add logging to failed requests in `remote.http`. (@rfratto)

v0.34.0 (2023-06-08)
--------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ func (cg *ConfigGenerator) GenerateServiceMonitorConfig(m *promopv1.ServiceMonit
return nil, err
}
}
if ep.BearerTokenSecret.Name != "" {
if ep.BearerTokenFile != "" {
cfg.HTTPClientConfig.BearerTokenFile = ep.BearerTokenFile
} else if ep.BearerTokenSecret.Name != "" {
val, err := cg.Secrets.GetSecretValue(m.Namespace, ep.BearerTokenSecret)
if err != nil {
return nil, err
Expand Down
15 changes: 12 additions & 3 deletions component/remote/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/agent/component"
common_config "github.com/grafana/agent/component/common/config"
"github.com/grafana/agent/pkg/build"
Expand Down Expand Up @@ -199,6 +200,7 @@ func (c *Component) pollError() error {

req, err := http.NewRequest(c.args.Method, c.args.URL, nil)
if err != nil {
level.Error(c.log).Log("msg", "failed to build request", "err", err)
return fmt.Errorf("building request: %w", err)
}
for name, value := range c.args.Headers {
Expand All @@ -208,15 +210,18 @@ func (c *Component) pollError() error {

resp, err := c.cli.Do(req)
if err != nil {
level.Error(c.log).Log("msg", "failed to perform request", "err", err)
return fmt.Errorf("performing request: %w", err)
}

bb, err := io.ReadAll(resp.Body)
if err != nil {
level.Error(c.log).Log("msg", "failed to read response", "err", err)
return fmt.Errorf("reading response: %w", err)
}

if resp.StatusCode != http.StatusOK {
level.Error(c.log).Log("msg", "unexpected status code from response", "status", resp.Status)
return fmt.Errorf("unexpected status code %s", resp.Status)
}

Expand All @@ -241,13 +246,17 @@ func (c *Component) pollError() error {
// Update updates the remote.http component. After the update completes, a
// poll is forced.
func (c *Component) Update(args component.Arguments) (err error) {
// poll after updating. If an error occurred during Update, we don't bother
// to do anything.
// Poll after updating and propagate the error if the poll fails. If an error
// occurred during Update, we don't bother to do anything.
//
// It's important to propagate the error in update so the initial state of
// the component is calculated correctly, otherwise the exports will be empty
// and may cause unexpected errors in downstream components.
defer func() {
if err != nil {
return
}
c.poll()
err = c.pollError()
}()

c.mut.Lock()
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/operator/deploy-agent-operator-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ To deploy the `GrafanaAgent` resource:
labels:
app: grafana-agent
spec:
image: grafana/agent:v0.34.0
image: grafana/agent:v0.34.1
integrations:
selector:
matchLabels:
agent: grafana-agent-integrations
image: grafana/agent:v0.34.0
image: grafana/agent:v0.34.1
logLevel: info
serviceAccountName: grafana-agent
metrics:
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/operator/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ To install Agent Operator:
serviceAccountName: grafana-agent-operator
containers:
- name: operator
image: grafana/agent-operator:v0.34.0
image: grafana/agent-operator:v0.34.1
args:
- --kubelet-service=default/kubelet
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ docker run \
-v "/proc:/host/proc:ro,rslave" \
-v /tmp/agent:/etc/agent \
-v /path/to/config.yaml:/etc/agent-config/agent.yaml \
grafana/agent:v0.34.0 \
grafana/agent:v0.34.1 \
--config.file=/etc/agent-config/agent.yaml
```

Expand Down Expand Up @@ -67,7 +67,7 @@ metadata:
name: agent
spec:
containers:
- image: grafana/agent:v0.34.0
- image: grafana/agent:v0.34.1
name: agent
args:
- --config.file=/etc/agent-config/agent.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ docker run \
-v "/proc:/proc:ro" \
-v /tmp/agent:/etc/agent \
-v /path/to/config.yaml:/etc/agent-config/agent.yaml \
grafana/agent:v0.34.0 \
grafana/agent:v0.34.1 \
--config.file=/etc/agent-config/agent.yaml
```

Expand All @@ -37,7 +37,7 @@ metadata:
name: agent
spec:
containers:
- image: grafana/agent:v0.34.0
- image: grafana/agent:v0.34.1
name: agent
args:
- --config.file=/etc/agent-config/agent.yaml
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/static/set-up/install-agent-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Grafana Agent is available as a Docker container image on the following platform
docker run \
-v WAL_DATA_DIRECTORY:/etc/agent/data \
-v CONFIG_FILE_PATH:/etc/agent/agent.yaml \
grafana/agent:v0.34.0
grafana/agent:v0.34.1
```

- Replace `CONFIG_FILE_PATH` with the configuration file path on your Linux host system.
Expand All @@ -47,7 +47,7 @@ Grafana Agent is available as a Docker container image on the following platform
docker run ^
-v WAL_DATA_DIRECTORY:c:\etc\grafana-agent\data ^
-v CONFIG_FILE_PATH:c:\etc\grafana-agent ^
grafana/agent:v0.34.0-windows
grafana/agent:v0.34.1-windows
```

- Replace `CONFIG_FILE_PATH` with the configuration file path on your Windows host system.
Expand Down
11 changes: 8 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ require (
github.com/google/dnsmasq_exporter v0.0.0-00010101000000-000000000000
github.com/google/go-cmp v0.5.9
github.com/google/go-jsonnet v0.18.0
github.com/google/pprof v0.0.0-20230111200839-76d1ae5aea2b // indirect
github.com/google/renameio/v2 v2.0.0
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
Expand Down Expand Up @@ -145,6 +146,7 @@ require (
github.com/shirou/gopsutil/v3 v3.22.9
github.com/sijms/go-ora/v2 v2.7.3
github.com/sirupsen/logrus v1.9.2
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.2
github.com/testcontainers/testcontainers-go v0.19.0
Expand Down Expand Up @@ -198,8 +200,11 @@ require (
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5
sigs.k8s.io/controller-runtime v0.14.6
sigs.k8s.io/yaml v1.3.0

)

require github.com/klauspost/compress v1.15.15

require (
cloud.google.com/go v0.107.0 // indirect
cloud.google.com/go/compute v1.14.0 // indirect
Expand Down Expand Up @@ -359,7 +364,6 @@ require (
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20230111200839-76d1ae5aea2b // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
Expand Down Expand Up @@ -430,7 +434,6 @@ require (
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/kevinburke/ssh_config v1.1.0 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/knadh/koanf v1.4.4 // indirect
github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect
github.com/krallistic/kazoo-go v0.0.0-20170526135507-a15279744f4e // indirect
Expand Down Expand Up @@ -530,7 +533,6 @@ require (
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/sony/gobreaker v0.5.0 // indirect
github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
Expand Down Expand Up @@ -695,3 +697,6 @@ replace github.com/prometheus/procfs => github.com/prometheus/procfs v0.8.0
// TODO(mattdurham): this is so you can debug on windows, when PR is merged into perflib, can you use that
// and eventually remove if windows_exporter shifts to it. https://github.com/leoluk/perflib_exporter/pull/43
replace github.com/leoluk/perflib_exporter => github.com/grafana/perflib_exporter v0.1.1-0.20230511173423-6166026bd090

// TODO(mattdurham): this is to allow defaults to propogate properly.
replace github.com/prometheus-community/windows_exporter => github.com/grafana/windows_exporter v0.15.1-0.20230609142740-b47fa97c3c47
7 changes: 2 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,8 @@ github.com/grafana/tail v0.0.0-20230328181249-aa6682d7843a h1:ypBalFlWhbqP+60je3
github.com/grafana/tail v0.0.0-20230328181249-aa6682d7843a/go.mod h1:7t5XR+2IA8P2qggOAHTj/GCZfoLBle3OvNSYh1VkRBU=
github.com/grafana/vmware_exporter v0.0.4-beta h1:Tb8Edm/wDYh0Lvhm38HLNTlkflUrlPGB+jD+/hW4xHI=
github.com/grafana/vmware_exporter v0.0.4-beta/go.mod h1:+SsUoWeCJ3nDm1gkw8xqBp4NNSUIrGVoEbnwJeeoIVU=
github.com/grafana/windows_exporter v0.15.1-0.20230609142740-b47fa97c3c47 h1:0B4dYFrny1h51kdddXbvg6yHn8LAEfoYuxeQceV6uXw=
github.com/grafana/windows_exporter v0.15.1-0.20230609142740-b47fa97c3c47/go.mod h1:VP/c/Xo6p/PRlSN5s7M2SGscCxLGFRHydjmk0WqxaHU=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grobie/gomemcache v0.0.0-20201204163352-08d7c80fcac6 h1:vqwzYov9hrRoGAmy61um8mVteOCD0bEbKgXr1mmkTlI=
github.com/grobie/gomemcache v0.0.0-20201204163352-08d7c80fcac6/go.mod h1:L69/dBlPQlWkcnU76WgcppK5e4rrxzQdi6LhLnK/ytA=
Expand Down Expand Up @@ -2651,8 +2653,6 @@ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3I
github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034=
github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ=
github.com/opencontainers/image-spec v1.1.0-rc3 h1:fzg1mXZFj8YdPeNkRXMg+zb88BFV0Ys52cJydRwBkb8=
github.com/opencontainers/image-spec v1.1.0-rc3/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
Expand Down Expand Up @@ -2779,8 +2779,6 @@ github.com/prometheus-community/prom-label-proxy v0.5.0 h1:f9RqZ+xwznh/7XbTEr0LD
github.com/prometheus-community/prom-label-proxy v0.5.0/go.mod h1:qiIPYa/ju9u4wq3LjvL3ofzd3jcyW0Rt5jkZ6QgF4nc=
github.com/prometheus-community/stackdriver_exporter v0.13.0 h1:4h7v28foRJ4/RuchNZCYsoDp+CkF4Mp9nebtPzgil3g=
github.com/prometheus-community/stackdriver_exporter v0.13.0/go.mod h1:ZFO015Mexz1xNHSvFjZFiIspYx6qhDg9Kre4LPUjO9s=
github.com/prometheus-community/windows_exporter v0.0.0-20230507104622-79781c6d75fc h1:5HoXejMR9fh1Sh46I/pe/Y3M1vJpm5UvCSqWdBmUZHs=
github.com/prometheus-community/windows_exporter v0.0.0-20230507104622-79781c6d75fc/go.mod h1:O3yNykuN8H0YOdVc4NEzs12Ugp4x2MgNhZvXHPkf7j8=
github.com/prometheus-operator/prometheus-operator v0.62.0 h1:9pjQm5NgZrhJgLIapWxKJXeZ0hasBZ/ekWcyHnsldk0=
github.com/prometheus-operator/prometheus-operator v0.62.0/go.mod h1:fyio1iC7r5NSFw/AQaNH8E+7N7embyY2W1ozINQRShw=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.63.0 h1:efsW3CfymG5bZUpeIsYfdihB33YItCn7uHBOEbnHQG8=
Expand Down Expand Up @@ -2980,7 +2978,6 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
Expand Down
Loading

0 comments on commit 371470b

Please sign in to comment.