diff --git a/.github/workflows/deploy-pr-preview.yml b/.github/workflows/deploy-pr-preview.yml new file mode 100644 index 0000000000..fadcde280c --- /dev/null +++ b/.github/workflows/deploy-pr-preview.yml @@ -0,0 +1,23 @@ +name: Deploy pr preview + +on: + pull_request: + types: + - opened + - synchronize + - closed + paths: + - "docs/sources/**" + +jobs: + deploy-pr-preview: + uses: grafana/writers-toolkit/.github/workflows/deploy-preview.yml@main + with: + sha: ${{ github.event.pull_request.head.sha }} + branch: ${{ github.head_ref }} + event_number: ${{ github.event.number }} + title: ${{ github.event.pull_request.title }} + repo: alloy + website_directory: content/docs/alloy/latest + relative_prefix: /docs/alloy/latest/ + index_file: true diff --git a/CHANGELOG.md b/CHANGELOG.md index ec8ba4d78d..9da7c5266b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ Main (unreleased) - Add `otelcol.receiver.influxdb` to convert influx metric into OTEL. (@EHSchmitt4395) +- Add a new `/-/healthy` endpoint which returns HTTP 500 if one or more components are unhealthy. (@ptodev) + ### Enhancements - Add second metrics sample to the support bundle to provide delta information (@dehaansa) @@ -50,9 +52,13 @@ Main (unreleased) - Use a forked `github.com/goccy/go-json` module which reduces the memory consumption of an Alloy instance by 20MB. If Alloy is running certain otelcol components, this reduction will not apply. (@ptodev) + +- Update `prometheus.write.queue` library for performance increases in cpu. (@mattdurham) ### Bugfixes +- Fixed issue with automemlimit logging bad messages and trying to access cgroup on non-linux builds (@dehaansa) + - Fixed issue with reloading configuration and prometheus metrics duplication in `prometheus.write.queue`. (@mattdurham) - Updated `prometheus.write.queue` to fix issue with TTL comparing different scales of time. (@mattdurham) diff --git a/CODEOWNERS b/CODEOWNERS index 750a939cd5..3d3b770f0c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -9,6 +9,7 @@ * @grafana/grafana-alloy-maintainers #`make docs` procedure and related workflows are owned by @jdbaldry. +/.github/workflows/deploy-pr-preview.yml @jdbaldry /.github/workflows/publish-technical-documentation-next.yml @jdbaldry /.github/workflows/publish-technical-documentation-release.yml @jdbaldry /.github/workflows/update-make-docs.yml @jdbaldry diff --git a/docs/sources/reference/_index.md b/docs/sources/reference/_index.md index 7969d0ea58..d98ca48aa0 100644 --- a/docs/sources/reference/_index.md +++ b/docs/sources/reference/_index.md @@ -1,6 +1,6 @@ --- canonical: https://grafana.com/docs/alloy/latest/reference/ -description: The reference-level documentaiton for Grafana Aloy +description: The reference-level documentation for Grafana Alloy menuTitle: Reference title: Grafana Alloy Reference weight: 600 diff --git a/docs/sources/reference/cli/environment-variables.md b/docs/sources/reference/cli/environment-variables.md index a0633188bc..c5eefcdc07 100644 --- a/docs/sources/reference/cli/environment-variables.md +++ b/docs/sources/reference/cli/environment-variables.md @@ -20,6 +20,7 @@ The following environment variables are supported: * `PPROF_BLOCK_PROFILING_RATE` * `GOMEMLIMIT` * `AUTOMEMLIMIT` +* `AUTOMEMLIMIT_EXPERIMENT` * `GOGC` * `GOMAXPROCS` * `GOTRACEBACK` @@ -80,6 +81,7 @@ For example, if you want to keep memory usage below `10GiB`, use `GOMEMLIMIT=9Gi The `GOMEMLIMIT` environment variable is either automatically set to 90% of an available `cgroup` value using the [`automemlimit`][automemlimit] module, or you can explicitly set the `GOMEMLIMIT` environment variable before you run {{< param "PRODUCT_NAME" >}}. You can also change the 90% ratio by setting the `AUTOMEMLIMIT` environment variable to a float value between `0` and `1.0`. No changes occur if the limit can't be determined and you didn't explicitly define a `GOMEMLIMIT` value. +The `AUTOMEMLIMIT_EXPERIMENT` variable can be set to `system` to use the [`automemlimit`][automemlimit] module's System provider, which sets `GOMEMLIMIT` based on the same ratio applied to the total system memory. As `cgroup` is a Linux specific concept, this is the only way to use the `automemlimit` module to automatically set `GOMEMLIMIT` on non-Linux OSes. ## GOGC diff --git a/docs/sources/reference/http/_index.md b/docs/sources/reference/http/_index.md new file mode 100644 index 0000000000..f2f433e7b2 --- /dev/null +++ b/docs/sources/reference/http/_index.md @@ -0,0 +1,78 @@ +--- +canonical: https://grafana.com/docs/alloy/latest/reference/http/ +description: Learn about HTTP endpoints exposed by Grafana Alloy +title: The Grafana Alloy HTTP endpoints +menuTitle: HTTP endpoints +weight: 700 +--- + +# The {{% param "FULL_PRODUCT_NAME" %}} HTTP endpoints + +{{< param "FULL_PRODUCT_NAME" >}} has several default HTTP endpoints that are available by default regardless of which components you have configured. +You can use these HTTP endpoints to monitor, health check, and troubleshoot {{< param "PRODUCT_NAME" >}}. + +The HTTP server which exposes them is configured via the [http block](../config-blocks/http) +and the `--server.` [command line arguments](../cli/run). +For example, if you set the `--server.http.listen-addr` command line argument to `127.0.0.1:12345`, +you can query the `127.0.0.1:12345/metrics` endpoint to see the internal metrics of {{< param "PRODUCT_NAME" >}}. + +### /metrics + +The `/metrics` endpoint returns the internal metrics of {{< param "PRODUCT_NAME" >}} in the Prometheus exposition format. + +### /-/ready + +An {{< param "PRODUCT_NAME" >}} instance is ready once it has loaded its initial configuration. +If the instance is ready, the `/-/ready` endpoint returns `HTTP 200 OK` and the message `Alloy is ready.` +Otherwise, if the instance is not ready, the `/-/ready` endpoint returns `HTTP 503 Service Unavailable` and the message `Alloy is not ready.` + +### /-/healthy + +When all {{< param "PRODUCT_NAME" >}} components are working correctly, all components are considered healthy. +If all components are healthy, the `/-/healthy` endpoint returns `HTTP 200 OK` and the message `All Alloy components are healthy.`. +Otherwise, if any of the components are not working correctly, the `/-/healthy` endpoint returns `HTTP 500 Internal Server Error` and an error message. +You can also monitor component health through the {{< param "PRODUCT_NAME" >}} [UI](../../troubleshoot/debug#alloy-ui). + +```shell +$ curl localhost:12345/-/healthy +All Alloy components are healthy. +``` + +```shell +$ curl localhost:12345/-/healthy +unhealthy components: math.add +``` + +{{< admonition type="note" >}} +The `/-/healthy` endpoint isn't suitable for a [Kubernetes liveness probe][k8s-liveness]. + +An {{< param "PRODUCT_NAME" >}} instance that reports as unhealthy should not necessarily be restarted. +For example, a component may be unhealthy due to an invalid configuration or an unavailable external resource. +In this case, restarting {{< param "PRODUCT_NAME" >}} would not fix the problem. +A restart may make it worse, because it would could stop the flow of telemetry in healthy pipelines. + +[k8s-liveness]: https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/ +{{< /admonition >}} + +### /-/reload + +The `/-/reload` endpoint reloads the {{< param "PRODUCT_NAME" >}} configuration file. +If the configuration file can't be reloaded, the `/-/reload` endpoint returns `HTTP 400 Bad Request` and an error message. + +```shell +$ curl localhost:12345/-/reload +config reloaded +``` + +```shell +$ curl localhost:12345/-/reload +error during the initial load: /Users/user1/Desktop/git.alloy:13:1: Failed to build component: loading custom component controller: custom component config not found in the registry, namespace: "math", componentName: "add" +``` + +### /-/support + +The `/-/support` endpoint returns a [support bundle](../../troubleshoot/support_bundle) that contains information about your {{< param "PRODUCT_NAME" >}} instance. You can use this information as a baseline when debugging an issue. + +### /debug/pprof + +The `/debug/pprof` endpoint returns a pprof Go [profile](../../troubleshoot/profile) that you can use to visualize and analyze profiling data. diff --git a/docs/sources/set-up/install/openshift.md b/docs/sources/set-up/install/openshift.md new file mode 100644 index 0000000000..7bb8b1f290 --- /dev/null +++ b/docs/sources/set-up/install/openshift.md @@ -0,0 +1,165 @@ +--- +canonical: https://grafana.com/docs/alloy/latest/set-up/install/openshift/ +description: Learn how to deploy Grafana Alloy on OpenShift +menuTitle: OpenShift +title: Deploy Grafana Alloy on OpenShift +weight: 530 +--- + +# Deploy {{% param "FULL_PRODUCT_NAME" %}} on OpenShift + +You can deploy {{< param "PRODUCT_NAME" >}} on the Red Hat OpenShift Container Platform (OCP). + +## Before you begin + +* These steps assume you have a working OCP environment. +* You can adapt the suggested policies and configuration to meet your specific needs and security policies. + +## Configure RBAC + +You must configure Role-Based Access Control (RBAC) to allow secure access to Kubernetes and OCP resources. + +1. Download the [rbac.yaml][] configuration file. This configuration file defines the OCP verbs and permissions for {{< param "PRODUCT_NAME" >}}. +1. Review the `rbac.yaml` file and adapt as needed for your local environment. Refer to [Managing Role-based Access Control (RBAC)][rbac] topic in the OCP documentation for more information about updating and managing your RBAC configurations. + +## Run {{% param "PRODUCT_NAME" %}} as a non-root user + +You must configure {{< param "PRODUCT_NAME" >}} to [run as a non-root user][nonroot]. +This ensures that {{< param "PRODUCT_NAME" >}} complies with your OCP security policies. + +## Apply security context constraints + +OCP uses Security Context Constraints (SCC) to control Pod permissions. +Refer to [Managing security context constraints][scc] for more information about how you can define and enforce these permissions. +This ensures that the pods running {{< param "PRODUCT_NAME" >}} comply with OCP security policies. + +{{< admonition type="note" >}} +The security context is only configured at the container level, not at the container and deployment level. +{{< /admonition >}} + +You can apply the following SCCs when you deploy {{< param "PRODUCT_NAME" >}}. + +{{< admonition type="note" >}} +Not all of these SCCs are required for each use case. +You can adapt the SCCs to meet your local requirements and needs. +{{< /admonition >}} + +* `RunAsUser`: Specifies the user ID under which {{< param "PRODUCT_NAME" >}} runs. + You must configure this constraint to allow a non-root user ID. +* `SELinuxContext`: Configures the SELinux context for containers. + If you run {{< param "PRODUCT_NAME" >}} as root, you must configure this constraint to make sure that SELinux policies don't block {{< param "PRODUCT_NAME" >}}. + This SCC is generally not required to deploy {{< param "PRODUCT_NAME" >}} as a non-root user. +* `FSGroup`: Specifies the fsGroup IDs for file system access. + You must configure this constraint to give {{< param "PRODUCT_NAME" >}} group access to the files it needs. +* `Volumes`: Specifies the persistent volumes used for storage. + You must configure this constraint to give {{< param "PRODUCT_NAME" >}} access to the volumes it needs. + +## Example DaemonSet configuration + +The following example shows a DaemonSet configuration that deploys {{< param "PRODUCT_NAME" >}} as a non-root user: + +```yaml +apiVersion: aapps/v1 +kind: DaemonSet +metadata: + name: alloy-logs + namespace: monitoring +spec: + selector: + matchLabels: + app: alloy-logs + template: + metadata: + labels: + app: alloy-logs + spec: + containers: + - name: alloy-logs + image: grafana/alloy: + ports: + - containerPort: 12345 + # The security context configuration + securityContext: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + runAsUser: 473 + runAsGroup: 473 + fsGroup: 1000 + volumes: + - name: log-volume + emptyDir: {} +``` + +Replace the following: + +* _``_: Set to the specific {{< param "PRODUCT_NAME" >}} version you are deploying. For example, `1.5.1`. + +{{< admonition type="note" >}} +This example uses the simplest volume type, `emptyDir`. In this example configuration, if your node restarts, your data will be lost. Make sure you set the volume type to a persistent storage location for production environments. Refer to [Using volumes to persist container data](https://docs.openshift.com/container-platform/latest/nodes/containers/nodes-containers-volumes.html) in the OpenShift documentation for more information. +{{< /admonition >}} + +## Example SSC definition + +The following example shows an SSC definition that deploys {{< param "PRODUCT_NAME" >}} as a non-root user: + +```yaml +kind: SecurityContextConstraints +apiVersion: security.openshift.io/v1 +metadata: + name: scc-alloy +runAsUser: + type: MustRunAs + uid: 473 +fsGroup: + type: MustRunAs + uid: 1000 +volumes: +- '*' +users: +- my-admin-user +groups: +- my-admin-group +seLinuxContext: + type: MustRunAs + user: + role: + type: + level: +``` + +Replace the following: + +* _``_: The user for your SELinux context. +* _``_: The role for your SELinux context. +* _``_: The container type for your SELinux context. +* _``_: The level for your SELinux context. + +Refer to [SELinux Contexts][selinux] in the RedHat documentation for more information on the SELinux context configuration. + +{{< admonition type="note" >}} +This example sets `volumes:` to `*`. In a production environment, you should set `volumes:` to only the volumes that are necessary for the deployment. For example: + +```yaml +volumes: + - configMap + - downwardAPI + - emptyDir + - persistentVolumeClaim + - secret +``` + +{{< /admonition >}} + +Refer to [Deploy {{< param "FULL_PRODUCT_NAME" >}}][deploy] for more information about deploying {{< param "PRODUCT_NAME" >}} in your environment. + +## Next steps + +* [Configure {{< param "PRODUCT_NAME" >}}][Configure] + +[rbac.yaml]: https://github.com/grafana/alloy/blob/main/operations/helm/charts/alloy/templates/rbac.yaml +[rbac]: https://docs.openshift.com/container-platform/latest/authentication/using-rbac.html +[nonroot]: ../../../configure/nonroot/ +[scc]: https://docs.openshift.com/container-platform/latest/authentication/managing-security-context-constraints.html +[Configure]: ../../../configure/linux/ +[deploy]: ../../deploy/ +[selinux]: https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/6/html/security-enhanced_linux/chap-security-enhanced_linux-selinux_contexts#chap-Security-Enhanced_Linux-SELinux_Contexts diff --git a/go.mod b/go.mod index c805f58c80..0c662da968 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/Azure/go-autorest/autorest v0.11.29 github.com/DATA-DOG/go-sqlmock v1.5.2 github.com/IBM/sarama v1.43.3 - github.com/KimMachineGun/automemlimit v0.6.0 + github.com/KimMachineGun/automemlimit v0.6.1 github.com/Lusitaniae/apache_exporter v0.11.1-0.20220518131644-f9522724dab4 github.com/Masterminds/sprig/v3 v3.2.3 github.com/PuerkitoBio/rehttp v1.4.0 @@ -73,7 +73,7 @@ require ( github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc github.com/grafana/tail v0.0.0-20230510142333-77b18831edf0 github.com/grafana/vmware_exporter v0.0.5-beta - github.com/grafana/walqueue v0.0.0-20241202135041-6ec70efeec94 + github.com/grafana/walqueue v0.0.0-20241211144301-2b91b7dd6e08 github.com/hashicorp/consul/api v1.29.5 github.com/hashicorp/go-discover v0.0.0-20230724184603-e89ebd1b2f65 github.com/hashicorp/go-multierror v1.1.1 @@ -248,13 +248,13 @@ require ( go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.29.0 + golang.org/x/crypto v0.31.0 golang.org/x/crypto/x509roots/fallback v0.0.0-20240208163226-62c9f1799c91 golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 golang.org/x/net v0.31.0 golang.org/x/oauth2 v0.23.0 - golang.org/x/sys v0.27.0 - golang.org/x/text v0.20.0 + golang.org/x/sys v0.28.0 + golang.org/x/text v0.21.0 golang.org/x/time v0.6.0 golang.org/x/tools v0.25.0 google.golang.org/api v0.188.0 @@ -803,8 +803,8 @@ require ( go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect golang.org/x/arch v0.7.0 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/sync v0.9.0 - golang.org/x/term v0.26.0 // indirect + golang.org/x/sync v0.10.0 + golang.org/x/term v0.27.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gonum.org/v1/gonum v0.15.1 // indirect diff --git a/go.sum b/go.sum index 8cc1234db6..77ad0b47c0 100644 --- a/go.sum +++ b/go.sum @@ -917,8 +917,8 @@ github.com/IBM/sarama v1.43.3/go.mod h1:FVIRaLrhK3Cla/9FfRF5X9Zua2KpS3SYIXxhac1H github.com/Jeffail/gabs v1.1.0/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c h1:RGWPOewvKIROun94nF7v2cua9qP+thov/7M50KEoeSU= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= -github.com/KimMachineGun/automemlimit v0.6.0 h1:p/BXkH+K40Hax+PuWWPQ478hPjsp9h1CPDhLlA3Z37E= -github.com/KimMachineGun/automemlimit v0.6.0/go.mod h1:T7xYht7B8r6AG/AqFcUdc7fzd2bIdBKmepfP2S1svPY= +github.com/KimMachineGun/automemlimit v0.6.1 h1:ILa9j1onAAMadBsyyUJv5cack8Y1WT26yLj/V+ulKp8= +github.com/KimMachineGun/automemlimit v0.6.1/go.mod h1:T7xYht7B8r6AG/AqFcUdc7fzd2bIdBKmepfP2S1svPY= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Lusitaniae/apache_exporter v0.11.1-0.20220518131644-f9522724dab4 h1:UEm6tMvLH2t2honcWG0q+h0qr/60++9cuh/fy7hLyMc= github.com/Lusitaniae/apache_exporter v0.11.1-0.20220518131644-f9522724dab4/go.mod h1:IfUbHkoXypdKnVGHWQ3DLRRRZzIU/JIExQAd9xgxRfw= @@ -1900,8 +1900,8 @@ github.com/grafana/tail v0.0.0-20230510142333-77b18831edf0 h1:bjh0PVYSVVFxzINqPF github.com/grafana/tail v0.0.0-20230510142333-77b18831edf0/go.mod h1:7t5XR+2IA8P2qggOAHTj/GCZfoLBle3OvNSYh1VkRBU= github.com/grafana/vmware_exporter v0.0.5-beta h1:2JCqzIWJzns8FN78wPsueC9rT3e3kZo2OUoL5kGMjdM= github.com/grafana/vmware_exporter v0.0.5-beta/go.mod h1:1CecUZII0zVsVcHtNfNeTTcxK7EksqAsAn/TCCB0Mh4= -github.com/grafana/walqueue v0.0.0-20241202135041-6ec70efeec94 h1:d3Hgun3ailVbNArBIhvRIjmCBOOCO9ClKNpzqQFsMLE= -github.com/grafana/walqueue v0.0.0-20241202135041-6ec70efeec94/go.mod h1:2B+4gxoOgzgRhstKcikROUHusMXLqd5nE/UKukaQrJI= +github.com/grafana/walqueue v0.0.0-20241211144301-2b91b7dd6e08 h1:5J0oLMTpZHwoY95A8milCZajdZQecpnBwOPKBheHw6M= +github.com/grafana/walqueue v0.0.0-20241211144301-2b91b7dd6e08/go.mod h1:2B+4gxoOgzgRhstKcikROUHusMXLqd5nE/UKukaQrJI= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grobie/gomemcache v0.0.0-20230213081705-239240bbc445 h1:FlKQKUYPZ5yDCN248M3R7x8yu2E3yEZ0H7aLomE4EoE= github.com/grobie/gomemcache v0.0.0-20230213081705-239240bbc445/go.mod h1:L69/dBlPQlWkcnU76WgcppK5e4rrxzQdi6LhLnK/ytA= @@ -3546,8 +3546,8 @@ golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= -golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/crypto/x509roots/fallback v0.0.0-20240208163226-62c9f1799c91 h1:Lyizcy9jX02jYR0ceBkL6S+jRys8Uepf7wt1vrz6Ras= golang.org/x/crypto/x509roots/fallback v0.0.0-20240208163226-62c9f1799c91/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -3759,8 +3759,8 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -3901,8 +3901,8 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -3921,8 +3921,8 @@ golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= -golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -3945,8 +3945,8 @@ golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/internal/alloycli/automemlimit_cgroups_unsupported.go b/internal/alloycli/automemlimit_cgroups_unsupported.go new file mode 100644 index 0000000000..e61cfddbd2 --- /dev/null +++ b/internal/alloycli/automemlimit_cgroups_unsupported.go @@ -0,0 +1,25 @@ +//go:build !linux +// +build !linux + +package alloycli + +import ( + "log/slog" + "os" + "slices" + "strings" + + "github.com/KimMachineGun/automemlimit/memlimit" + "github.com/grafana/alloy/internal/runtime/logging" +) + +func applyAutoMemLimit(l *logging.Logger) { + // For non-linux builds without cgroups, memlimit will always report an error. + // However, if the system experiment is requested, we can use the system memory limit provider. + // This logic is similar to https://github.com/KimMachineGun/automemlimit/blob/main/memlimit/experiment.go + if v, ok := os.LookupEnv("AUTOMEMLIMIT_EXPERIMENT"); ok { + if slices.Contains(strings.Split(v, ","), "system") { + memlimit.SetGoMemLimitWithOpts(memlimit.WithProvider(memlimit.FromSystem), memlimit.WithLogger(slog.New(l.Handler()))) + } + } +} diff --git a/internal/alloycli/automemlimit_linux.go b/internal/alloycli/automemlimit_linux.go new file mode 100644 index 0000000000..148c160a46 --- /dev/null +++ b/internal/alloycli/automemlimit_linux.go @@ -0,0 +1,12 @@ +package alloycli + +import ( + "log/slog" + + "github.com/KimMachineGun/automemlimit/memlimit" + "github.com/grafana/alloy/internal/runtime/logging" +) + +func applyAutoMemLimit(l *logging.Logger) { + memlimit.SetGoMemLimitWithOpts(memlimit.WithLogger(slog.New(l.Handler()))) +} diff --git a/internal/alloycli/automemlimit_nonlinux_test.go b/internal/alloycli/automemlimit_nonlinux_test.go new file mode 100644 index 0000000000..6b6fefaaf9 --- /dev/null +++ b/internal/alloycli/automemlimit_nonlinux_test.go @@ -0,0 +1,30 @@ +//go:build !linux +// +build !linux + +package alloycli + +import ( + "bytes" + "log/slog" + "testing" + + "github.com/KimMachineGun/automemlimit/memlimit" + "github.com/grafana/alloy/internal/runtime/logging" + "github.com/stretchr/testify/require" +) + +func TestNoMemlimitErrorLogs(t *testing.T) { + buffer := bytes.NewBuffer(nil) + + l, err := logging.New(buffer, logging.DefaultOptions) + require.NoError(t, err) + + applyAutoMemLimit(l) + + require.Equal(t, "", buffer.String()) + + // Linux behavior, to confirm error is logged + memlimit.SetGoMemLimitWithOpts(memlimit.WithLogger(slog.New(l.Handler()))) + + require.Contains(t, buffer.String(), "cgroups is not supported on this system") +} diff --git a/internal/alloycli/cmd_run.go b/internal/alloycli/cmd_run.go index 43f6768255..7ef521ed19 100644 --- a/internal/alloycli/cmd_run.go +++ b/internal/alloycli/cmd_run.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "io/fs" - "log/slog" "os" "os/signal" "path/filepath" @@ -16,7 +15,6 @@ import ( "syscall" "time" - "github.com/KimMachineGun/automemlimit/memlimit" "github.com/fatih/color" "github.com/go-kit/log" "github.com/grafana/ckit/advertise" @@ -221,8 +219,8 @@ func (fr *alloyRun) Run(cmd *cobra.Command, configPath string) error { level.Info(l).Log("boringcrypto enabled", boringcrypto.Enabled) // Set the memory limit, this will honor GOMEMLIMIT if set - // If there is a cgroup will follow that - memlimit.SetGoMemLimitWithOpts(memlimit.WithLogger(slog.New(l.Handler()))) + // If there is a cgroup on linux it will use that + applyAutoMemLimit(l) // Enable the profiling. setMutexBlockProfiling(l) diff --git a/internal/component/faro/receiver/exporters.go b/internal/component/faro/receiver/exporters.go index 5ce602ed4b..1543b126c7 100644 --- a/internal/component/faro/receiver/exporters.go +++ b/internal/component/faro/receiver/exporters.go @@ -17,6 +17,7 @@ import ( "github.com/grafana/alloy/internal/component/faro/receiver/internal/payload" "github.com/grafana/alloy/internal/component/otelcol" "github.com/grafana/alloy/internal/runtime/logging/level" + "github.com/grafana/alloy/internal/util" ) type exporter interface { @@ -57,7 +58,10 @@ func newMetricsExporter(reg prometheus.Registerer) *metricsExporter { }), } - reg.MustRegister(exp.totalLogs, exp.totalExceptions, exp.totalMeasurements, exp.totalEvents) + exp.totalLogs = util.MustRegisterOrGet(reg, exp.totalLogs).(prometheus.Counter) + exp.totalMeasurements = util.MustRegisterOrGet(reg, exp.totalMeasurements).(prometheus.Counter) + exp.totalExceptions = util.MustRegisterOrGet(reg, exp.totalExceptions).(prometheus.Counter) + exp.totalEvents = util.MustRegisterOrGet(reg, exp.totalEvents).(prometheus.Counter) return exp } diff --git a/internal/component/faro/receiver/handler.go b/internal/component/faro/receiver/handler.go index 95c55c7322..be82d07a70 100644 --- a/internal/component/faro/receiver/handler.go +++ b/internal/component/faro/receiver/handler.go @@ -10,6 +10,7 @@ import ( "github.com/go-kit/log" "github.com/grafana/alloy/internal/component/faro/receiver/internal/payload" "github.com/grafana/alloy/internal/runtime/logging/level" + "github.com/grafana/alloy/internal/util" "github.com/prometheus/client_golang/prometheus" "github.com/rs/cors" "go.opentelemetry.io/collector/client" @@ -36,7 +37,7 @@ func newHandler(l log.Logger, reg prometheus.Registerer, exporters []exporter) * Name: "faro_receiver_exporter_errors_total", Help: "Total number of errors produced by a receiver exporter", }, []string{"exporter"}) - reg.MustRegister(errorsTotal) + errorsTotal = util.MustRegisterOrGet(reg, errorsTotal).(*prometheus.CounterVec) return &handler{ log: l, diff --git a/internal/component/faro/receiver/server.go b/internal/component/faro/receiver/server.go index 13b2c0d140..15d35248bb 100644 --- a/internal/component/faro/receiver/server.go +++ b/internal/component/faro/receiver/server.go @@ -9,6 +9,7 @@ import ( "github.com/go-kit/log" "github.com/gorilla/mux" "github.com/grafana/alloy/internal/runtime/logging/level" + "github.com/grafana/alloy/internal/util" "github.com/grafana/dskit/instrument" "github.com/grafana/dskit/middleware" "github.com/prometheus/client_golang/prometheus" @@ -46,7 +47,11 @@ func newServerMetrics(reg prometheus.Registerer) *serverMetrics { Help: "Current number of inflight requests.", }, []string{"method", "route"}), } - reg.MustRegister(m.requestDuration, m.rxMessageSize, m.txMessageSize, m.inflightRequests) + + m.requestDuration = util.MustRegisterOrGet(reg, m.requestDuration).(*prometheus.HistogramVec) + m.rxMessageSize = util.MustRegisterOrGet(reg, m.rxMessageSize).(*prometheus.HistogramVec) + m.txMessageSize = util.MustRegisterOrGet(reg, m.txMessageSize).(*prometheus.HistogramVec) + m.inflightRequests = util.MustRegisterOrGet(reg, m.inflightRequests).(*prometheus.GaugeVec) return m } diff --git a/internal/component/faro/receiver/sourcemaps.go b/internal/component/faro/receiver/sourcemaps.go index 6b75aaab45..3a2c48f7c9 100644 --- a/internal/component/faro/receiver/sourcemaps.go +++ b/internal/component/faro/receiver/sourcemaps.go @@ -18,6 +18,7 @@ import ( "github.com/go-sourcemap/sourcemap" "github.com/grafana/alloy/internal/component/faro/receiver/internal/payload" "github.com/grafana/alloy/internal/runtime/logging/level" + "github.com/grafana/alloy/internal/util" "github.com/grafana/alloy/internal/util/wildcard" "github.com/prometheus/client_golang/prometheus" "github.com/vincent-petithory/dataurl" @@ -68,7 +69,9 @@ func newSourceMapMetrics(reg prometheus.Registerer) *sourceMapMetrics { }, []string{"origin", "status"}), } - reg.MustRegister(m.cacheSize, m.downloads, m.fileReads) + m.cacheSize = util.MustRegisterOrGet(reg, m.cacheSize).(*prometheus.CounterVec) + m.downloads = util.MustRegisterOrGet(reg, m.downloads).(*prometheus.CounterVec) + m.fileReads = util.MustRegisterOrGet(reg, m.fileReads).(*prometheus.CounterVec) return m } diff --git a/internal/component/loki/relabel/metrics.go b/internal/component/loki/relabel/metrics.go index 6f609fb649..0c002f717b 100644 --- a/internal/component/loki/relabel/metrics.go +++ b/internal/component/loki/relabel/metrics.go @@ -1,6 +1,7 @@ package relabel import ( + "github.com/grafana/alloy/internal/util" "github.com/prometheus/client_golang/prometheus" prometheus_client "github.com/prometheus/client_golang/prometheus" ) @@ -40,13 +41,11 @@ func newMetrics(reg prometheus.Registerer) *metrics { }) if reg != nil { - reg.MustRegister( - m.entriesProcessed, - m.entriesOutgoing, - m.cacheMisses, - m.cacheHits, - m.cacheSize, - ) + m.entriesProcessed = util.MustRegisterOrGet(reg, m.entriesProcessed).(prometheus_client.Counter) + m.entriesOutgoing = util.MustRegisterOrGet(reg, m.entriesOutgoing).(prometheus_client.Counter) + m.cacheMisses = util.MustRegisterOrGet(reg, m.cacheMisses).(prometheus_client.Counter) + m.cacheHits = util.MustRegisterOrGet(reg, m.cacheHits).(prometheus_client.Counter) + m.cacheSize = util.MustRegisterOrGet(reg, m.cacheSize).(prometheus_client.Gauge) } return &m diff --git a/internal/component/loki/rules/kubernetes/rules.go b/internal/component/loki/rules/kubernetes/rules.go index 0643c4234f..9bfd1070b1 100644 --- a/internal/component/loki/rules/kubernetes/rules.go +++ b/internal/component/loki/rules/kubernetes/rules.go @@ -12,6 +12,7 @@ import ( "github.com/grafana/alloy/internal/featuregate" lokiClient "github.com/grafana/alloy/internal/loki/client" "github.com/grafana/alloy/internal/runtime/logging/level" + "github.com/grafana/alloy/internal/util" "github.com/grafana/dskit/backoff" "github.com/grafana/dskit/instrument" promListers "github.com/prometheus-operator/prometheus-operator/pkg/client/listers/monitoring/v1" @@ -82,13 +83,11 @@ type metrics struct { } func (m *metrics) Register(r prometheus.Registerer) error { - r.MustRegister( - m.configUpdatesTotal, - m.eventsTotal, - m.eventsFailed, - m.eventsRetried, - m.lokiClientTiming, - ) + m.configUpdatesTotal = util.MustRegisterOrGet(r, m.configUpdatesTotal).(prometheus.Counter) + m.eventsTotal = util.MustRegisterOrGet(r, m.eventsTotal).(*prometheus.CounterVec) + m.eventsFailed = util.MustRegisterOrGet(r, m.eventsFailed).(*prometheus.CounterVec) + m.eventsRetried = util.MustRegisterOrGet(r, m.eventsRetried).(*prometheus.CounterVec) + m.lokiClientTiming = util.MustRegisterOrGet(r, m.lokiClientTiming).(*prometheus.HistogramVec) return nil } diff --git a/internal/component/loki/source/aws_firehose/internal/metrics.go b/internal/component/loki/source/aws_firehose/internal/metrics.go index 86c570112a..a9701593ef 100644 --- a/internal/component/loki/source/aws_firehose/internal/metrics.go +++ b/internal/component/loki/source/aws_firehose/internal/metrics.go @@ -1,6 +1,7 @@ package internal import ( + "github.com/grafana/alloy/internal/util" "github.com/prometheus/client_golang/prometheus" ) @@ -45,15 +46,11 @@ func NewMetrics(reg prometheus.Registerer) *Metrics { Help: "Number of errors while processing AWS Firehose static labels", }, []string{"reason", "tenant_id"}) - if reg != nil { - reg.MustRegister( - m.errorsAPIRequest, - m.recordsReceived, - m.errorsRecord, - m.batchSize, - m.invalidStaticLabelsCount, - ) - } + m.errorsAPIRequest = util.MustRegisterOrGet(reg, m.errorsAPIRequest).(*prometheus.CounterVec) + m.errorsRecord = util.MustRegisterOrGet(reg, m.errorsRecord).(*prometheus.CounterVec) + m.recordsReceived = util.MustRegisterOrGet(reg, m.recordsReceived).(*prometheus.CounterVec) + m.batchSize = util.MustRegisterOrGet(reg, m.batchSize).(*prometheus.HistogramVec) + m.invalidStaticLabelsCount = util.MustRegisterOrGet(reg, m.invalidStaticLabelsCount).(*prometheus.CounterVec) return &m } diff --git a/internal/component/loki/source/cloudflare/internal/cloudflaretarget/metrics.go b/internal/component/loki/source/cloudflare/internal/cloudflaretarget/metrics.go index f16b3a8b23..0f13f06637 100644 --- a/internal/component/loki/source/cloudflare/internal/cloudflaretarget/metrics.go +++ b/internal/component/loki/source/cloudflare/internal/cloudflaretarget/metrics.go @@ -5,7 +5,10 @@ package cloudflaretarget // read from the Cloudflare Logpull API and forward entries to other loki // components. -import "github.com/prometheus/client_golang/prometheus" +import ( + "github.com/grafana/alloy/internal/util" + "github.com/prometheus/client_golang/prometheus" +) // Metrics holds a set of cloudflare metrics. type Metrics struct { @@ -31,10 +34,8 @@ func NewMetrics(reg prometheus.Registerer) *Metrics { }) if reg != nil { - reg.MustRegister( - m.Entries, - m.LastEnd, - ) + m.Entries = util.MustRegisterOrGet(reg, m.Entries).(prometheus.Counter) + m.LastEnd = util.MustRegisterOrGet(reg, m.LastEnd).(prometheus.Gauge) } return &m diff --git a/internal/component/loki/source/docker/internal/dockertarget/metrics.go b/internal/component/loki/source/docker/internal/dockertarget/metrics.go index cbc6fb9efc..917a83aab0 100644 --- a/internal/component/loki/source/docker/internal/dockertarget/metrics.go +++ b/internal/component/loki/source/docker/internal/dockertarget/metrics.go @@ -4,7 +4,10 @@ package dockertarget // The dockertarget package is used to configure and run the targets that can // read logs from Docker containers and forward them to other loki components. -import "github.com/prometheus/client_golang/prometheus" +import ( + "github.com/grafana/alloy/internal/util" + "github.com/prometheus/client_golang/prometheus" +) // Metrics holds a set of Docker target metrics. type Metrics struct { @@ -30,10 +33,8 @@ func NewMetrics(reg prometheus.Registerer) *Metrics { }) if reg != nil { - reg.MustRegister( - m.dockerEntries, - m.dockerErrors, - ) + m.dockerEntries = util.MustRegisterOrGet(reg, m.dockerEntries).(prometheus.Counter) + m.dockerErrors = util.MustRegisterOrGet(reg, m.dockerErrors).(prometheus.Counter) } return &m diff --git a/internal/component/loki/source/file/metrics.go b/internal/component/loki/source/file/metrics.go index 4f8be70fb7..9f086d80ab 100644 --- a/internal/component/loki/source/file/metrics.go +++ b/internal/component/loki/source/file/metrics.go @@ -4,7 +4,10 @@ package file // The metrics struct provides a common set of metrics that are reused between all // implementations of the reader interface. -import "github.com/prometheus/client_golang/prometheus" +import ( + "github.com/grafana/alloy/internal/util" + "github.com/prometheus/client_golang/prometheus" +) // metrics hold the set of file-based metrics. type metrics struct { @@ -47,13 +50,11 @@ func newMetrics(reg prometheus.Registerer) *metrics { }) if reg != nil { - reg.MustRegister( - m.readBytes, - m.totalBytes, - m.readLines, - m.encodingFailures, - m.filesActive, - ) + m.readBytes = util.MustRegisterOrGet(reg, m.readBytes).(*prometheus.GaugeVec) + m.totalBytes = util.MustRegisterOrGet(reg, m.totalBytes).(*prometheus.GaugeVec) + m.readLines = util.MustRegisterOrGet(reg, m.readLines).(*prometheus.CounterVec) + m.encodingFailures = util.MustRegisterOrGet(reg, m.encodingFailures).(*prometheus.CounterVec) + m.filesActive = util.MustRegisterOrGet(reg, m.filesActive).(prometheus.Gauge) } return &m diff --git a/internal/component/loki/source/gcplog/internal/gcplogtarget/metrics.go b/internal/component/loki/source/gcplog/internal/gcplogtarget/metrics.go index 915ed5fb9b..709ebbb890 100644 --- a/internal/component/loki/source/gcplog/internal/gcplogtarget/metrics.go +++ b/internal/component/loki/source/gcplog/internal/gcplogtarget/metrics.go @@ -5,7 +5,10 @@ package gcplogtarget // logs like bucket logs, load balancer logs, and Kubernetes cluster logs // from GCP. -import "github.com/prometheus/client_golang/prometheus" +import ( + "github.com/grafana/alloy/internal/util" + "github.com/prometheus/client_golang/prometheus" +) // Metrics stores gcplog entry metrics. type Metrics struct { @@ -52,12 +55,10 @@ func NewMetrics(reg prometheus.Registerer) *Metrics { Help: "Number of parsing errors while receiving gcplog messages", }, []string{"reason"}) - reg.MustRegister( - m.gcplogEntries, - m.gcplogErrors, - m.gcplogTargetLastSuccessScrape, - m.gcpPushEntries, - m.gcpPushErrors, - ) + m.gcplogEntries = util.MustRegisterOrGet(reg, m.gcplogEntries).(*prometheus.CounterVec) + m.gcplogErrors = util.MustRegisterOrGet(reg, m.gcplogErrors).(*prometheus.CounterVec) + m.gcplogTargetLastSuccessScrape = util.MustRegisterOrGet(reg, m.gcplogTargetLastSuccessScrape).(*prometheus.GaugeVec) + m.gcpPushEntries = util.MustRegisterOrGet(reg, m.gcpPushEntries).(*prometheus.CounterVec) + m.gcpPushErrors = util.MustRegisterOrGet(reg, m.gcpPushErrors).(*prometheus.CounterVec) return &m } diff --git a/internal/component/loki/source/gelf/internal/target/metrics.go b/internal/component/loki/source/gelf/internal/target/metrics.go index 4bfea06f5e..3b22c8edac 100644 --- a/internal/component/loki/source/gelf/internal/target/metrics.go +++ b/internal/component/loki/source/gelf/internal/target/metrics.go @@ -4,7 +4,10 @@ package target // configure and run the targets that can read gelf entries and forward them // to other loki components. -import "github.com/prometheus/client_golang/prometheus" +import ( + "github.com/grafana/alloy/internal/util" + "github.com/prometheus/client_golang/prometheus" +) // Metrics holds a set of gelf metrics. type Metrics struct { @@ -30,10 +33,8 @@ func NewMetrics(reg prometheus.Registerer) *Metrics { }) if reg != nil { - reg.MustRegister( - m.gelfEntries, - m.gelfErrors, - ) + m.gelfEntries = util.MustRegisterOrGet(reg, m.gelfEntries).(prometheus.Counter) + m.gelfErrors = util.MustRegisterOrGet(reg, m.gelfErrors).(prometheus.Counter) } return &m diff --git a/internal/component/loki/source/heroku/internal/herokutarget/metrics.go b/internal/component/loki/source/heroku/internal/herokutarget/metrics.go index ec145b500a..dca5f682c0 100644 --- a/internal/component/loki/source/heroku/internal/herokutarget/metrics.go +++ b/internal/component/loki/source/heroku/internal/herokutarget/metrics.go @@ -4,7 +4,10 @@ package herokutarget // configure and run the targets that can read heroku entries and forward them // to other loki components. -import "github.com/prometheus/client_golang/prometheus" +import ( + "github.com/grafana/alloy/internal/util" + "github.com/prometheus/client_golang/prometheus" +) type Metrics struct { herokuEntries prometheus.Counter @@ -24,6 +27,7 @@ func NewMetrics(reg prometheus.Registerer) *Metrics { Help: "Number of parsing errors while receiving Heroku messages", }) - reg.MustRegister(m.herokuEntries, m.herokuErrors) + m.herokuEntries = util.MustRegisterOrGet(reg, m.herokuEntries).(prometheus.Counter) + m.herokuErrors = util.MustRegisterOrGet(reg, m.herokuErrors).(prometheus.Counter) return &m } diff --git a/internal/component/loki/source/syslog/internal/syslogtarget/metrics.go b/internal/component/loki/source/syslog/internal/syslogtarget/metrics.go index f198138e7a..e88447c1f7 100644 --- a/internal/component/loki/source/syslog/internal/syslogtarget/metrics.go +++ b/internal/component/loki/source/syslog/internal/syslogtarget/metrics.go @@ -4,7 +4,10 @@ package syslogtarget // configure and run the targets that can read syslog entries and forward them // to other loki components. -import "github.com/prometheus/client_golang/prometheus" +import ( + "github.com/grafana/alloy/internal/util" + "github.com/prometheus/client_golang/prometheus" +) // Metrics holds a set of syslog metrics. type Metrics struct { @@ -35,11 +38,9 @@ func NewMetrics(reg prometheus.Registerer) *Metrics { }) if reg != nil { - reg.MustRegister( - m.syslogEntries, - m.syslogParsingErrors, - m.syslogEmptyMessages, - ) + m.syslogEntries = util.MustRegisterOrGet(reg, m.syslogEntries).(prometheus.Counter) + m.syslogParsingErrors = util.MustRegisterOrGet(reg, m.syslogParsingErrors).(prometheus.Counter) + m.syslogEmptyMessages = util.MustRegisterOrGet(reg, m.syslogEmptyMessages).(prometheus.Counter) } return &m diff --git a/internal/component/otelcol/exporter/loki/internal/convert/metrics.go b/internal/component/otelcol/exporter/loki/internal/convert/metrics.go index 923d402dd8..6e42980768 100644 --- a/internal/component/otelcol/exporter/loki/internal/convert/metrics.go +++ b/internal/component/otelcol/exporter/loki/internal/convert/metrics.go @@ -1,6 +1,7 @@ package convert import ( + "github.com/grafana/alloy/internal/util" "github.com/prometheus/client_golang/prometheus" prometheus_client "github.com/prometheus/client_golang/prometheus" ) @@ -28,11 +29,9 @@ func newMetrics(reg prometheus.Registerer) *metrics { }) if reg != nil { - reg.MustRegister( - m.entriesTotal, - m.entriesFailed, - m.entriesProcessed, - ) + m.entriesTotal = util.MustRegisterOrGet(reg, m.entriesTotal).(prometheus_client.Counter) + m.entriesFailed = util.MustRegisterOrGet(reg, m.entriesFailed).(prometheus_client.Counter) + m.entriesProcessed = util.MustRegisterOrGet(reg, m.entriesProcessed).(prometheus_client.Counter) } return &m diff --git a/internal/component/prometheus/write/queue/e2e_test.go b/internal/component/prometheus/write/queue/e2e_test.go index 71b8516ce7..768a0f285b 100644 --- a/internal/component/prometheus/write/queue/e2e_test.go +++ b/internal/component/prometheus/write/queue/e2e_test.go @@ -1,3 +1,5 @@ +//go:build !windows + package queue import ( diff --git a/internal/component/pyroscope/ebpf/metrics.go b/internal/component/pyroscope/ebpf/metrics.go index 6468c2e04c..6e88cf97a3 100644 --- a/internal/component/pyroscope/ebpf/metrics.go +++ b/internal/component/pyroscope/ebpf/metrics.go @@ -5,6 +5,7 @@ package ebpf import ( + "github.com/grafana/alloy/internal/util" ebpfmetrics "github.com/grafana/pyroscope/ebpf/metrics" "github.com/prometheus/client_golang/prometheus" ) @@ -49,14 +50,12 @@ func newMetrics(reg prometheus.Registerer) *metrics { } if reg != nil { - reg.MustRegister( - m.targetsActive, - m.profilingSessionsTotal, - m.profilingSessionsFailingTotal, - m.pprofsTotal, - m.pprofBytesTotal, - m.pprofSamplesTotal, - ) + m.targetsActive = util.MustRegisterOrGet(reg, m.targetsActive).(prometheus.Gauge) + m.profilingSessionsTotal = util.MustRegisterOrGet(reg, m.profilingSessionsTotal).(prometheus.Counter) + m.profilingSessionsFailingTotal = util.MustRegisterOrGet(reg, m.profilingSessionsFailingTotal).(prometheus.Counter) + m.pprofsTotal = util.MustRegisterOrGet(reg, m.pprofsTotal).(*prometheus.CounterVec) + m.pprofBytesTotal = util.MustRegisterOrGet(reg, m.pprofBytesTotal).(*prometheus.CounterVec) + m.pprofSamplesTotal = util.MustRegisterOrGet(reg, m.pprofSamplesTotal).(*prometheus.CounterVec) } return m diff --git a/internal/component/pyroscope/write/metrics.go b/internal/component/pyroscope/write/metrics.go index b7f50021a4..f6df6ea93f 100644 --- a/internal/component/pyroscope/write/metrics.go +++ b/internal/component/pyroscope/write/metrics.go @@ -1,6 +1,9 @@ package write -import "github.com/prometheus/client_golang/prometheus" +import ( + "github.com/grafana/alloy/internal/util" + "github.com/prometheus/client_golang/prometheus" +) type metrics struct { sentBytes *prometheus.CounterVec @@ -35,13 +38,11 @@ func newMetrics(reg prometheus.Registerer) *metrics { } if reg != nil { - reg.MustRegister( - m.sentBytes, - m.droppedBytes, - m.sentProfiles, - m.droppedProfiles, - m.retries, - ) + m.sentBytes = util.MustRegisterOrGet(reg, m.sentBytes).(*prometheus.CounterVec) + m.droppedBytes = util.MustRegisterOrGet(reg, m.droppedBytes).(*prometheus.CounterVec) + m.sentProfiles = util.MustRegisterOrGet(reg, m.sentProfiles).(*prometheus.CounterVec) + m.droppedProfiles = util.MustRegisterOrGet(reg, m.droppedProfiles).(*prometheus.CounterVec) + m.retries = util.MustRegisterOrGet(reg, m.retries).(*prometheus.CounterVec) } return m diff --git a/internal/component/remote/vault/metrics.go b/internal/component/remote/vault/metrics.go index 91179b502a..046a34fb20 100644 --- a/internal/component/remote/vault/metrics.go +++ b/internal/component/remote/vault/metrics.go @@ -1,6 +1,9 @@ package vault -import "github.com/prometheus/client_golang/prometheus" +import ( + "github.com/grafana/alloy/internal/util" + "github.com/prometheus/client_golang/prometheus" +) type metrics struct { authTotal prometheus.Counter @@ -32,13 +35,11 @@ func newMetrics(r prometheus.Registerer) *metrics { }) if r != nil { - r.MustRegister( - m.authTotal, - m.secretReadTotal, + m.authTotal = util.MustRegisterOrGet(r, m.authTotal).(prometheus.Counter) + m.secretReadTotal = util.MustRegisterOrGet(r, m.secretReadTotal).(prometheus.Counter) - m.authLeaseRenewalTotal, - m.secretLeaseRenewalTotal, - ) + m.authLeaseRenewalTotal = util.MustRegisterOrGet(r, m.authLeaseRenewalTotal).(prometheus.Counter) + m.secretLeaseRenewalTotal = util.MustRegisterOrGet(r, m.secretLeaseRenewalTotal).(prometheus.Counter) } return &m } diff --git a/internal/service/http/http.go b/internal/service/http/http.go index 61425033ec..b20d0442cc 100644 --- a/internal/service/http/http.go +++ b/internal/service/http/http.go @@ -188,6 +188,32 @@ func (s *Service) Run(ctx context.Context, host service.Host) error { otelmux.WithTracerProvider(s.tracer), )) + // The implementation for "/-/healthy" is inspired by + // the "/components" web API endpoint in /internal/web/api/api.go + r.HandleFunc("/-/healthy", func(w http.ResponseWriter, r *http.Request) { + components, err := host.ListComponents("", component.InfoOptions{ + GetHealth: true, + }) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + unhealthyComponents := []string{} + for _, c := range components { + if c.Health.Health == component.HealthTypeUnhealthy { + unhealthyComponents = append(unhealthyComponents, c.ComponentName) + } + } + if len(unhealthyComponents) > 0 { + http.Error(w, "unhealthy components: "+strings.Join(unhealthyComponents, ", "), http.StatusInternalServerError) + return + } + + fmt.Fprintln(w, "All Alloy components are healthy.") + w.WriteHeader(http.StatusOK) + }) + r.Handle( "/metrics", promhttp.HandlerFor(s.gatherer, promhttp.HandlerOpts{}), diff --git a/internal/service/http/http_test.go b/internal/service/http/http_test.go index 2481fcd6cb..52da9adfcd 100644 --- a/internal/service/http/http_test.go +++ b/internal/service/http/http_test.go @@ -3,6 +3,7 @@ package http import ( "context" "fmt" + "io" "net/http" "testing" @@ -43,6 +44,26 @@ func TestHTTP(t *testing.T) { require.NoError(t, err) defer resp.Body.Close() + buf, err := io.ReadAll(resp.Body) + require.Equal(t, "Alloy is ready.\n", string(buf)) + + require.Equal(t, http.StatusOK, resp.StatusCode) + }) + + util.Eventually(t, func(t require.TestingT) { + cli, err := config.NewClientFromConfig(config.HTTPClientConfig{}, "test") + require.NoError(t, err) + + req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s/-/healthy", env.ListenAddr()), nil) + require.NoError(t, err) + + resp, err := cli.Do(req) + require.NoError(t, err) + defer resp.Body.Close() + + buf, err := io.ReadAll(resp.Body) + require.Equal(t, "All Alloy components are healthy.\n", string(buf)) + require.Equal(t, http.StatusOK, resp.StatusCode) }) } @@ -157,9 +178,53 @@ func Test_Toggle_TLS(t *testing.T) { } } +func TestUnhealthy(t *testing.T) { + ctx := componenttest.TestContext(t) + + env, err := newTestEnvironment(t) + require.NoError(t, err) + + env.components = []*component.Info{ + { + ID: component.ID{ + ModuleID: "", + LocalID: "testCompId", + }, + Label: "testCompLabel", + ComponentName: "testCompName", + Health: component.Health{ + Health: component.HealthTypeUnhealthy, + }, + }, + } + require.NoError(t, env.ApplyConfig("")) + + go func() { + require.NoError(t, env.Run(ctx)) + }() + + util.Eventually(t, func(t require.TestingT) { + cli, err := config.NewClientFromConfig(config.HTTPClientConfig{}, "test") + require.NoError(t, err) + + req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s/-/healthy", env.ListenAddr()), nil) + require.NoError(t, err) + + resp, err := cli.Do(req) + require.NoError(t, err) + defer resp.Body.Close() + + buf, err := io.ReadAll(resp.Body) + require.Equal(t, "unhealthy components: testCompName\n", string(buf)) + + require.Equal(t, http.StatusInternalServerError, resp.StatusCode) + }) +} + type testEnvironment struct { - svc *Service - addr string + svc *Service + addr string + components []*component.Info } func newTestEnvironment(t *testing.T) (*testEnvironment, error) { @@ -196,12 +261,16 @@ func (env *testEnvironment) ApplyConfig(config string) error { } func (env *testEnvironment) Run(ctx context.Context) error { - return env.svc.Run(ctx, fakeHost{}) + return env.svc.Run(ctx, fakeHost{ + components: env.components, + }) } func (env *testEnvironment) ListenAddr() string { return env.addr } -type fakeHost struct{} +type fakeHost struct { + components []*component.Info +} var _ service.Host = (fakeHost{}) @@ -209,7 +278,10 @@ func (fakeHost) GetComponent(id component.ID, opts component.InfoOptions) (*comp return nil, fmt.Errorf("no such component %s", id) } -func (fakeHost) ListComponents(moduleID string, opts component.InfoOptions) ([]*component.Info, error) { +func (f fakeHost) ListComponents(moduleID string, opts component.InfoOptions) ([]*component.Info, error) { + if f.components != nil { + return f.components, nil + } if moduleID == "" { return nil, nil } diff --git a/internal/static/metrics/wal/wal.go b/internal/static/metrics/wal/wal.go index 4af3ec9ea0..aa3a4be439 100644 --- a/internal/static/metrics/wal/wal.go +++ b/internal/static/metrics/wal/wal.go @@ -15,6 +15,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/alloy/internal/util" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/prometheus/model/exemplar" "github.com/prometheus/prometheus/model/histogram" @@ -84,15 +85,13 @@ func newStorageMetrics(r prometheus.Registerer) *storageMetrics { }) if r != nil { - r.MustRegister( - m.numActiveSeries, - m.numDeletedSeries, - m.totalOutOfOrderSamples, - m.totalCreatedSeries, - m.totalRemovedSeries, - m.totalAppendedSamples, - m.totalAppendedExemplars, - ) + m.numActiveSeries = util.MustRegisterOrGet(r, m.numActiveSeries).(prometheus.Gauge) + m.numDeletedSeries = util.MustRegisterOrGet(r, m.numDeletedSeries).(prometheus.Gauge) + m.totalOutOfOrderSamples = util.MustRegisterOrGet(r, m.totalOutOfOrderSamples).(prometheus.Counter) + m.totalCreatedSeries = util.MustRegisterOrGet(r, m.totalCreatedSeries).(prometheus.Counter) + m.totalRemovedSeries = util.MustRegisterOrGet(r, m.totalRemovedSeries).(prometheus.Counter) + m.totalAppendedSamples = util.MustRegisterOrGet(r, m.totalAppendedSamples).(prometheus.Counter) + m.totalAppendedExemplars = util.MustRegisterOrGet(r, m.totalAppendedExemplars).(prometheus.Counter) } return &m diff --git a/operations/helm/charts/alloy/CHANGELOG.md b/operations/helm/charts/alloy/CHANGELOG.md index c5469f7dae..ac54929ec3 100644 --- a/operations/helm/charts/alloy/CHANGELOG.md +++ b/operations/helm/charts/alloy/CHANGELOG.md @@ -10,6 +10,10 @@ internal API changes are not present. Unreleased ---------- +### Enhancements + +- Update jimmidyson/configmap-reload to 0.14.0. (@petewall) + 0.10.1 (2024-12-03) ---------- diff --git a/operations/helm/charts/alloy/README.md b/operations/helm/charts/alloy/README.md index 73edd13df8..56ea6a570f 100644 --- a/operations/helm/charts/alloy/README.md +++ b/operations/helm/charts/alloy/README.md @@ -63,8 +63,8 @@ useful if just using the default DaemonSet isn't sufficient. | configReloader.image.digest | string | `""` | SHA256 digest of image to use for config reloading (either in format "sha256:XYZ" or "XYZ"). When set, will override `configReloader.image.tag` | | configReloader.image.registry | string | `"ghcr.io"` | Config reloader image registry (defaults to docker.io) | | configReloader.image.repository | string | `"jimmidyson/configmap-reload"` | Repository to get config reloader image from. | -| configReloader.image.tag | string | `"v0.12.0"` | Tag of image to use for config reloading. | -| configReloader.resources | object | `{}` | Resource requests and limits to apply to the config reloader container. | +| configReloader.image.tag | string | `"v0.14.0"` | Tag of image to use for config reloading. | +| configReloader.resources | object | `{"requests":{"cpu":"1m","memory":"5Mi"}}` | Resource requests and limits to apply to the config reloader container. | | configReloader.securityContext | object | `{}` | Security context to apply to the Grafana configReloader container. | | controller.affinity | object | `{}` | Affinity configuration for pods. | | controller.autoscaling.enabled | bool | `false` | Creates a HorizontalPodAutoscaler for controller type deployment. | diff --git a/operations/helm/charts/alloy/values.yaml b/operations/helm/charts/alloy/values.yaml index 5e73ca14f8..be0dc64421 100644 --- a/operations/helm/charts/alloy/values.yaml +++ b/operations/helm/charts/alloy/values.yaml @@ -165,7 +165,7 @@ configReloader: # -- Repository to get config reloader image from. repository: jimmidyson/configmap-reload # -- Tag of image to use for config reloading. - tag: v0.12.0 + tag: v0.14.0 # -- SHA256 digest of image to use for config reloading (either in format "sha256:XYZ" or "XYZ"). When set, will override `configReloader.image.tag` digest: "" # -- Override the args passed to the container. diff --git a/operations/helm/tests/additional-serviceaccount-label/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/additional-serviceaccount-label/alloy/templates/controllers/daemonset.yaml index fe418568e2..9edb2018cb 100644 --- a/operations/helm/tests/additional-serviceaccount-label/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/additional-serviceaccount-label/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/clustering/alloy/templates/controllers/statefulset.yaml b/operations/helm/tests/clustering/alloy/templates/controllers/statefulset.yaml index e876d625db..1cf6f588b4 100644 --- a/operations/helm/tests/clustering/alloy/templates/controllers/statefulset.yaml +++ b/operations/helm/tests/clustering/alloy/templates/controllers/statefulset.yaml @@ -62,7 +62,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/controller-deployment-pdb-max-unavailable/alloy/templates/controllers/deployment.yaml b/operations/helm/tests/controller-deployment-pdb-max-unavailable/alloy/templates/controllers/deployment.yaml index d252ab59ea..f08659e03b 100644 --- a/operations/helm/tests/controller-deployment-pdb-max-unavailable/alloy/templates/controllers/deployment.yaml +++ b/operations/helm/tests/controller-deployment-pdb-max-unavailable/alloy/templates/controllers/deployment.yaml @@ -58,7 +58,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/controller-deployment-pdb-min-available/alloy/templates/controllers/deployment.yaml b/operations/helm/tests/controller-deployment-pdb-min-available/alloy/templates/controllers/deployment.yaml index d252ab59ea..f08659e03b 100644 --- a/operations/helm/tests/controller-deployment-pdb-min-available/alloy/templates/controllers/deployment.yaml +++ b/operations/helm/tests/controller-deployment-pdb-min-available/alloy/templates/controllers/deployment.yaml @@ -58,7 +58,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/controller-statefulset-pdb-max-unavailable/alloy/templates/controllers/statefulset.yaml b/operations/helm/tests/controller-statefulset-pdb-max-unavailable/alloy/templates/controllers/statefulset.yaml index 3425c16ff1..fce5cdb4f6 100644 --- a/operations/helm/tests/controller-statefulset-pdb-max-unavailable/alloy/templates/controllers/statefulset.yaml +++ b/operations/helm/tests/controller-statefulset-pdb-max-unavailable/alloy/templates/controllers/statefulset.yaml @@ -60,7 +60,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/controller-statefulset-pdb-min-available/alloy/templates/controllers/statefulset.yaml b/operations/helm/tests/controller-statefulset-pdb-min-available/alloy/templates/controllers/statefulset.yaml index 3425c16ff1..fce5cdb4f6 100644 --- a/operations/helm/tests/controller-statefulset-pdb-min-available/alloy/templates/controllers/statefulset.yaml +++ b/operations/helm/tests/controller-statefulset-pdb-min-available/alloy/templates/controllers/statefulset.yaml @@ -60,7 +60,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/controller-volumes-extra/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/controller-volumes-extra/alloy/templates/controllers/daemonset.yaml index 317ee6eeb1..f07b99d6f9 100644 --- a/operations/helm/tests/controller-volumes-extra/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/controller-volumes-extra/alloy/templates/controllers/daemonset.yaml @@ -60,7 +60,7 @@ spec: mountPath: /cache name: cache-volume - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/create-daemonset-hostnetwork/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/create-daemonset-hostnetwork/alloy/templates/controllers/daemonset.yaml index 4e4d71b57f..43c3586999 100644 --- a/operations/helm/tests/create-daemonset-hostnetwork/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/create-daemonset-hostnetwork/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/create-daemonset/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/create-daemonset/alloy/templates/controllers/daemonset.yaml index fe418568e2..9edb2018cb 100644 --- a/operations/helm/tests/create-daemonset/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/create-daemonset/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/create-deployment-autoscaling/alloy/templates/controllers/deployment.yaml b/operations/helm/tests/create-deployment-autoscaling/alloy/templates/controllers/deployment.yaml index 14e8720f0d..a7ca81dd5e 100644 --- a/operations/helm/tests/create-deployment-autoscaling/alloy/templates/controllers/deployment.yaml +++ b/operations/helm/tests/create-deployment-autoscaling/alloy/templates/controllers/deployment.yaml @@ -60,7 +60,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/create-deployment/alloy/templates/controllers/deployment.yaml b/operations/helm/tests/create-deployment/alloy/templates/controllers/deployment.yaml index d252ab59ea..f08659e03b 100644 --- a/operations/helm/tests/create-deployment/alloy/templates/controllers/deployment.yaml +++ b/operations/helm/tests/create-deployment/alloy/templates/controllers/deployment.yaml @@ -58,7 +58,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/create-statefulset-autoscaling/alloy/templates/controllers/statefulset.yaml b/operations/helm/tests/create-statefulset-autoscaling/alloy/templates/controllers/statefulset.yaml index 0955b9cd02..9b4d3f255e 100644 --- a/operations/helm/tests/create-statefulset-autoscaling/alloy/templates/controllers/statefulset.yaml +++ b/operations/helm/tests/create-statefulset-autoscaling/alloy/templates/controllers/statefulset.yaml @@ -62,7 +62,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/create-statefulset/alloy/templates/controllers/statefulset.yaml b/operations/helm/tests/create-statefulset/alloy/templates/controllers/statefulset.yaml index 3425c16ff1..fce5cdb4f6 100644 --- a/operations/helm/tests/create-statefulset/alloy/templates/controllers/statefulset.yaml +++ b/operations/helm/tests/create-statefulset/alloy/templates/controllers/statefulset.yaml @@ -60,7 +60,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/custom-config/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/custom-config/alloy/templates/controllers/daemonset.yaml index fe418568e2..9edb2018cb 100644 --- a/operations/helm/tests/custom-config/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/custom-config/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/default-values/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/default-values/alloy/templates/controllers/daemonset.yaml index fe418568e2..9edb2018cb 100644 --- a/operations/helm/tests/default-values/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/default-values/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/enable-servicemonitor-tls/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/enable-servicemonitor-tls/alloy/templates/controllers/daemonset.yaml index 97ffd92ead..ee44315add 100644 --- a/operations/helm/tests/enable-servicemonitor-tls/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/enable-servicemonitor-tls/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/enable-servicemonitor/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/enable-servicemonitor/alloy/templates/controllers/daemonset.yaml index fe418568e2..9edb2018cb 100644 --- a/operations/helm/tests/enable-servicemonitor/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/enable-servicemonitor/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/envFrom/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/envFrom/alloy/templates/controllers/daemonset.yaml index a6352bf906..9f2b0cd4bc 100644 --- a/operations/helm/tests/envFrom/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/envFrom/alloy/templates/controllers/daemonset.yaml @@ -60,7 +60,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/existing-config/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/existing-config/alloy/templates/controllers/daemonset.yaml index 82412fff24..3a25f35de7 100644 --- a/operations/helm/tests/existing-config/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/existing-config/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/extra-env/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/extra-env/alloy/templates/controllers/daemonset.yaml index 2a4c2909c1..686668cfdd 100644 --- a/operations/helm/tests/extra-env/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/extra-env/alloy/templates/controllers/daemonset.yaml @@ -66,7 +66,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/extra-ports/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/extra-ports/alloy/templates/controllers/daemonset.yaml index fc3a50179c..42759635ff 100644 --- a/operations/helm/tests/extra-ports/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/extra-ports/alloy/templates/controllers/daemonset.yaml @@ -60,7 +60,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/faro-ingress/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/faro-ingress/alloy/templates/controllers/daemonset.yaml index feb1a55a94..768b931bdd 100644 --- a/operations/helm/tests/faro-ingress/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/faro-ingress/alloy/templates/controllers/daemonset.yaml @@ -60,7 +60,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/global-image-pullsecrets/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/global-image-pullsecrets/alloy/templates/controllers/daemonset.yaml index caa4d1cce8..a5a9e85a89 100644 --- a/operations/helm/tests/global-image-pullsecrets/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/global-image-pullsecrets/alloy/templates/controllers/daemonset.yaml @@ -62,7 +62,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/global-image-registry/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/global-image-registry/alloy/templates/controllers/daemonset.yaml index fa5fb35e73..2c8a7c8b12 100644 --- a/operations/helm/tests/global-image-registry/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/global-image-registry/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: quay.io/jimmidyson/configmap-reload:v0.12.0 + image: quay.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/host-alias/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/host-alias/alloy/templates/controllers/daemonset.yaml index 4d59a4159c..261cf92446 100644 --- a/operations/helm/tests/host-alias/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/host-alias/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/initcontainers/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/initcontainers/alloy/templates/controllers/daemonset.yaml index 96c04777c0..3da5aec3e0 100644 --- a/operations/helm/tests/initcontainers/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/initcontainers/alloy/templates/controllers/daemonset.yaml @@ -78,7 +78,7 @@ spec: mountPath: /etc/geoip name: geoip - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/lifecycle-hooks/alloy/templates/controllers/deployment.yaml b/operations/helm/tests/lifecycle-hooks/alloy/templates/controllers/deployment.yaml index c563cd6297..91a116329a 100644 --- a/operations/helm/tests/lifecycle-hooks/alloy/templates/controllers/deployment.yaml +++ b/operations/helm/tests/lifecycle-hooks/alloy/templates/controllers/deployment.yaml @@ -65,7 +65,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/local-image-pullsecrets/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/local-image-pullsecrets/alloy/templates/controllers/daemonset.yaml index b51fc14b99..713b442298 100644 --- a/operations/helm/tests/local-image-pullsecrets/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/local-image-pullsecrets/alloy/templates/controllers/daemonset.yaml @@ -59,7 +59,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/local-image-registry/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/local-image-registry/alloy/templates/controllers/daemonset.yaml index fa5fb35e73..2c8a7c8b12 100644 --- a/operations/helm/tests/local-image-registry/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/local-image-registry/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: quay.io/jimmidyson/configmap-reload:v0.12.0 + image: quay.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/nodeselectors-and-tolerations/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/nodeselectors-and-tolerations/alloy/templates/controllers/daemonset.yaml index 44bf7b345d..dcd8a8e839 100644 --- a/operations/helm/tests/nodeselectors-and-tolerations/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/nodeselectors-and-tolerations/alloy/templates/controllers/daemonset.yaml @@ -57,7 +57,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/nonroot/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/nonroot/alloy/templates/controllers/daemonset.yaml index 00c40ea2fc..452a97a086 100644 --- a/operations/helm/tests/nonroot/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/nonroot/alloy/templates/controllers/daemonset.yaml @@ -62,7 +62,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/pod_annotations/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/pod_annotations/alloy/templates/controllers/daemonset.yaml index fb4e8d4797..f45d1aed6f 100644 --- a/operations/helm/tests/pod_annotations/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/pod_annotations/alloy/templates/controllers/daemonset.yaml @@ -58,7 +58,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/sidecars/alloy/templates/controllers/daemonset.yaml b/operations/helm/tests/sidecars/alloy/templates/controllers/daemonset.yaml index 49d1d739d5..42e5e4b346 100644 --- a/operations/helm/tests/sidecars/alloy/templates/controllers/daemonset.yaml +++ b/operations/helm/tests/sidecars/alloy/templates/controllers/daemonset.yaml @@ -60,7 +60,7 @@ spec: mountPath: /etc/geoip name: geoip - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/termination-grace-period/alloy/templates/controllers/deployment.yaml b/operations/helm/tests/termination-grace-period/alloy/templates/controllers/deployment.yaml index f6813aef02..b856357f6a 100644 --- a/operations/helm/tests/termination-grace-period/alloy/templates/controllers/deployment.yaml +++ b/operations/helm/tests/termination-grace-period/alloy/templates/controllers/deployment.yaml @@ -58,7 +58,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload diff --git a/operations/helm/tests/topologyspreadconstraints/alloy/templates/controllers/deployment.yaml b/operations/helm/tests/topologyspreadconstraints/alloy/templates/controllers/deployment.yaml index c5fe04159a..e2441b56a4 100644 --- a/operations/helm/tests/topologyspreadconstraints/alloy/templates/controllers/deployment.yaml +++ b/operations/helm/tests/topologyspreadconstraints/alloy/templates/controllers/deployment.yaml @@ -58,7 +58,7 @@ spec: - name: config mountPath: /etc/alloy - name: config-reloader - image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 + image: ghcr.io/jimmidyson/configmap-reload:v0.14.0 args: - --volume-dir=/etc/alloy - --webhook-url=http://localhost:12345/-/reload