Skip to content

Commit

Permalink
[release/v1.4] Prepare for 1.4.2 - cherry pick changes and update VER…
Browse files Browse the repository at this point in the history
…SION file (#1828)

* chore: bump yet-another-cloudwatch-exporter to v0.61.0 (#1690)

* chore: bump yet-another-cloudwatch-exporter to v0.61.0

This bumps yet-another-cloudwatch-exporter to v0.61.0, which fixes [an issue with S3 metrics being reported as `NaN`](prometheus-community/yet-another-cloudwatch-exporter#728).

Affected metrics have a value of `0` in the scraped prometheus metrics. With the update to v0.61.0, they are reported correctly.

* fixup! chore: bump yet-another-cloudwatch-exporter to v0.61.0

JobLevelMetricFields has been removed with prometheus-community/yet-another-cloudwatch-exporter#1412

* fixup! chore: bump yet-another-cloudwatch-exporter to v0.61.0

* Update windows_exporter to v0.27.3 (#1785)

* Update windows_exporter to v0.27.3

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>

* Update windows_exporter to v0.27.3

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>

---------

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>

* build(deps): bump webpack from 5.82.1 to 5.94.0 in /internal/web/ui (#1594)

Bumps [webpack](https://github.com/webpack/webpack) from 5.82.1 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.82.1...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump rollup from 2.79.1 to 2.79.2 in /internal/web/ui (#1775)

Bumps [rollup](https://github.com/rollup/rollup) from 2.79.1 to 2.79.2.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](rollup/rollup@v2.79.1...v2.79.2)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 1687 otelcol.exporter.awss3 config fixes (#1791)

* Address loki.process config reloads (#1809)

* Fix logs cluster (#1716)

* fix clustering for logs

* Simplify code.

* Add changelog.

* Reorder changelog

* Update VERSION

---------

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: morre <mmeyer@anaconda.com>
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: cydergoth <cydergoth@gmail.com>
Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com>
Co-authored-by: mattdurham <mattdurham@ppog.org>
  • Loading branch information
7 people authored Oct 4, 2024
1 parent 5252bd7 commit f59e491
Show file tree
Hide file tree
Showing 38 changed files with 676 additions and 416 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ 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.

v1.4.2
-----------------

### Bugfixes

- Update windows_exporter from v0.27.2 vo v0.27.3: (@jkroepke)
- Fixes a bug where scraping Windows service crashes alloy

- Update yet-another-cloudwatch-exporter from v0.60.0 vo v0.61.0: (@morremeyer)
- Fixes a bug where cloudwatch S3 metrics are reported as `0`

- Issue 1687 - otelcol.exporter.awss3 fails to configure (@cydergoth)
- Fix parsing of the Level configuration attribute in debug_metrics config block
- Ensure "optional" debug_metrics config block really is optional

- Fixed an issue with `loki.process` where `stage.luhn` and `stage.timestamp` would not apply
default configuration settings correctly (@thampiotr)

- Fixed an issue with `loki.process` where configuration could be reloaded even if there
were no changes. (@ptodev, @thampiotr)

- Fix issue where `loki.source.kubernetes` took into account all labels, instead of specific logs labels. Resulting in duplication. (@mattdurham)

v1.4.1
-----------------

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
#
# Lines starting with "#" and blank lines are ignored.

v1.4.1
v1.4.2
2 changes: 1 addition & 1 deletion docs/sources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Grafana Alloy
description: Grafana Alloy is a a vendor-neutral distribution of the OTel Collector
weight: 350
cascade:
ALLOY_RELEASE: v1.4.1
ALLOY_RELEASE: v1.4.2
OTEL_VERSION: v0.105.0
FULL_PRODUCT_NAME: Grafana Alloy
PRODUCT_NAME: Alloy
Expand Down
14 changes: 14 additions & 0 deletions docs/sources/reference/components/loki/loki.source.kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ If {{< param "PRODUCT_NAME" >}} is _not_ running in clustered mode, then the blo
`loki.source.kubernetes` collects logs from every target it receives in its
arguments.

Clustering only looks at the following labels for determining the shard key:
* `__pod_namespace__`
* `__pod_name__`
* `__pod_container_name__`
* `__pod_uid__`
* `__meta_kubernetes_namespace`
* `__meta_kubernetes_pod_name`
* `__meta_kubernetes_pod_container_name`
* `__meta_kubernetes_pod_uid`
* `container`
* `pod`
* `job`
* `namespace`

[using clustering]: ../../../../get-started/clustering/

## Exported fields
Expand Down
27 changes: 14 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ require (
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
github.com/natefinch/atomic v1.0.1
github.com/ncabatoff/process-exporter v0.7.10
github.com/nerdswords/yet-another-cloudwatch-exporter v0.60.0
github.com/nerdswords/yet-another-cloudwatch-exporter v0.61.0
github.com/oklog/run v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/oliver006/redis_exporter v1.54.0
Expand Down Expand Up @@ -149,7 +149,7 @@ require (
github.com/prometheus-community/elasticsearch_exporter v1.5.0
github.com/prometheus-community/postgres_exporter v0.11.1
github.com/prometheus-community/stackdriver_exporter v0.15.1
github.com/prometheus-community/windows_exporter v0.27.2
github.com/prometheus-community/windows_exporter v0.27.3
github.com/prometheus-operator/prometheus-operator v0.66.0
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0
github.com/prometheus-operator/prometheus-operator/pkg/client v0.66.0
Expand Down Expand Up @@ -298,7 +298,7 @@ require (
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/BurntSushi/toml v1.3.2
github.com/ClickHouse/clickhouse-go v1.5.4 // indirect
github.com/Code-Hex/go-generics-cache v1.5.1 // indirect
github.com/DataDog/agent-payload/v5 v5.0.131 // indirect
Expand Down Expand Up @@ -398,23 +398,23 @@ require (
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.0 // indirect
github.com/aws/aws-sdk-go-v2/service/amp v1.25.5 // indirect
github.com/aws/aws-sdk-go-v2/service/apigateway v1.23.7 // indirect
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.20.5 // indirect
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.40.6 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.38.1 // indirect
github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.38.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ec2 v1.161.1 // indirect
github.com/aws/aws-sdk-go-v2/service/amp v1.26.1 // indirect
github.com/aws/aws-sdk-go-v2/service/apigateway v1.24.1 // indirect
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.21.1 // indirect
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.41.1 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.39.1 // indirect
github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.39.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ec2 v1.165.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.0 // indirect
github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.5 // indirect
github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.22.1 // indirect
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.27.0 // indirect
github.com/aws/aws-sdk-go-v2/service/shield v1.25.5 // indirect
github.com/aws/aws-sdk-go-v2/service/shield v1.26.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.22.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5 // indirect
github.com/aws/aws-sdk-go-v2/service/storagegateway v1.27.5 // indirect
github.com/aws/aws-sdk-go-v2/service/storagegateway v1.30.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.4 // indirect
github.com/aws/smithy-go v1.20.4 // indirect
github.com/axiomhq/hyperloglog v0.0.0-20240124082744-24bca3a5b39b // indirect
Expand Down Expand Up @@ -813,6 +813,7 @@ require (
)

require (
github.com/aws/aws-sdk-go-v2/service/iam v1.33.1 // indirect
github.com/checkpoint-restore/go-criu/v6 v6.3.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
)
Expand Down
50 changes: 26 additions & 24 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -503,21 +503,23 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvK
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.0 h1:TkbRExyKSVHELwG9gz2+gql37jjec2R5vus9faTomwE=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.0/go.mod h1:T3/9xMKudHhnj8it5EqIrhvv11tVZqWYkKcot+BFStc=
github.com/aws/aws-sdk-go-v2/service/amp v1.25.5 h1:OV/xhdkvG4rY7lcEBPS9pPbT83ezxXE+gM9nVA1OHWU=
github.com/aws/aws-sdk-go-v2/service/amp v1.25.5/go.mod h1:i5BA2ACkXa8Pzqinz/xEukdVJnMdfQLRcx7ftb5g0pk=
github.com/aws/aws-sdk-go-v2/service/apigateway v1.23.7 h1:VOV21NHMzI0OgywTq2iY9UnXIpH4j4s3pa4ensk8Hh8=
github.com/aws/aws-sdk-go-v2/service/apigateway v1.23.7/go.mod h1:3h9BDpayKgNNrpHZBvL7gCIeikqiE7oBxGGcrzmtLAM=
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.20.5 h1:nk9qRsqcLik5FycE6+y16Xj46oCnoMc0Gp8Q2RHOCpg=
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.20.5/go.mod h1:PkfhkgYj7XKPO/kGyF7s4DC5ZVrxfHoWDD+rrxobLMg=
github.com/aws/aws-sdk-go-v2/service/amp v1.26.1 h1:svGkgUKZDc5SNSiP6BgcOe/6sPmwBniltU6uHmxrjqo=
github.com/aws/aws-sdk-go-v2/service/amp v1.26.1/go.mod h1:mBtHxQRTrzQB0G5oap7IcgP9Ny5p9BJSGhWnuQ+35EY=
github.com/aws/aws-sdk-go-v2/service/apigateway v1.24.1 h1:20jy3+l7bQA6tJ1nJxg8+l+1Xm9KrDslNVvc8HvLoEI=
github.com/aws/aws-sdk-go-v2/service/apigateway v1.24.1/go.mod h1:gcUX4UmbhON3+0ij28aojD7vaMPqsRYFefqwxCLbUnw=
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.21.1 h1:qbbxz47vQdGzvLeHS8xmvp3shV0n8cAnmred+Ehj6qQ=
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.21.1/go.mod h1:3tgssMs7RA6rZoI6K9w6Nc6gCmhadTFAOU+OXh4tPkQ=
github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZkFdvf98LHW21k49W8o8J366lqVKY=
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.40.6 h1:IDoEdCkKRy7iPlRVSuDATGE57xUjrk5i1M9eWPYwr/Y=
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.40.6/go.mod h1:ZErgk/bPaaZIpj+lUWGlwI1A0UFhSIscgnCPzTLnb2s=
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.38.1 h1:Lrq1Tuj+tA569WQzuESkm/rUfhIQMmNoZW6rRuZVHVI=
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.38.1/go.mod h1:U12sr6Lt14X96f16t+rR52+2BdqtydwN7DjEEHRMjO0=
github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.38.5 h1:V97n9sqRIMhQP4GuB3xOBOTsg/41uLo3jyewvHSjxwE=
github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.38.5/go.mod h1:hTZS15Gghi40UxU03Cv09Qr2tXgoQrZOSGY6oaNUNAg=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.161.1 h1:NbjXshriDs5bGeqKvrOF70L41X0aCMC60ImN2vkcQAc=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.161.1/go.mod h1:xejKuuRDjz6z5OqyeLsz01MlOqqW7CqpAB4PabNvpu8=
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.41.1 h1:ZNokD9M3On22Qscssyi3iQAzkoeOJxnE5NANNCzPzIA=
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.41.1/go.mod h1:5XY8CFGBv6dZp/thbk8FRIAWjqNckM7PsL848KHdzjI=
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.39.1 h1:U2qFeD0atfYsNMX7pVPvTG+vI7jCoelcWomOK7F8b34=
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.39.1/go.mod h1:6cstKfQIguQDuWrHKYhjod025+J7n0AR+azv5t9HYBY=
github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.39.1 h1:4NU35PwZufWYLQV1JD43Z2ZGmTSv35250dNYEgrZaRs=
github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.39.1/go.mod h1:vKjaBNIcIPOlhBc4+lei/hFnPl7GNDCnkSnGFuKQ0Xg=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.165.1 h1:LkSnU1c9JKJyXYcwpWgQGuwctwv3pDenMUgH2CmLd1A=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.165.1/go.mod h1:Wv7N3iFOKVsZNIaw9MOBUmwCkX6VMmQQRFhMrHtNGno=
github.com/aws/aws-sdk-go-v2/service/iam v1.33.1 h1:0dcMo3330L9LIckl+4iujMoq0AdR8LMK0TtgrjHUi6M=
github.com/aws/aws-sdk-go-v2/service/iam v1.33.1/go.mod h1:sX/naR5tYtlGFN0Bjg9VPNgYNg/rqiDUuKTW9peFnZk=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 h1:KypMCbLPPHEmf9DgMGw51jMj77VfGPAN2Kv4cfhlfgI=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4/go.mod h1:Vz1JQXliGcQktFTN/LN6uGppAIRoLBR2bMvIMP0gOjc=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.0 h1:UiSyK6ent6OKpkMJN3+k5HZ4sk4UfchEaaW5wv7SblQ=
Expand All @@ -527,23 +529,23 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18 h1:tJ5RnkHC
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.18/go.mod h1:++NHzT+nAF7ZPrHPsA+ENvsXkOO8wEu+C6RXltAG4/c=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.0 h1:l5puwOHr7IxECuPMIuZG7UKOzAnF24v6t4l+Z5Moay4=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.0/go.mod h1:Oov79flWa/n7Ni+lQC3z+VM7PoRM47omRqbJU9B5Y7E=
github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.5 h1:GR0vFRc5TpN36ppQJjd+gjRRC9vMAHN5C2W53oMWCJU=
github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.5/go.mod h1:FWw+Jnx+SlpsrU/NQ/f7f+1RdixTApZiU2o9FOubiDQ=
github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.22.1 h1:73im9DnuBD4+G8hHsbqb0NSA+n6QJ5ApFk6/YeOz8k8=
github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.22.1/go.mod h1:p5FuKT8Rj4fnlT84Pzy7itV11NZ39Fwm/Y52S8Lg1Oc=
github.com/aws/aws-sdk-go-v2/service/s3 v1.49.0 h1:VfU15izXQjz4m9y1DkbY79iylIiuPwWtrram4cSpWEI=
github.com/aws/aws-sdk-go-v2/service/s3 v1.49.0/go.mod h1:1o/W6JFUuREj2ExoQ21vHJgO7wakvjhol91M9eknFgs=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.27.0 h1:64jRTsqBcIqlA4N7ZFYy+ysGPE7Rz/nJgU2fwv2cymk=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.27.0/go.mod h1:JsJDZFHwLGZu6dxhV9EV1gJrMnCeE4GEXubSZA59xdA=
github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.31.4 h1:YEY+Y4Lf3TuFrw8keb8NZ5nsbo/YplxEgZWbqnDlq+Y=
github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.31.4/go.mod h1:5autx6GwAtQVv8S/qTwBKfxzAAwe8hOlzVuTtLdliVw=
github.com/aws/aws-sdk-go-v2/service/shield v1.25.5 h1:4fTqvsBpHhPA9ngalsvdLPRir22WQNhFDFmeGSKchQQ=
github.com/aws/aws-sdk-go-v2/service/shield v1.25.5/go.mod h1:KizNr+ORjXFVELwvx3ubt49LMeTeBXm9EbhUcDXvHa8=
github.com/aws/aws-sdk-go-v2/service/shield v1.26.1 h1:vlqoPRFrhs/djRKnrPNJvzzVLIsMWITGgP4gHIzprSU=
github.com/aws/aws-sdk-go-v2/service/shield v1.26.1/go.mod h1:1aUTOI7FTFp3ng7NH3C0UqDkbofoLb7NLcd/ufvlHdY=
github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk=
github.com/aws/aws-sdk-go-v2/service/sso v1.22.5 h1:zCsFCKvbj25i7p1u94imVoO447I/sFv8qq+lGJhRN0c=
github.com/aws/aws-sdk-go-v2/service/sso v1.22.5/go.mod h1:ZeDX1SnKsVlejeuz41GiajjZpRSWR7/42q/EyA/QEiM=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5 h1:SKvPgvdvmiTWoi0GAJ7AsJfOz3ngVkD/ERbs5pUnHNI=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.5/go.mod h1:20sz31hv/WsPa3HhU3hfrIet2kxM4Pe0r20eBZ20Tac=
github.com/aws/aws-sdk-go-v2/service/storagegateway v1.27.5 h1:5t0w6FzW65K9nX+7YEKPLvsuOSOMl9HkJ01rG5VXsmQ=
github.com/aws/aws-sdk-go-v2/service/storagegateway v1.27.5/go.mod h1:gCrKxQ0omX8dIo7jQbXW5typwg8Z4rdVXYndHVoJ4XM=
github.com/aws/aws-sdk-go-v2/service/storagegateway v1.30.1 h1:/teUr5AA4/AUaw8A1wF6wcki4oc//lxonloUq1bl1VU=
github.com/aws/aws-sdk-go-v2/service/storagegateway v1.30.1/go.mod h1:LigoGatDhnWionzCxyHIQ96cQhwmLgTEkQDOzZg1Q3E=
github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g=
github.com/aws/aws-sdk-go-v2/service/sts v1.30.4 h1:iAckBT2OeEK/kBDyN/jDtpEExhjeeA/Im2q4X0rJZT8=
github.com/aws/aws-sdk-go-v2/service/sts v1.30.4/go.mod h1:vmSqFK+BVIwVpDAGZB3CoCXHzurt4qBE8lf+I/kRTh0=
Expand Down Expand Up @@ -1849,8 +1851,8 @@ github.com/ncabatoff/go-seq v0.0.0-20180805175032-b08ef85ed833 h1:t4WWQ9I797y7QU
github.com/ncabatoff/go-seq v0.0.0-20180805175032-b08ef85ed833/go.mod h1:0CznHmXSjMEqs5Tezj/w2emQoM41wzYM9KpDKUHPYag=
github.com/ncabatoff/process-exporter v0.7.10 h1:+Ere7+3se6QqP54gg7aBRagWcL8bq3u5zNi/GRSWeKQ=
github.com/ncabatoff/process-exporter v0.7.10/go.mod h1:DHZRZjqxw9LCOpLlX0DjBuyn6d5plh41Jv6Tmttj7Ek=
github.com/nerdswords/yet-another-cloudwatch-exporter v0.60.0 h1:+027WNpx6sqn1kuhl4fPPz65TaF7kzG9ymAOJlasZjg=
github.com/nerdswords/yet-another-cloudwatch-exporter v0.60.0/go.mod h1:EXA9yqANHYmkbpe9a41X7iFJbK8/WNhp+Ph/+5DvZo4=
github.com/nerdswords/yet-another-cloudwatch-exporter v0.61.0 h1:aZIz1Dh+dXoesIvv56uReOpvDE21RvRgADhyTgEdNXw=
github.com/nerdswords/yet-another-cloudwatch-exporter v0.61.0/go.mod h1:n/wLEzpw3i44nWQ5UydQBEvPMxeKd2kYqfGt1GFcuKk=
github.com/newrelic/newrelic-telemetry-sdk-go v0.2.0/go.mod h1:G9MqE/cHGv3Hx3qpYhfuyFUsGx2DpVcGi1iJIqTg+JQ=
github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2 h1:BQ1HW7hr4IVovMwWg0E0PYcyW8CzqDcVmaew9cujU4s=
github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2/go.mod h1:TLb2Sg7HQcgGdloNxkrmtgDNR9uVYF3lfdFIN4Ro6Sk=
Expand Down Expand Up @@ -2122,8 +2124,8 @@ github.com/prometheus-community/prom-label-proxy v0.6.0 h1:vRY29tUex8qI2MEimovTz
github.com/prometheus-community/prom-label-proxy v0.6.0/go.mod h1:XyAyskjjhqEx0qnbGUVeAkYSz3Wm9gStT7/wXFxD8n0=
github.com/prometheus-community/stackdriver_exporter v0.15.1 h1:+k26zeBy8BlG+eDKPtYA7IKXrQCI7ISLfktjIUu7wBQ=
github.com/prometheus-community/stackdriver_exporter v0.15.1/go.mod h1:UmmIgnrVQqDAeM8pSeYntBcUxPhp8oqb8W3nvRYzsSg=
github.com/prometheus-community/windows_exporter v0.27.2 h1:/tdRTouPMVsC4qt8+s9NOPEm7L/9qdDxmasiETlx+Wk=
github.com/prometheus-community/windows_exporter v0.27.2/go.mod h1:8+T6hfv71nvgVIzguouXkIGoa15ni+uXHHULBOA2bZo=
github.com/prometheus-community/windows_exporter v0.27.3 h1:L5Dc4gqc3477Y6jaVHhkm25jysqbxg1ajMyPbmnqScw=
github.com/prometheus-community/windows_exporter v0.27.3/go.mod h1:8+T6hfv71nvgVIzguouXkIGoa15ni+uXHHULBOA2bZo=
github.com/prometheus-operator/prometheus-operator v0.66.0 h1:Jj4mbGAkfBbTih6ait03f2vUjEHB7Kb4gnlAmWu7AJ0=
github.com/prometheus-operator/prometheus-operator v0.66.0/go.mod h1:U7S3+u6YTxwCTMNIQxZWttEq70qBA4Qps7/c5mUZOpQ=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0 h1:PPW01FLVjJHMNcbAL1DDD9EZceSQKMOU/VpK0irrxrI=
Expand Down
12 changes: 12 additions & 0 deletions internal/component/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package discovery

import (
"context"
"slices"
"sort"
"strings"
"sync"
Expand Down Expand Up @@ -41,6 +42,17 @@ func (t Target) NonMetaLabels() labels.Labels {
return lset
}

func (t Target) SpecificLabels(lbls []string) labels.Labels {
var lset labels.Labels
for k, v := range t {
if slices.Contains(lbls, k) {
lset = append(lset, labels.Label{Name: k, Value: v})
}
}
sort.Sort(lset)
return lset
}

// Exports holds values which are exported by all discovery components.
type Exports struct {
Targets []Target `alloy:"targets,attr"`
Expand Down
29 changes: 28 additions & 1 deletion internal/component/discovery/distributed_targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ type DistributedTargets struct {
// NewDistributedTargets creates the abstraction that allows components to
// dynamically shard targets between components.
func NewDistributedTargets(clusteringEnabled bool, cluster cluster.Cluster, allTargets []Target) *DistributedTargets {
return NewDistributedTargetsWithCustomLabels(clusteringEnabled, cluster, allTargets, nil)
}

// NewDistributedTargetsWithCustomLabels creates the abstraction that allows components to
// dynamically shard targets between components. Passing in labels will limit the sharding to only use those labels for computing the hash key.
// Passing in nil or empty array means look at all labels.
func NewDistributedTargetsWithCustomLabels(clusteringEnabled bool, cluster cluster.Cluster, allTargets []Target, labels []string) *DistributedTargets {
if !clusteringEnabled || cluster == nil {
cluster = disabledCluster{}
}
Expand All @@ -32,8 +39,20 @@ func NewDistributedTargets(clusteringEnabled bool, cluster cluster.Cluster, allT
localTargetKeys := make([]shard.Key, 0, localCap)
remoteTargetKeys := make(map[shard.Key]struct{}, len(allTargets)-localCap)

// Need to handle duplicate entries.
singlular := make(map[shard.Key]struct{})
for _, tgt := range allTargets {
targetKey := keyFor(tgt)
var targetKey shard.Key
// If we have no custom labels check all non-meta labels.
if len(labels) == 0 {
targetKey = keyFor(tgt)
} else {
targetKey = keyForLabels(tgt, labels)
}
if _, ok := singlular[targetKey]; ok {
continue
}
singlular[targetKey] = struct{}{}
peers, err := cluster.Lookup(targetKey, 1, shard.OpReadWrite)
belongsToLocal := err != nil || len(peers) == 0 || peers[0].Self

Expand All @@ -57,6 +76,10 @@ func (dt *DistributedTargets) LocalTargets() []Target {
return dt.localTargets
}

func (dt *DistributedTargets) TargetCount() int {
return len(dt.localTargetKeys) + len(dt.remoteTargetKeys)
}

// MovedToRemoteInstance returns the set of local targets from prev
// that are no longer local in dt, indicating an active target has moved.
// Only targets which exist in both prev and dt are returned. If prev
Expand All @@ -79,6 +102,10 @@ func keyFor(tgt Target) shard.Key {
return shard.Key(tgt.NonMetaLabels().Hash())
}

func keyForLabels(tgt Target, lbls []string) shard.Key {
return shard.Key(tgt.SpecificLabels(lbls).Hash())
}

type disabledCluster struct{}

var _ cluster.Cluster = disabledCluster{}
Expand Down
Loading

0 comments on commit f59e491

Please sign in to comment.