From b2f3d7fd911d1eacae65a2ce87f99d7ada5c911b Mon Sep 17 00:00:00 2001 From: Leonardo Parente <23251360+leoparente@users.noreply.github.com> Date: Thu, 26 Dec 2024 19:59:06 -0300 Subject: [PATCH] fix: remove not used otlp metrics (#38) --- agent/backend/devicediscovery/device_discovery.go | 8 ++------ agent/backend/networkdiscovery/network_discovery.go | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/agent/backend/devicediscovery/device_discovery.go b/agent/backend/devicediscovery/device_discovery.go index 2d4cc53..2ace611 100644 --- a/agent/backend/devicediscovery/device_discovery.go +++ b/agent/backend/devicediscovery/device_discovery.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "net/http" - "strings" "time" mqtt "github.com/eclipse/paho.mqtt.golang" @@ -52,8 +51,7 @@ type deviceDiscoveryBackend struct { cancelFunc context.CancelFunc ctx context.Context - mqttClient *mqtt.Client - otlpMetricsTopic string + mqttClient *mqtt.Client } type info struct { @@ -89,10 +87,8 @@ func (d *deviceDiscoveryBackend) Configure(logger *zap.Logger, repo policies.Pol return nil } -func (d *deviceDiscoveryBackend) SetCommsClient(agentID string, client *mqtt.Client, baseTopic string) { +func (d *deviceDiscoveryBackend) SetCommsClient(_ string, client *mqtt.Client, _ string) { d.mqttClient = client - otelBaseTopic := strings.Replace(baseTopic, "?", "otlp", 1) - d.otlpMetricsTopic = fmt.Sprintf("%s/m/%c", otelBaseTopic, agentID[0]) } func (d *deviceDiscoveryBackend) Version() (string, error) { diff --git a/agent/backend/networkdiscovery/network_discovery.go b/agent/backend/networkdiscovery/network_discovery.go index e0e004e..c9f331e 100644 --- a/agent/backend/networkdiscovery/network_discovery.go +++ b/agent/backend/networkdiscovery/network_discovery.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "net/http" - "strings" "time" mqtt "github.com/eclipse/paho.mqtt.golang" @@ -52,8 +51,7 @@ type networkDiscoveryBackend struct { cancelFunc context.CancelFunc ctx context.Context - mqttClient *mqtt.Client - otlpMetricsTopic string + mqttClient *mqtt.Client } type info struct { @@ -89,10 +87,8 @@ func (d *networkDiscoveryBackend) Configure(logger *zap.Logger, repo policies.Po return nil } -func (d *networkDiscoveryBackend) SetCommsClient(agentID string, client *mqtt.Client, baseTopic string) { +func (d *networkDiscoveryBackend) SetCommsClient(_ string, client *mqtt.Client, _ string) { d.mqttClient = client - otelBaseTopic := strings.Replace(baseTopic, "?", "otlp", 1) - d.otlpMetricsTopic = fmt.Sprintf("%s/m/%c", otelBaseTopic, agentID[0]) } func (d *networkDiscoveryBackend) Version() (string, error) {