From 2716361eb55e7cde0629728cdb7aeee02ae4af14 Mon Sep 17 00:00:00 2001 From: Morris Witthein <69427027+MorrisWitthein@users.noreply.github.com> Date: Mon, 12 Aug 2024 15:38:50 +0200 Subject: [PATCH 1/3] Update azure event hub connection string data type to secret (#1445) * Update azure event hub connection string data type to secret * Update changelog & docs --- CHANGELOG.md | 3 +++ .../components/loki/loki.source.azure_event_hubs.md | 2 +- .../loki/source/azure_event_hubs/azure_event_hubs.go | 9 +++++---- .../promtailconvert/internal/build/azure_event_hub.go | 7 +++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c0bf0f284..08caacbfc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,9 @@ Main (unreleased) - Fixed an issue where clustering peers resolution via hostname in `--cluster.join-addresses` resolves to duplicated IP addresses when using SRV records. (@thampiotr) +- Fixed an issue where the `connection_string` for the `loki.source.azure_event_hubs` component + was displayed in the UI in plaintext. (@MorrisWitthein) + v1.3.0 ----------------- diff --git a/docs/sources/reference/components/loki/loki.source.azure_event_hubs.md b/docs/sources/reference/components/loki/loki.source.azure_event_hubs.md index 44c6b664b8..a297ac0dae 100644 --- a/docs/sources/reference/components/loki/loki.source.azure_event_hubs.md +++ b/docs/sources/reference/components/loki/loki.source.azure_event_hubs.md @@ -89,7 +89,7 @@ The `authentication` block defines the authentication method when communicating Name | Type | Description | Default | Required --------------------|----------------|---------------------------------------------------------------------------|---------|--------- `mechanism` | `string` | Authentication mechanism. | | yes -`connection_string` | `string` | Event Hubs ConnectionString for authentication on Azure Cloud. | | no +`connection_string` | `secret` | Event Hubs ConnectionString for authentication on Azure Cloud. | | no `scopes` | `list(string)` | Access token scopes. Default is `fully_qualified_namespace` without port. | | no `mechanism` supports the values `"connection_string"` and `"oauth"`. If `"connection_string"` is used, diff --git a/internal/component/loki/source/azure_event_hubs/azure_event_hubs.go b/internal/component/loki/source/azure_event_hubs/azure_event_hubs.go index 7f5cb23afe..2f8fdfa0a9 100644 --- a/internal/component/loki/source/azure_event_hubs/azure_event_hubs.go +++ b/internal/component/loki/source/azure_event_hubs/azure_event_hubs.go @@ -14,6 +14,7 @@ import ( kt "github.com/grafana/alloy/internal/component/loki/source/internal/kafkatarget" "github.com/grafana/alloy/internal/featuregate" "github.com/grafana/alloy/internal/runtime/logging/level" + "github.com/grafana/alloy/syntax/alloytypes" "github.com/grafana/dskit/flagext" "github.com/prometheus/common/model" @@ -50,9 +51,9 @@ type Arguments struct { // AzureEventHubsAuthentication describe the configuration for authentication with Azure Event Hub type AzureEventHubsAuthentication struct { - Mechanism string `alloy:"mechanism,attr"` - Scopes []string `alloy:"scopes,attr,optional"` - ConnectionString string `alloy:"connection_string,attr,optional"` + Mechanism string `alloy:"mechanism,attr"` + Scopes []string `alloy:"scopes,attr,optional"` + ConnectionString alloytypes.Secret `alloy:"connection_string,attr,optional"` } func getDefault() Arguments { @@ -184,7 +185,7 @@ func (a *Arguments) Convert() (kt.Config, error) { SASLConfig: kt.SASLConfig{ UseTLS: true, User: "$ConnectionString", - Password: flagext.SecretWithValue(a.Authentication.ConnectionString), + Password: flagext.SecretWithValue(string(a.Authentication.ConnectionString)), Mechanism: sarama.SASLTypePlaintext, }, } diff --git a/internal/converter/internal/promtailconvert/internal/build/azure_event_hub.go b/internal/converter/internal/promtailconvert/internal/build/azure_event_hub.go index f7a3f7ff0d..bec6dad413 100644 --- a/internal/converter/internal/promtailconvert/internal/build/azure_event_hub.go +++ b/internal/converter/internal/promtailconvert/internal/build/azure_event_hub.go @@ -4,6 +4,7 @@ import ( "github.com/grafana/alloy/internal/component/common/relabel" "github.com/grafana/alloy/internal/component/loki/source/azure_event_hubs" "github.com/grafana/alloy/internal/converter/internal/common" + "github.com/grafana/alloy/syntax/alloytypes" ) func (s *ScrapeConfigBuilder) AppendAzureEventHubs() { @@ -15,7 +16,7 @@ func (s *ScrapeConfigBuilder) AppendAzureEventHubs() { FullyQualifiedNamespace: aCfg.FullyQualifiedNamespace, EventHubs: aCfg.EventHubs, Authentication: azure_event_hubs.AzureEventHubsAuthentication{ - ConnectionString: aCfg.ConnectionString, + ConnectionString: alloytypes.Secret(aCfg.ConnectionString), }, GroupID: aCfg.GroupID, UseIncomingTimestamp: aCfg.UseIncomingTimestamp, @@ -25,9 +26,11 @@ func (s *ScrapeConfigBuilder) AppendAzureEventHubs() { ForwardTo: s.getOrNewProcessStageReceivers(), } override := func(val interface{}) interface{} { - switch val.(type) { + switch value := val.(type) { case relabel.Rules: return common.CustomTokenizer{Expr: s.getOrNewDiscoveryRelabelRules()} + case alloytypes.Secret: + return string(value) default: return val } From d3ceda98853a640e5862ed6b14f58b5d92e50942 Mon Sep 17 00:00:00 2001 From: Alexandre TAVARES MOLINA Date: Mon, 12 Aug 2024 17:23:07 +0200 Subject: [PATCH 2/3] Update data-collection.md (#1381) Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/data-collection.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/data-collection.md b/docs/sources/data-collection.md index 16d0b732a1..27d5bd56c4 100644 --- a/docs/sources/data-collection.md +++ b/docs/sources/data-collection.md @@ -29,7 +29,7 @@ All newly reported data is documented in the CHANGELOG. ## Opt-out of data collection -You can use the `-disable-reporting` [command line flag][] to disable the reporting and opt-out of the data collection. +You can use the `--disable-reporting` [command line flag][] to disable the reporting and opt-out of the data collection. [components]: ../get-started/components [command line flag]: ../reference/cli/run From 0ea8f05b41d99b3af4c3726c62c591d029308f20 Mon Sep 17 00:00:00 2001 From: Piotr <17101802+thampiotr@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:28:56 +0100 Subject: [PATCH 3/3] Add cluster peers per instance panel to cluster overview dash (#1455) * Add cluster peers per instance panel to cluster overview dash * Rename instances->peers on the panel --- CHANGELOG.md | 4 +++ .../dashboards/cluster-overview.libsonnet | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08caacbfc6..64bf66306c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,10 @@ Main (unreleased) used as a temporary measure, since this flag will be disabled in future releases. (@thampiotr) +- Added a new panel to Cluster Overview dashboard to show the number of peers + seen by each instance in the cluster. This can help diagnose cluster split + brain issues. (@thampiotr) + ### Bugfixes - Fixed an issue which caused loss of context data in Faro exception. (@codecapitano) diff --git a/operations/alloy-mixin/dashboards/cluster-overview.libsonnet b/operations/alloy-mixin/dashboards/cluster-overview.libsonnet index 06ad02b552..d5e4ff3fd1 100644 --- a/operations/alloy-mixin/dashboards/cluster-overview.libsonnet +++ b/operations/alloy-mixin/dashboards/cluster-overview.libsonnet @@ -225,5 +225,30 @@ local cluster_node_filename = 'alloy-cluster-node.json'; }, ]) ), + + // Number of peers as seen by each instance. + ( + panel.new(title='Number of peers seen by each instance', type='timeseries') + + panel.withUnit('peers') + + panel.withDescription(||| + The number of cluster peers seen by each instance. + + When cluster is converged, every peer should see all the other instances. When we have a split brain or one + peer not joining the cluster, we will see two or more groups of instances that report different peer numbers + for an extended period of time and not converging. + + This graph helps to identify which instances may be in a split brain state. + |||) + + panel.withPosition({ h: 12, w: 24, x: 0, y: 18 }) + + panel.withQueries([ + panel.newQuery( + expr= ||| + sum by(instance) (cluster_node_peers{%(groupSelector)s}) + ||| % $._config, + legendFormat='{{instance}}', + ), + ]) + ), + ]), }