From 20d7b12442178330c2c183a488dd46adb9e767c7 Mon Sep 17 00:00:00 2001 From: Tome Cvitan <536323+cvitan@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:56:03 -0500 Subject: [PATCH 01/10] Minor README tweaks --- README.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 58d0cde..050ec3a 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,17 @@ Orb agent is a component of the NetBox Discovery solution. It provides network discovery and observability capabilities and is developed by NetBox Labs. ## Project status - The Orb agent project is currently in the Public Preview stage. For details, please see [NetBox Labs Product and Feature Lifecycle](https://docs.netboxlabs.com/product_feature_lifecycle/). We actively welcome feedback to help us identify and prioritize bugs, features, and improvements. ## Getting Started To run `orb-agent`, first pull the Docker image from [Docker Hub](https://hub.docker.com/r/netboxlabs/orb-agent): - ```sh docker pull netboxlabs/orb-agent:latest ``` ## Orb Agent Configuration -To run, the Orb agent requires a configuration file. This configuration file consists of three main sections: `Config Manager`, `Backends`, and `Policies`. - +The Orb agent requires a configuration file. This file consists of three main sections: `Config Manager`, `Backends`, and `Policies`. ### Config Manager The `Config Manager` section specifies how Orb agent should retrieve it's configuration information. The configuration manager is responsible for processing the configuration to retrieve policies and pass them to the appropriate backend. @@ -42,7 +39,8 @@ orb: Only the `network_discovery` and `device_discovery` backends are currently supported. They do not require any special configuration. - [Device Discovery](./docs/backends/device_discovery.md) - [Network Discovery](./docs/backends/network_discovery.md) -### Commons + +### Common A special `common` subsection under `Backends` defines configuration settings that are shared with all backends. Currently, it supports passing [diode](https://github.com/netboxlabs/diode) server settings to all backends. ```yaml @@ -55,7 +53,6 @@ A special `common` subsection under `Backends` defines configuration settings th agent_name: agent01 ``` - ### Policies The `Policies` section specifies what discovery policies should be passed to each backend. Policies define specific settings for discovery (such as scheduling and default properties) and the scope (targets). Backends can run multiple policies simultaneously, but for each backend all policies must have a unique name. These policies are defined in the `policies` section and are grouped under a subsection for each backend: @@ -71,9 +68,8 @@ orb: # see network_discovery section ``` - ## Configuration samples +## Configuration samples You can find sample configurations [here](./docs/config_samples.md) of how to configure Orb agent to run network and device discoveries. ## Required Notice - -Copyright NetBox Labs, Inc. \ No newline at end of file +Copyright NetBox Labs, Inc. From 47ff13d682468025020f935198b75bb0905faa0e Mon Sep 17 00:00:00 2001 From: Luke Tucker Date: Tue, 17 Dec 2024 11:00:07 -0500 Subject: [PATCH 02/10] small documentation updates --- README.md | 12 ++++++------ docs/backends/device_discovery.md | 4 ++-- docs/backends/network_discovery.md | 10 +++++----- docs/config_samples.md | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 58d0cde..bcd5b4b 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,10 @@ A special `common` subsection under `Backends` defines configuration settings th backends: ... common: - diode: - target: grpc://192.168.0.22:8080/diode - api_key: ${DIODE_API_KEY} - agent_name: agent01 + diode: + target: grpc://192.168.0.22:8080/diode + api_key: ${DIODE_API_KEY} + agent_name: agent01 ``` @@ -65,10 +65,10 @@ orb: policies: device_discovery: device_policy_1: - # see device_discovery section + # see docs/backends/device_discovery.md network_discovery: network_policy_1: - # see network_discovery section + # see docs/backends/network_discovery.md ``` ## Configuration samples diff --git a/docs/backends/device_discovery.md b/docs/backends/device_discovery.md index a614816..b2bb06c 100644 --- a/docs/backends/device_discovery.md +++ b/docs/backends/device_discovery.md @@ -1,5 +1,5 @@ # Device Discovery -The device discovery backend leverages NAPALM to connect to network devices and collect network information. +The device discovery backend leverages [NAPALM](https://napalm.readthedocs.io/en/latest/index.html) to connect to network devices and collect network information. ## Configuration @@ -15,7 +15,7 @@ orb: api_key: ${DIODE_API_KEY} agent_name: agent01 device_discovery: - host: 192.168.5.11 #default 0.0.0.0 + host: 192.168.5.11 # default 0.0.0.0 port: 8857 # default 8072 ``` diff --git a/docs/backends/network_discovery.md b/docs/backends/network_discovery.md index 9171538..afa5f69 100644 --- a/docs/backends/network_discovery.md +++ b/docs/backends/network_discovery.md @@ -1,5 +1,5 @@ # Network Discovery -The network discovery backend leverages NMAP to scan networks and discover IP information. +The network discovery backend leverages [NMAP](https://nmap.org/) to scan networks and discover IP information. ## Configuration @@ -15,10 +15,10 @@ orb: api_key: ${DIODE_API_KEY} agent_name: agent01 network_discovery: - host: 192.168.5.11 #default 0.0.0.0 + host: 192.168.5.11 # default 0.0.0.0 port: 8863 # default 8072 - log_level: ERROR #default INFO - log_format: JSON #default TEXT + log_level: ERROR # default INFO + log_format: JSON # default TEXT ``` @@ -71,6 +71,6 @@ orb: - 192.168.7.32 - 192.168.7.30-40 # IP range - 192.168.7.0/24 # IP subnet - - google.com #dns lookup + - google.com # dns lookup ``` \ No newline at end of file diff --git a/docs/config_samples.md b/docs/config_samples.md index f76517b..374039f 100644 --- a/docs/config_samples.md +++ b/docs/config_samples.md @@ -2,7 +2,7 @@ Here is a collection of configuration samples supported by orb agent ## Device-discovery backend -This sample configuration file demonstrates the device discovery backend connecting to a Cisco router at 192.168.0.5. It retrieves device, interface, and IP information, then sends the data to a diode server running at 192.168.0.100. +This sample configuration file demonstrates the device discovery backend connecting to a Cisco router at 192.168.0.5. It retrieves device, interface, and IP information, then sends the data to a [diode](https://github.com/netboxlabs/diode) server running at 192.168.0.100. ```yaml orb: @@ -34,7 +34,7 @@ Run command: docker run -v /local/orb:/opt/orb/ \ -e DIODE_API_KEY={YOUR_API_KEY} \ -e PASS={DEVICE_PASSWORD} \ - netboxlabs/orb-agent:develop run -c /opt/orb/agent.yaml + netboxlabs/orb-agent:latest run -c /opt/orb/agent.yaml ``` ### Custom Drivers @@ -62,7 +62,7 @@ Run command: -e DIODE_API_KEY={YOUR_API_KEY} \ -e PASS={DEVICE_PASSWORD} \ -e INSTALL_DRIVERS_PATH=/opt/orb/drivers.txt \ - netboxlabs/orb-agent:develop run -c /opt/orb/agent.yaml + netboxlabs/orb-agent:latest run -c /opt/orb/agent.yaml ``` The relative path used by `pip install` should point to the directory containing the `.txt` file. @@ -93,5 +93,5 @@ Run command: ```sh docker run -v /local/orb:/opt/orb/ \ -e DIODE_API_KEY={YOUR_API_KEY} \ - netboxlabs/orb-agent:develop run -c /opt/orb/agent.yaml + netboxlabs/orb-agent:latest run -c /opt/orb/agent.yaml ``` \ No newline at end of file From fd6ee6c585e298502478985c301aeac56c20c5c9 Mon Sep 17 00:00:00 2001 From: Leonardo Parente <23251360+leoparente@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:43:18 -0300 Subject: [PATCH 03/10] chore: perform some lint fixes on orb-agent --- .github/golangci.yaml | 37 +++++++++++++++++++++++++++++++++++++ agent/config/cloud.go | 12 +++++++++--- agent/config/manager.go | 2 ++ agent/config/types.go | 11 +++++++++++ agent/policies/repo.go | 10 +++++----- agent/policies/types.go | 11 ++++++++--- agent/policyMgr/manager.go | 27 ++++++++++++++------------- 7 files changed, 86 insertions(+), 24 deletions(-) create mode 100644 .github/golangci.yaml diff --git a/.github/golangci.yaml b/.github/golangci.yaml new file mode 100644 index 0000000..475cdac --- /dev/null +++ b/.github/golangci.yaml @@ -0,0 +1,37 @@ +zrun: + timeout: 5m + modules-download-mode: readonly + +output: + formats: colored-line-number + +linters: + enable: + - revive + - errcheck + - unused + - staticcheck + - ineffassign + - govet + - gosimple + - bodyclose + - gci + +issues: + exclude-use-default: false + exclude-rules: + - path: /*.go + text: "package-comments: should have a package comment" + linters: + - revive + +severity: + default-severity: error + +linters-settings: + gci: + sections: + - standard + - default + - prefix(github.com/netboxlabs/orb-agent) + custom-order: true \ No newline at end of file diff --git a/agent/config/cloud.go b/agent/config/cloud.go index fb59f54..f9722e3 100644 --- a/agent/config/cloud.go +++ b/agent/config/cloud.go @@ -77,21 +77,27 @@ func (cc *cloudConfigManager) request(address string, token string, response int if getErr != nil { return getErr } + defer func() { + if err := res.Body.Close(); err != nil { + cc.logger.Error("failed to close response body", zap.Error(err)) + } + }() + if (res.StatusCode < 200) || (res.StatusCode > 299) { body, err := io.ReadAll(res.Body) if err != nil { - return errors.New(fmt.Sprintf("expected 2xx status code, no or invalid body: %d", res.StatusCode)) + return fmt.Errorf("expected 2xx status code, no or invalid body: %d", res.StatusCode) } if body[0] == '{' { var jsonBody map[string]interface{} err := json.Unmarshal(body, &jsonBody) if err == nil { if errMsg, ok := jsonBody["error"]; ok { - return errors.New(fmt.Sprintf("%d %s", res.StatusCode, errMsg)) + return fmt.Errorf("%d %s", res.StatusCode, errMsg) } } } - return errors.New(fmt.Sprintf("%d %s", res.StatusCode, body)) + return fmt.Errorf("%d %s", res.StatusCode, body) } err = json.NewDecoder(res.Body).Decode(&response) diff --git a/agent/config/manager.go b/agent/config/manager.go index 30a56e6..6448540 100644 --- a/agent/config/manager.go +++ b/agent/config/manager.go @@ -6,11 +6,13 @@ import ( "go.uber.org/zap" ) +// ConfigManager is the interface for configuration manager type ConfigManager interface { GetConfig() (MQTTConfig, error) GetContext(ctx context.Context) context.Context } +// New creates a new instance of ConfigManager based on the configuration func New(logger *zap.Logger, c ManagerConfig) ConfigManager { switch c.Active { case "local": diff --git a/agent/config/types.go b/agent/config/types.go index e34a01b..762f1ee 100644 --- a/agent/config/types.go +++ b/agent/config/types.go @@ -1,10 +1,12 @@ package config +// APIConfig represents the configuration for the API connection type APIConfig struct { Address string `mapstructure:"address"` Token string `mapstructure:"token"` } +// MQTTConfig represents the configuration for the MQTT connection type MQTTConfig struct { Connect bool `mapstructure:"connect"` Address string `mapstructure:"address"` @@ -13,11 +15,13 @@ type MQTTConfig struct { ChannelID string `mapstructure:"channel_id"` } +// CloudConfig represents the configuration for the cloud agent type CloudConfig struct { AgentName string `mapstructure:"agent_name"` AutoProvision bool `mapstructure:"auto_provision"` } +// Cloud represents the cloud ConfigManager configuration type Cloud struct { Config CloudConfig `mapstructure:"config"` API APIConfig `mapstructure:"api"` @@ -31,20 +35,24 @@ type Cloud struct { Tags map[string]string `mapstructure:"tags"` } +// Local represents the local ConfigManager configuration. type Local struct { Config string `mapstructure:"config"` } +// ManagerBackends represents the configuration for manager backends, including cloud and local. type ManagerBackends struct { Cloud Cloud `mapstructure:"orbcloud"` Local Local `mapstructure:"local"` } +// ManagerConfig represents the configuration for the Config Manager type ManagerConfig struct { Active string `mapstructure:"active"` Backends ManagerBackends `mapstructure:"backends"` } +// BackendCommons represents common configuration for backends type BackendCommons struct { Otel struct { Host string `mapstructure:"host"` @@ -57,6 +65,8 @@ type BackendCommons struct { AgentName string `mapstructure:"agent_name"` } } + +// OrbAgent represents the configuration for the Orb agent type OrbAgent struct { Backends map[string]map[string]interface{} `mapstructure:"backends"` Policies map[string]map[string]interface{} `mapstructure:"policies"` @@ -68,6 +78,7 @@ type OrbAgent struct { ConfigFile string `mapstructure:"config_file"` } +// Config represents the overall configuration type Config struct { Version float64 `mapstructure:"version"` OrbAgent OrbAgent `mapstructure:"orb"` diff --git a/agent/policies/repo.go b/agent/policies/repo.go index 7bc1a43..a00f88e 100644 --- a/agent/policies/repo.go +++ b/agent/policies/repo.go @@ -6,6 +6,7 @@ import ( "go.uber.org/zap" ) +// PolicyRepo is the interface for policy repositories type PolicyRepo interface { Exists(policyID string) bool Get(policyID string) (PolicyData, error) @@ -30,11 +31,11 @@ var _ PolicyRepo = (*policyMemRepo)(nil) func (p policyMemRepo) GetByName(policyName string) (PolicyData, error) { if id, ok := p.nameMap[policyName]; ok { return p.Get(id) - } else { - return PolicyData{}, errors.New("policy name not found") } + return PolicyData{}, errors.New("policy name not found") } +// NewMemRepo creates a new in-memory policy repository func NewMemRepo(logger *zap.Logger) (PolicyRepo, error) { r := &policyMemRepo{ logger: logger, @@ -65,9 +66,8 @@ func (p policyMemRepo) RemoveDataset(policyID string, datasetID string) (bool, e // we can remove the policy from the agent if len(policy.Datasets) > 0 { return false, nil - } else { - return true, nil } + return true, nil } func (p policyMemRepo) Exists(policyID string) bool { @@ -120,7 +120,7 @@ func (p policyMemRepo) EnsureGroupID(policyID string, agentGroupID string) error if !ok { return errors.New("unknown policy ID") } - policy.GroupIds[agentGroupID] = true + policy.GroupIDs[agentGroupID] = true return nil } diff --git a/agent/policies/types.go b/agent/policies/types.go index 70c0b13..97ba097 100644 --- a/agent/policies/types.go +++ b/agent/policies/types.go @@ -3,14 +3,13 @@ package policies import ( "database/sql/driver" "time" - - _ "github.com/mattn/go-sqlite3" ) +// PolicyData represents a policy type PolicyData struct { ID string Datasets map[string]bool - GroupIds map[string]bool + GroupIDs map[string]bool Name string Backend string Version int32 @@ -22,6 +21,7 @@ type PolicyData struct { PreviousPolicyData *PolicyData } +// GetDatasetIDs returns the dataset IDs func (d *PolicyData) GetDatasetIDs() []string { keys := make([]string, len(d.Datasets)) @@ -33,6 +33,7 @@ func (d *PolicyData) GetDatasetIDs() []string { return keys } +// Policy state types const ( Unknown PolicyState = iota Running @@ -41,6 +42,7 @@ const ( NoTapMatch ) +// PolicyState represents the state of a policy type PolicyState int var policyStateMap = [...]string{ @@ -63,8 +65,11 @@ func (s PolicyState) String() string { return policyStateMap[s] } +// Scan scans the value into the PolicyState func (s *PolicyState) Scan(value interface{}) error { *s = policyStateRevMap[string(value.([]byte))] return nil } + +// Value returns the value of the PolicyState func (s PolicyState) Value() (driver.Value, error) { return s.String(), nil } diff --git a/agent/policyMgr/manager.go b/agent/policyMgr/manager.go index 82665f7..7760faf 100644 --- a/agent/policyMgr/manager.go +++ b/agent/policyMgr/manager.go @@ -13,6 +13,7 @@ import ( "github.com/netboxlabs/orb-agent/agent/policies" ) +// PolicyManager is the interface for managing policies type PolicyManager interface { ManagePolicy(payload fleet.AgentPolicyRPCPayload) RemovePolicyDataset(policyID string, datasetID string, be backend.Backend) @@ -32,14 +33,7 @@ type policyManager struct { repo policies.PolicyRepo } -func (a *policyManager) GetRepo() policies.PolicyRepo { - return a.repo -} - -func (a *policyManager) GetPolicyState() ([]policies.PolicyData, error) { - return a.repo.GetAll() -} - +// New creates a new instance of PolicyManager func New(logger *zap.Logger, c config.Config) (PolicyManager, error) { repo, err := policies.NewMemRepo(logger) if err != nil { @@ -48,6 +42,14 @@ func New(logger *zap.Logger, c config.Config) (PolicyManager, error) { return &policyManager{logger: logger, config: c, repo: repo}, nil } +func (a *policyManager) GetRepo() policies.PolicyRepo { + return a.repo +} + +func (a *policyManager) GetPolicyState() ([]policies.PolicyData, error) { + return a.repo.GetAll() +} + func (a *policyManager) ManagePolicy(payload fleet.AgentPolicyRPCPayload) { a.logger.Info("managing agent policy from core", @@ -96,14 +98,13 @@ func (a *policyManager) ManagePolicy(payload fleet.AgentPolicyRPCPayload) { if currentPolicy.Backend == pd.Backend && currentPolicy.Version >= pd.Version && currentPolicy.State == policies.Running { a.logger.Info("a better version of this policy has already been applied, skipping", zap.String("policy_id", pd.ID), zap.String("policy_name", pd.Name), zap.String("attempted_version", fmt.Sprint(pd.Version)), zap.String("current_version", fmt.Sprint(currentPolicy.Version))) return - } else { - updatePolicy = true } + updatePolicy = true if currentPolicy.Name != pd.Name { pd.PreviousPolicyData = &policies.PolicyData{Name: currentPolicy.Name} } pd.Datasets = currentPolicy.Datasets - pd.GroupIds = currentPolicy.GroupIds + pd.GroupIDs = currentPolicy.GroupIDs } else { // new policy we have not seen before, associate with this dataset // on first time we see policy, we *require* dataset @@ -114,7 +115,7 @@ func (a *policyManager) ManagePolicy(payload fleet.AgentPolicyRPCPayload) { pd.Datasets = map[string]bool{payload.DatasetID: true} if payload.AgentGroupID != "" { - pd.GroupIds = map[string]bool{payload.AgentGroupID: true} + pd.GroupIDs = map[string]bool{payload.AgentGroupID: true} } } @@ -139,7 +140,7 @@ func (a *policyManager) ManagePolicy(payload fleet.AgentPolicyRPCPayload) { if err != nil { a.logger.Error("policy failed to be removed", zap.String("policy_id", payload.ID), zap.String("policy_name", payload.Name), zap.Error(err)) } - break + return default: a.logger.Error("unknown policy action, ignored", zap.String("action", payload.Action)) } From 4e2602f8490e6a3e24818751836ccda5567431c0 Mon Sep 17 00:00:00 2001 From: rboucher-ns1 <58948528+rboucher-ns1@users.noreply.github.com> Date: Tue, 17 Dec 2024 20:37:26 -0500 Subject: [PATCH 04/10] readme update --- README.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cdf34c5..52482b0 100644 --- a/README.md +++ b/README.md @@ -5,17 +5,17 @@ Orb agent is a component of the NetBox Discovery solution. It provides network d The Orb agent project is currently in the Public Preview stage. For details, please see [NetBox Labs Product and Feature Lifecycle](https://docs.netboxlabs.com/product_feature_lifecycle/). We actively welcome feedback to help us identify and prioritize bugs, features, and improvements. ## Getting Started -To run `orb-agent`, first pull the Docker image from [Docker Hub](https://hub.docker.com/r/netboxlabs/orb-agent): +To get started with `orb-agent`, first pull the Docker image from [Docker Hub](https://hub.docker.com/r/netboxlabs/orb-agent): ```sh docker pull netboxlabs/orb-agent:latest ``` ## Orb Agent Configuration -The Orb agent requires a configuration file. This file consists of three main sections: `Config Manager`, `Backends`, and `Policies`. +The Orb agent requires a configuration file. This file consists of three main sections: `config_manager`, `backends`, and `policies`. ### Config Manager -The `Config Manager` section specifies how Orb agent should retrieve it's configuration information. The configuration manager is responsible for processing the configuration to retrieve policies and pass them to the appropriate backend. +The `config_manager` section specifies how Orb agent should retrieve it's configuration information. The configuration manager is responsible for processing the configuration to retrieve policies and pass them to the appropriate backend. ```yaml orb: @@ -27,7 +27,7 @@ orb: Currently, only the `local` manager is supported, which retrieves policies from the local configuration file passed to the agent. ### Backends -The `Backends` section specifies what Orb agent backends should be enabled. Each Orb agent backend offers specific discovery or observability capabilities and may require specific configuration information. +The `backends` section specifies what Orb agent backends should be enabled. Each Orb agent backend offers specific discovery or observability capabilities and may require specific configuration information. ```yaml orb: @@ -40,8 +40,8 @@ Only the `network_discovery` and `device_discovery` backends are currently suppo - [Device Discovery](./docs/backends/device_discovery.md) - [Network Discovery](./docs/backends/network_discovery.md) -### Common -A special `common` subsection under `Backends` defines configuration settings that are shared with all backends. Currently, it supports passing [diode](https://github.com/netboxlabs/diode) server settings to all backends. +#### Common +A special `common` subsection under `backends` defines configuration settings that are shared with all backends. Currently, it supports passing [diode](https://github.com/netboxlabs/diode) server settings to all backends. ```yaml backends: @@ -54,7 +54,7 @@ A special `common` subsection under `Backends` defines configuration settings th ``` ### Policies -The `Policies` section specifies what discovery policies should be passed to each backend. Policies define specific settings for discovery (such as scheduling and default properties) and the scope (targets). Backends can run multiple policies simultaneously, but for each backend all policies must have a unique name. These policies are defined in the `policies` section and are grouped under a subsection for each backend: +The `policies` section specifies what discovery policies should be passed to each backend. Policies define specific settings for discovery (such as scheduling and default properties) and the scope (targets). Backends can run multiple policies simultaneously, but for each backend all policies must have a unique name. These policies are defined in the `policies` section and are grouped under a subsection for each backend: ```yaml orb: @@ -68,8 +68,16 @@ orb: # see docs/backends/network_discovery.md ``` -## Configuration samples -You can find sample configurations [here](./docs/config_samples.md) of how to configure Orb agent to run network and device discoveries. +## Running the agent + +To run `orb-agent`, use the following command from the directory where your created your `agent.yaml` file: + +```sh + docker run -v $(PWD):/opt/orb/ netboxlabs/orb-agent:latest run -c /opt/orb/agent.yaml +``` + +### Configuration samples +You can find complete sample configurations [here](./docs/config_samples.md) of how to configure Orb agent to run network and device discoveries, as well as the relevant `docker run` commands. ## Required Notice Copyright NetBox Labs, Inc. From f9f88c5745f394b8c102b2e2bb0af9eeea6d42dd Mon Sep 17 00:00:00 2001 From: Leonardo Parente <23251360+leoparente@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:58:13 -0300 Subject: [PATCH 05/10] add gofumpt --- .github/golangci.yaml | 5 ++++- Makefile | 8 ++++++++ agent/config/cloud.go | 3 --- agent/policyMgr/manager.go | 5 ++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/golangci.yaml b/.github/golangci.yaml index 475cdac..af55869 100644 --- a/.github/golangci.yaml +++ b/.github/golangci.yaml @@ -16,6 +16,7 @@ linters: - gosimple - bodyclose - gci + - gofumpt issues: exclude-use-default: false @@ -34,4 +35,6 @@ linters-settings: - standard - default - prefix(github.com/netboxlabs/orb-agent) - custom-order: true \ No newline at end of file + custom-order: true + go-fumpt: + extra-rules: true \ No newline at end of file diff --git a/Makefile b/Makefile index a56b006..acbeeb1 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,14 @@ test-coverage: @cat .coverage/cover.out.tmp | grep -Ev "cmd" > .coverage/cover.out @go tool cover -func=.coverage/cover.out | grep total | awk '{print substr($$3, 1, length($$3)-1)}' > .coverage/coverage.txt +.PHONY: lint +lint: + @golangci-lint run ./... --config ../.github/golangci.yaml + +.PHONY: fix-lint +fix-lint: + @golangci-lint run ./... --config ../.github/golangci.yaml --fix + agent: docker build --no-cache \ --build-arg GOARCH=$(GOARCH) \ diff --git a/agent/config/cloud.go b/agent/config/cloud.go index f9722e3..bf64885 100644 --- a/agent/config/cloud.go +++ b/agent/config/cloud.go @@ -108,7 +108,6 @@ func (cc *cloudConfigManager) request(address string, token string, response int } func (cc *cloudConfigManager) autoProvision(apiAddress string, token string) (MQTTConfig, error) { - type AgentRes struct { ID string `json:"id"` Key string `json:"key"` @@ -155,7 +154,6 @@ func (cc *cloudConfigManager) autoProvision(apiAddress string, token string) (MQ Key: result.Key, ChannelID: result.ChannelID, }, nil - } func (cc *cloudConfigManager) GetConfig() (MQTTConfig, error) { @@ -225,7 +223,6 @@ func (cc *cloudConfigManager) GetConfig() (MQTTConfig, error) { result.Connect = true return result, nil - } func (cc *cloudConfigManager) GetContext(ctx context.Context) context.Context { diff --git a/agent/policyMgr/manager.go b/agent/policyMgr/manager.go index 7760faf..4715aa2 100644 --- a/agent/policyMgr/manager.go +++ b/agent/policyMgr/manager.go @@ -51,7 +51,6 @@ func (a *policyManager) GetPolicyState() ([]policies.PolicyData, error) { } func (a *policyManager) ManagePolicy(payload fleet.AgentPolicyRPCPayload) { - a.logger.Info("managing agent policy from core", zap.String("action", payload.Action), zap.String("name", payload.Name), @@ -62,7 +61,7 @@ func (a *policyManager) ManagePolicy(payload fleet.AgentPolicyRPCPayload) { switch payload.Action { case "manage": - var pd = policies.PolicyData{ + pd := policies.PolicyData{ ID: payload.ID, Name: payload.Name, Backend: payload.Backend, @@ -147,7 +146,7 @@ func (a *policyManager) ManagePolicy(payload fleet.AgentPolicyRPCPayload) { } func (a *policyManager) RemovePolicy(policyID string, policyName string, beName string) error { - var pd = policies.PolicyData{ + pd := policies.PolicyData{ ID: policyID, Name: policyName, } From e97f0ed544fd5bca0c4d924327fb798a176f7aa6 Mon Sep 17 00:00:00 2001 From: Leonardo Parente <23251360+leoparente@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:05:05 -0300 Subject: [PATCH 06/10] Apply suggestions from code review Co-authored-by: Michal Fiedorowicz --- .github/golangci.yaml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/golangci.yaml b/.github/golangci.yaml index af55869..35ad064 100644 --- a/.github/golangci.yaml +++ b/.github/golangci.yaml @@ -1,4 +1,4 @@ -zrun: +run: timeout: 5m modules-download-mode: readonly diff --git a/Makefile b/Makefile index acbeeb1..169b07c 100644 --- a/Makefile +++ b/Makefile @@ -49,11 +49,11 @@ test-coverage: .PHONY: lint lint: - @golangci-lint run ./... --config ../.github/golangci.yaml + @golangci-lint run ./... --config .github/golangci.yaml .PHONY: fix-lint fix-lint: - @golangci-lint run ./... --config ../.github/golangci.yaml --fix + @golangci-lint run ./... --config .github/golangci.yaml --fix agent: docker build --no-cache \ From 4ecfd05f3a0e171dd122cfa6de85b29bc17e701e Mon Sep 17 00:00:00 2001 From: Leonardo Parente <23251360+leoparente@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:06:19 -0300 Subject: [PATCH 07/10] run fix-lint --- agent/agent.go | 16 ++++++++-------- agent/agent_prof_test.go | 1 - .../backend/devicediscovery/device_discovery.go | 4 ++-- .../networkdiscovery/network_discovery.go | 4 ++-- agent/backend/otel/exporter_builder_test.go | 1 - agent/backend/otel/otel.go | 14 ++++++++------ agent/backend/otel/policy.go | 3 ++- agent/backend/pktvisor/pktvisor.go | 2 -- agent/backend/pktvisor/policy.go | 1 - agent/heartbeats.go | 1 - agent/logging.go | 17 +++++++++++++---- cmd/e2e_agent_test.go | 2 +- cmd/main.go | 3 --- 13 files changed, 36 insertions(+), 33 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index c66b01e..2ec7b49 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -20,9 +20,7 @@ import ( "github.com/netboxlabs/orb-agent/agent/version" ) -var ( - ErrMqttConnection = errors.New("failed to connect to a broker") -) +var ErrMqttConnection = errors.New("failed to connect to a broker") type Agent interface { Start(ctx context.Context, cancelFunc context.CancelFunc) error @@ -69,10 +67,12 @@ type orbAgent struct { configManager config.ConfigManager } -const retryRequestDuration = time.Second -const retryRequestFixedTime = 15 -const retryDurationIncrPerAttempts = 10 -const retryMaxAttempts = 4 +const ( + retryRequestDuration = time.Second + retryRequestFixedTime = 15 + retryDurationIncrPerAttempts = 10 + retryMaxAttempts = 4 +) type GroupInfo struct { Name string @@ -97,7 +97,6 @@ func New(logger *zap.Logger, c config.Config) (Agent, error) { } func (a *orbAgent) managePolicies() error { - if a.config.OrbAgent.Policies == nil { return errors.New("no policies specified") } @@ -222,6 +221,7 @@ func (a *orbAgent) logoffWithHeartbeat(ctx context.Context) { } } } + func (a *orbAgent) Stop(ctx context.Context) { a.logger.Info("routine call for stop agent", zap.Any("routine", ctx.Value("routine"))) if a.rpcFromCancelFunc != nil { diff --git a/agent/agent_prof_test.go b/agent/agent_prof_test.go index 64e1a3a..dc280b4 100644 --- a/agent/agent_prof_test.go +++ b/agent/agent_prof_test.go @@ -6,7 +6,6 @@ import ( ) func Test_orbAgent_startBackends(t *testing.T) { - type args struct { agentCtx context.Context } diff --git a/agent/backend/devicediscovery/device_discovery.go b/agent/backend/devicediscovery/device_discovery.go index 51f68ea..1b8b4b7 100644 --- a/agent/backend/devicediscovery/device_discovery.go +++ b/agent/backend/devicediscovery/device_discovery.go @@ -93,8 +93,8 @@ func (d *deviceDiscoveryBackend) SetCommsClient(agentID string, client *mqtt.Cli 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) { var info Info err := d.request("status", &info, http.MethodGet, http.NoBody, "application/json", VersionTimeout) @@ -103,6 +103,7 @@ func (d *deviceDiscoveryBackend) Version() (string, error) { } return info.Version, nil } + func (d *deviceDiscoveryBackend) Start(ctx context.Context, cancelFunc context.CancelFunc) error { d.startTime = time.Now() d.cancelFunc = cancelFunc @@ -192,7 +193,6 @@ func (d *deviceDiscoveryBackend) Start(ctx context.Context, cancelFunc context.C } return nil - } func (d *deviceDiscoveryBackend) Stop(ctx context.Context) error { diff --git a/agent/backend/networkdiscovery/network_discovery.go b/agent/backend/networkdiscovery/network_discovery.go index 21b3235..2542d70 100644 --- a/agent/backend/networkdiscovery/network_discovery.go +++ b/agent/backend/networkdiscovery/network_discovery.go @@ -93,8 +93,8 @@ func (d *networkDiscoveryBackend) SetCommsClient(agentID string, client *mqtt.Cl 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) { var info Info err := d.request("status", &info, http.MethodGet, http.NoBody, "application/json", VersionTimeout) @@ -103,6 +103,7 @@ func (d *networkDiscoveryBackend) Version() (string, error) { } return info.Version, nil } + func (d *networkDiscoveryBackend) Start(ctx context.Context, cancelFunc context.CancelFunc) error { d.startTime = time.Now() d.cancelFunc = cancelFunc @@ -192,7 +193,6 @@ func (d *networkDiscoveryBackend) Start(ctx context.Context, cancelFunc context. } return nil - } func (d *networkDiscoveryBackend) Stop(ctx context.Context) error { diff --git a/agent/backend/otel/exporter_builder_test.go b/agent/backend/otel/exporter_builder_test.go index 92dd010..835e21e 100644 --- a/agent/backend/otel/exporter_builder_test.go +++ b/agent/backend/otel/exporter_builder_test.go @@ -63,7 +63,6 @@ service: if _, ok := expectedStruct.Processors["transform/policy_data"]; !ok { t.Error("missing required attributes/policy_data processor", err) } - }) } } diff --git a/agent/backend/otel/otel.go b/agent/backend/otel/otel.go index 05b9ea1..d996aca 100644 --- a/agent/backend/otel/otel.go +++ b/agent/backend/otel/otel.go @@ -22,15 +22,17 @@ import ( var _ backend.Backend = (*openTelemetryBackend)(nil) -const DefaultPath = "otelcol-contrib" -const DefaultHost = "localhost" -const DefaultPort = 4317 +const ( + DefaultPath = "otelcol-contrib" + DefaultHost = "localhost" + DefaultPort = 4317 +) type openTelemetryBackend struct { logger *zap.Logger startTime time.Time - //policies + // policies policyRepo policies.PolicyRepo policyConfigDirectory string agentTags map[string]string @@ -64,7 +66,8 @@ type openTelemetryBackend struct { // Configure initializes the backend with the given configuration func (o *openTelemetryBackend) Configure(logger *zap.Logger, repo policies.PolicyRepo, - config map[string]interface{}, common config.BackendCommons) error { + config map[string]interface{}, common config.BackendCommons, +) error { o.logger = logger o.logger.Info("configuring OpenTelemetry backend") o.policyRepo = repo @@ -135,7 +138,6 @@ func (o *openTelemetryBackend) Version() (string, error) { o.logger.Info("running opentelemetry-contrib version", zap.String("version", versionOutput)) return versionOutput, nil - } func (o *openTelemetryBackend) Start(ctx context.Context, cancelFunc context.CancelFunc) (err error) { diff --git a/agent/backend/otel/policy.go b/agent/backend/otel/policy.go index d537910..c177e3c 100644 --- a/agent/backend/otel/policy.go +++ b/agent/backend/otel/policy.go @@ -7,10 +7,11 @@ import ( "os" "github.com/go-cmd/cmd" - "github.com/netboxlabs/orb-agent/agent/policies" "go.uber.org/zap" "golang.org/x/exp/slices" "gopkg.in/yaml.v3" + + "github.com/netboxlabs/orb-agent/agent/policies" ) const tempFileNamePattern = "otel-%s-config.yml" diff --git a/agent/backend/pktvisor/pktvisor.go b/agent/backend/pktvisor/pktvisor.go index f15f71d..e671161 100644 --- a/agent/backend/pktvisor/pktvisor.go +++ b/agent/backend/pktvisor/pktvisor.go @@ -134,7 +134,6 @@ func (p *pktvisorBackend) Version() (string, error) { } func (p *pktvisorBackend) Start(ctx context.Context, cancelFunc context.CancelFunc) error { - // this should record the start time whether it's successful or not // because it is used by the automatic restart system for last attempt p.startTime = time.Now() @@ -319,7 +318,6 @@ func (p *pktvisorBackend) GetCapabilities() (map[string]interface{}, error) { } func (p *pktvisorBackend) FullReset(ctx context.Context) error { - // force a stop, which stops scrape as well. if proc is dead, it no ops. if state, _, _ := p.getProcRunningStatus(); state == backend.Running { if err := p.Stop(ctx); err != nil { diff --git a/agent/backend/pktvisor/policy.go b/agent/backend/pktvisor/policy.go index 7bec4a9..c670b7c 100644 --- a/agent/backend/pktvisor/policy.go +++ b/agent/backend/pktvisor/policy.go @@ -12,7 +12,6 @@ import ( ) func (p *pktvisorBackend) ApplyPolicy(data policies.PolicyData, updatePolicy bool) error { - if updatePolicy { // To update a policy it's necessary first remove it and then apply a new version if err := p.RemovePolicy(data); err != nil { diff --git a/agent/heartbeats.go b/agent/heartbeats.go index c12513f..d76fea1 100644 --- a/agent/heartbeats.go +++ b/agent/heartbeats.go @@ -20,7 +20,6 @@ const HeartbeatFreq = 50 * time.Second const RestartTimeMin = 5 * time.Minute func (a *orbAgent) sendSingleHeartbeat(ctx context.Context, t time.Time, agentsState fleet.State) { - if a.heartbeatsTopic == "" { a.logger.Debug("heartbeat topic not yet set, skipping") return diff --git a/agent/logging.go b/agent/logging.go index 37bd5ed..7cebe2c 100644 --- a/agent/logging.go +++ b/agent/logging.go @@ -18,32 +18,41 @@ type agentLoggerError struct { a *orbAgent } -var _ mqtt.Logger = (*agentLoggerDebug)(nil) -var _ mqtt.Logger = (*agentLoggerWarn)(nil) -var _ mqtt.Logger = (*agentLoggerCritical)(nil) -var _ mqtt.Logger = (*agentLoggerError)(nil) +var ( + _ mqtt.Logger = (*agentLoggerDebug)(nil) + _ mqtt.Logger = (*agentLoggerWarn)(nil) + _ mqtt.Logger = (*agentLoggerCritical)(nil) + _ mqtt.Logger = (*agentLoggerError)(nil) +) func (a *agentLoggerWarn) Println(v ...interface{}) { a.a.logger.Warn("WARN mqtt log", zap.Any("payload", v)) } + func (a *agentLoggerWarn) Printf(format string, v ...interface{}) { a.a.logger.Warn("WARN mqtt log", zap.Any("payload", v)) } + func (a *agentLoggerDebug) Println(v ...interface{}) { a.a.logger.Debug("DEBUG mqtt log", zap.Any("payload", v)) } + func (a *agentLoggerDebug) Printf(format string, v ...interface{}) { a.a.logger.Debug("DEBUG mqtt log", zap.Any("payload", v)) } + func (a *agentLoggerCritical) Println(v ...interface{}) { a.a.logger.Error("CRITICAL mqtt log", zap.Any("payload", v)) } + func (a *agentLoggerCritical) Printf(format string, v ...interface{}) { a.a.logger.Error("CRITICAL mqtt log", zap.Any("payload", v)) } + func (a *agentLoggerError) Println(v ...interface{}) { a.a.logger.Error("ERROR mqtt log", zap.Any("payload", v)) } + func (a *agentLoggerError) Printf(format string, v ...interface{}) { a.a.logger.Error("ERROR mqtt log", zap.Any("payload", v)) } diff --git a/cmd/e2e_agent_test.go b/cmd/e2e_agent_test.go index 6e6507d..71c032c 100644 --- a/cmd/e2e_agent_test.go +++ b/cmd/e2e_agent_test.go @@ -111,7 +111,7 @@ func Test_main(t *testing.T) { go func() { sigs := make(chan os.Signal, 1) - signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) select { case <-sigs: logger.Warn("stop signal received stopping agent") diff --git a/cmd/main.go b/cmd/main.go index 6684deb..35eca6e 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -44,7 +44,6 @@ func Version(_ *cobra.Command, _ []string) { } func Run(_ *cobra.Command, _ []string) { - initConfig() // configuration @@ -120,7 +119,6 @@ func Run(_ *cobra.Command, _ []string) { } func mergeOrError(path string) { - v := viper.New() if len(path) > 0 { v.SetConfigFile(path) @@ -186,7 +184,6 @@ func initConfig() { } func main() { - rootCmd := &cobra.Command{ Use: "orb-agent", } From 946b8000561dc5f654794273a2305f8dcb863aae Mon Sep 17 00:00:00 2001 From: Leonardo Parente <23251360+leoparente@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:07:45 -0300 Subject: [PATCH 08/10] chore: fix all lint issues and add lint GHA (#34) --- .github/workflows/lint.yaml | 29 ++++++++++ agent/agent.go | 55 ++++++++----------- agent/backend/backend.go | 17 +++--- .../devicediscovery/device_discovery.go | 44 +++++++-------- agent/backend/devicediscovery/utils.go | 13 +++-- agent/backend/devicediscovery/vars.go | 5 +- .../networkdiscovery/network_discovery.go | 44 +++++++-------- agent/backend/networkdiscovery/utils.go | 13 +++-- agent/backend/networkdiscovery/vars.go | 5 +- agent/backend/otel/exporter_builder.go | 31 ++--------- agent/backend/otel/exporter_builder_test.go | 6 +- agent/backend/otel/otel.go | 34 +++++------- agent/backend/otel/policy.go | 18 +++--- agent/backend/otel/vars.go | 1 + agent/backend/pktvisor/pktvisor.go | 54 +++++++++--------- agent/backend/pktvisor/policy.go | 4 +- agent/backend/pktvisor/utils.go | 15 +++-- agent/backend/pktvisor/vars.go | 1 + agent/config/cloud.go | 22 ++++---- agent/config/local.go | 2 +- agent/config/manager.go | 6 +- agent/config/types.go | 5 +- agent/heartbeats.go | 10 ++-- agent/logging.go | 8 +-- cmd/e2e_agent_test.go | 25 ++------- cmd/main.go | 16 +++--- 26 files changed, 240 insertions(+), 243 deletions(-) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..39cd49a --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,29 @@ +name: Orb Agent - lint +on: + push: + branches: + - "!release" + pull_request: + +permissions: + contents: read + +jobs: + golangci: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.23' + check-latest: true + - name: Lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.62 + working-directory: . + args: --config .github/golangci.yaml + skip-pkg-cache: true + skip-build-cache: true diff --git a/agent/agent.go b/agent/agent.go index 2ec7b49..b1e97c9 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -9,7 +9,6 @@ import ( mqtt "github.com/eclipse/paho.mqtt.golang" "github.com/google/uuid" - _ "github.com/mattn/go-sqlite3" "github.com/mitchellh/mapstructure" "github.com/orb-community/orb/fleet" "go.uber.org/zap" @@ -20,8 +19,9 @@ import ( "github.com/netboxlabs/orb-agent/agent/version" ) -var ErrMqttConnection = errors.New("failed to connect to a broker") +const routineKey config.ContextKey = "routine" +// Agent is the interface that all agents must implement type Agent interface { Start(ctx context.Context, cancelFunc context.CancelFunc) error Stop(ctx context.Context) @@ -33,7 +33,7 @@ type orbAgent struct { logger *zap.Logger config config.Config client mqtt.Client - agent_id string + agentID string backends map[string]backend.Backend backendState map[string]*backend.State backendsCommon config.BackendCommons @@ -47,40 +47,29 @@ type orbAgent struct { heartbeatCancel context.CancelFunc // Agent RPC channel, configured from command line - baseTopic string - rpcToCoreTopic string - rpcFromCoreTopic string - capabilitiesTopic string - heartbeatsTopic string - logTopic string + baseTopic string + rpcFromCoreTopic string + heartbeatsTopic string // Retry Mechanism to ensure the Request is received - groupRequestTicker *time.Ticker groupRequestSucceeded context.CancelFunc - policyRequestTicker *time.Ticker policyRequestSucceeded context.CancelFunc // AgentGroup channels sent from core - groupsInfos map[string]GroupInfo + groupsInfos map[string]groupInfo policyManager manager.PolicyManager - configManager config.ConfigManager + configManager config.Manager } -const ( - retryRequestDuration = time.Second - retryRequestFixedTime = 15 - retryDurationIncrPerAttempts = 10 - retryMaxAttempts = 4 -) - -type GroupInfo struct { +type groupInfo struct { Name string ChannelID string } var _ Agent = (*orbAgent)(nil) +// New creates a new agent func New(logger *zap.Logger, c config.Config) (Agent, error) { pm, err := manager.New(logger, c) if err != nil { @@ -93,7 +82,7 @@ func New(logger *zap.Logger, c config.Config) (Agent, error) { } cm := config.New(logger, c.OrbAgent.ConfigManager) - return &orbAgent{logger: logger, config: c, policyManager: pm, configManager: cm, groupsInfos: make(map[string]GroupInfo)}, nil + return &orbAgent{logger: logger, config: c, policyManager: pm, configManager: cm, groupsInfos: make(map[string]groupInfo)}, nil } func (a *orbAgent) managePolicies() error { @@ -146,7 +135,7 @@ func (a *orbAgent) startBackends(agentCtx context.Context) error { a.logger.Info("failed to configure backend", zap.String("backend", name), zap.Error(err)) return err } - backendCtx := context.WithValue(agentCtx, "routine", name) + backendCtx := context.WithValue(agentCtx, routineKey, name) backendCtx = a.configManager.GetContext(backendCtx) a.backends[name] = be initialState := be.GetInitialState() @@ -176,12 +165,12 @@ func (a *orbAgent) Start(ctx context.Context, cancelFunc context.CancelFunc) err defer func(t time.Time) { a.logger.Debug("Startup of agent execution duration", zap.String("Start() execution duration", time.Since(t).String())) }(startTime) - agentCtx := context.WithValue(ctx, "routine", "agentRoutine") - asyncCtx, cancelAllAsync := context.WithCancel(context.WithValue(ctx, "routine", "asyncParent")) + agentCtx := context.WithValue(ctx, routineKey, "agentRoutine") + asyncCtx, cancelAllAsync := context.WithCancel(context.WithValue(ctx, routineKey, "asyncParent")) a.asyncContext = asyncCtx a.rpcFromCancelFunc = cancelAllAsync a.cancelFunction = cancelFunc - a.logger.Info("agent started", zap.String("version", version.GetBuildVersion()), zap.Any("routine", agentCtx.Value("routine"))) + a.logger.Info("agent started", zap.String("version", version.GetBuildVersion()), zap.Any("routine", agentCtx.Value(routineKey))) mqtt.CRITICAL = &agentLoggerCritical{a: a} mqtt.ERROR = &agentLoggerError{a: a} @@ -211,7 +200,7 @@ func (a *orbAgent) logonWithHeartbeat() { } func (a *orbAgent) logoffWithHeartbeat(ctx context.Context) { - a.logger.Debug("stopping heartbeat, going offline status", zap.Any("routine", ctx.Value("routine"))) + a.logger.Debug("stopping heartbeat, going offline status", zap.Any("routine", ctx.Value(routineKey))) if a.heartbeatCtx != nil { a.heartbeatCancel() } @@ -223,7 +212,7 @@ func (a *orbAgent) logoffWithHeartbeat(ctx context.Context) { } func (a *orbAgent) Stop(ctx context.Context) { - a.logger.Info("routine call for stop agent", zap.Any("routine", ctx.Value("routine"))) + a.logger.Info("routine call for stop agent", zap.Any("routine", ctx.Value(routineKey))) if a.rpcFromCancelFunc != nil { a.rpcFromCancelFunc() } @@ -256,7 +245,7 @@ func (a *orbAgent) RestartBackend(ctx context.Context, name string, reason strin be := a.backends[name] a.logger.Info("restarting backend", zap.String("backend", name), zap.String("reason", reason)) - a.backendState[name].RestartCount += 1 + a.backendState[name].RestartCount++ a.backendState[name].LastRestartTS = time.Now() a.backendState[name].LastRestartReason = reason a.logger.Info("removing policies", zap.String("backend", name)) @@ -272,7 +261,7 @@ func (a *orbAgent) RestartBackend(ctx context.Context, name string, reason strin a.backendState[name].LastError = fmt.Sprintf("failed to reset backend: %v", err) a.logger.Error("failed to reset backend", zap.String("backend", name), zap.Error(err)) } - be.SetCommsClient(a.agent_id, &a.client, fmt.Sprintf("%s/?/%s", a.baseTopic, name)) + be.SetCommsClient(a.agentID, &a.client, fmt.Sprintf("%s/?/%s", a.baseTopic, name)) return nil } @@ -294,7 +283,7 @@ func (a *orbAgent) RestartAll(ctx context.Context, reason string) error { } func (a *orbAgent) extendContext(routine string) (context.Context, context.CancelFunc) { - uuidTraceId := uuid.NewString() - a.logger.Debug("creating context for receiving message", zap.String("routine", routine), zap.String("trace-id", uuidTraceId)) - return context.WithCancel(context.WithValue(context.WithValue(a.asyncContext, "routine", routine), "trace-id", uuidTraceId)) + uuidTraceID := uuid.NewString() + a.logger.Debug("creating context for receiving message", zap.String("routine", routine), zap.String("trace-id", uuidTraceID)) + return context.WithCancel(context.WithValue(context.WithValue(a.asyncContext, routineKey, routine), config.ContextKey("trace-id"), uuidTraceID)) } diff --git a/agent/backend/backend.go b/agent/backend/backend.go index e3cafb2..c85c277 100644 --- a/agent/backend/backend.go +++ b/agent/backend/backend.go @@ -11,6 +11,7 @@ import ( "github.com/netboxlabs/orb-agent/agent/policies" ) +// Running Status types const ( Unknown RunningStatus = iota Running @@ -20,6 +21,7 @@ const ( Waiting ) +// RunningStatus is the status of the backend type RunningStatus int var runningStatusMap = [...]string{ @@ -31,15 +33,7 @@ var runningStatusMap = [...]string{ "waiting", } -var runningStatusRevMap = map[string]RunningStatus{ - "unknown": Unknown, - "running": Running, - "backend_error": BackendError, - "agent_error": AgentError, - "offline": Offline, - "waiting": Waiting, -} - +// State represents the state of the backend type State struct { Status RunningStatus RestartCount int64 @@ -52,6 +46,7 @@ func (s RunningStatus) String() string { return runningStatusMap[s] } +// Backend is the interface that all backends must implement type Backend interface { Configure(*zap.Logger, policies.PolicyRepo, map[string]interface{}, config.BackendCommons) error SetCommsClient(string, *mqtt.Client, string) @@ -71,10 +66,12 @@ type Backend interface { var registry = make(map[string]Backend) +// Register registers backend func Register(name string, b Backend) { registry[name] = b } +// GetList returns list of registered backends func GetList() []string { keys := make([]string, 0, len(registry)) for k := range registry { @@ -83,11 +80,13 @@ func GetList() []string { return keys } +// HaveBackend checks if backend is registered func HaveBackend(name string) bool { _, prs := registry[name] return prs } +// GetBackend returns a registered backend func GetBackend(name string) Backend { return registry[name] } diff --git a/agent/backend/devicediscovery/device_discovery.go b/agent/backend/devicediscovery/device_discovery.go index 1b8b4b7..2d4cc53 100644 --- a/agent/backend/devicediscovery/device_discovery.go +++ b/agent/backend/devicediscovery/device_discovery.go @@ -22,22 +22,21 @@ import ( var _ backend.Backend = (*deviceDiscoveryBackend)(nil) const ( - VersionTimeout = 2 - CapabilitiesTimeout = 5 - ReadinessBackoff = 10 - ReadinessTimeout = 10 - ApplyPolicyTimeout = 10 - RemovePolicyTimeout = 20 - DefaultExec = "device-discovery" - DefaultAPIHost = "localhost" - DefaultAPIPort = "8072" + versionTimeout = 2 + capabilitiesTimeout = 5 + readinessBackoff = 10 + readinessTimeout = 10 + applyPolicyTimeout = 10 + removePolicyTimeout = 20 + defaultExec = "device-discovery" + defaultAPIHost = "localhost" + defaultAPIPort = "8072" ) type deviceDiscoveryBackend struct { logger *zap.Logger policyRepo policies.PolicyRepo exec string - configFile string apiHost string apiPort string @@ -57,15 +56,16 @@ type deviceDiscoveryBackend struct { otlpMetricsTopic string } -type Info struct { +type info struct { Version string `json:"version"` UpTimeMin float64 `json:"up_time_min"` } +// Register registers the backend func Register() bool { backend.Register("device_discovery", &deviceDiscoveryBackend{ apiProtocol: "http", - exec: DefaultExec, + exec: defaultExec, }) return true } @@ -76,10 +76,10 @@ func (d *deviceDiscoveryBackend) Configure(logger *zap.Logger, repo policies.Pol var prs bool if d.apiHost, prs = config["host"].(string); !prs { - d.apiHost = DefaultAPIHost + d.apiHost = defaultAPIHost } if d.apiPort, prs = config["port"].(string); !prs { - d.apiPort = DefaultAPIPort + d.apiPort = defaultAPIPort } d.diodeTarget = common.Diode.Target @@ -96,8 +96,8 @@ func (d *deviceDiscoveryBackend) SetCommsClient(agentID string, client *mqtt.Cli } func (d *deviceDiscoveryBackend) Version() (string, error) { - var info Info - err := d.request("status", &info, http.MethodGet, http.NoBody, "application/json", VersionTimeout) + var info info + err := d.request("status", &info, http.MethodGet, http.NoBody, "application/json", versionTimeout) if err != nil { return "", err } @@ -172,7 +172,7 @@ func (d *deviceDiscoveryBackend) Start(ctx context.Context, cancelFunc context.C d.logger.Info("device-discovery process started", zap.Int("pid", status.PID)) var readinessErr error - for backoff := 0; backoff < ReadinessBackoff; backoff++ { + for backoff := 0; backoff < readinessBackoff; backoff++ { version, readinessErr := d.Version() if readinessErr == nil { d.logger.Info("device-discovery readiness ok, got version ", zap.String("device_discovery_version", version)) @@ -196,7 +196,7 @@ func (d *deviceDiscoveryBackend) Start(ctx context.Context, cancelFunc context.C } func (d *deviceDiscoveryBackend) Stop(ctx context.Context) error { - d.logger.Info("routine call to stop device-discovery", zap.Any("routine", ctx.Value("routine"))) + d.logger.Info("routine call to stop device-discovery", zap.Any("routine", ctx.Value(config.ContextKey("routine")))) defer d.cancelFunc() err := d.proc.Stop() finalStatus := <-d.statusChan @@ -216,7 +216,7 @@ func (d *deviceDiscoveryBackend) FullReset(ctx context.Context) error { } } // for each policy, restart the scraper - backendCtx, cancelFunc := context.WithCancel(context.WithValue(ctx, "routine", "device-discovery")) + backendCtx, cancelFunc := context.WithCancel(context.WithValue(ctx, config.ContextKey("routine"), "device-discovery")) // start it if err := d.Start(backendCtx, cancelFunc); err != nil { d.logger.Error("failed to start backend on restart procedure", zap.Error(err)) @@ -231,7 +231,7 @@ func (d *deviceDiscoveryBackend) GetStartTime() time.Time { func (d *deviceDiscoveryBackend) GetCapabilities() (map[string]interface{}, error) { caps := make(map[string]interface{}) - err := d.request("capabilities", &caps, http.MethodGet, http.NoBody, "application/json", CapabilitiesTimeout) + err := d.request("capabilities", &caps, http.MethodGet, http.NoBody, "application/json", capabilitiesTimeout) if err != nil { return nil, err } @@ -280,7 +280,7 @@ func (d *deviceDiscoveryBackend) ApplyPolicy(data policies.PolicyData, updatePol } var resp map[string]interface{} - err = d.request("policies", &resp, http.MethodPost, bytes.NewBuffer(policyYaml), "application/x-yaml", ApplyPolicyTimeout) + err = d.request("policies", &resp, http.MethodPost, bytes.NewBuffer(policyYaml), "application/x-yaml", applyPolicyTimeout) if err != nil { d.logger.Warn("yaml policy application failure", zap.String("policy_id", data.ID), zap.ByteString("policy", policyYaml)) return err @@ -299,7 +299,7 @@ func (d *deviceDiscoveryBackend) RemovePolicy(data policies.PolicyData) error { } else { name = data.Name } - err := d.request(fmt.Sprintf("policies/%s", name), &resp, http.MethodDelete, http.NoBody, "application/json", RemovePolicyTimeout) + err := d.request(fmt.Sprintf("policies/%s", name), &resp, http.MethodDelete, http.NoBody, "application/json", removePolicyTimeout) if err != nil { return err } diff --git a/agent/backend/devicediscovery/utils.go b/agent/backend/devicediscovery/utils.go index 7c41a21..d778167 100644 --- a/agent/backend/devicediscovery/utils.go +++ b/agent/backend/devicediscovery/utils.go @@ -2,7 +2,6 @@ package devicediscovery import ( "encoding/json" - "errors" "fmt" "io" "net/http" @@ -63,19 +62,25 @@ func (d *deviceDiscoveryBackend) request(url string, payload interface{}, method return getErr } + defer func() { + if err := res.Body.Close(); err != nil { + d.logger.Error("failed to close response body", zap.Error(err)) + } + }() + if (res.StatusCode < 200) || (res.StatusCode > 299) { body, err := io.ReadAll(res.Body) if err != nil { - return errors.New(fmt.Sprintf("non 2xx HTTP error code from device-discovery, no or invalid body: %d", res.StatusCode)) + return fmt.Errorf("non 2xx HTTP error code from device-discovery, no or invalid body: %d", res.StatusCode) } if len(body) == 0 { - return errors.New(fmt.Sprintf("%d empty body", res.StatusCode)) + return fmt.Errorf("%d empty body", res.StatusCode) } else if body[0] == '{' { var jsonBody map[string]interface{} err := json.Unmarshal(body, &jsonBody) if err == nil { if errMsg, ok := jsonBody["error"]; ok { - return errors.New(fmt.Sprintf("%d %s", res.StatusCode, errMsg)) + return fmt.Errorf("%d %s", res.StatusCode, errMsg) } } } diff --git a/agent/backend/devicediscovery/vars.go b/agent/backend/devicediscovery/vars.go index a9426c0..a8261d3 100644 --- a/agent/backend/devicediscovery/vars.go +++ b/agent/backend/devicediscovery/vars.go @@ -4,7 +4,8 @@ import ( "github.com/spf13/viper" ) +// RegisterBackendSpecificVariables registers the backend specific variables for the device discovery backend func RegisterBackendSpecificVariables(v *viper.Viper) { - v.SetDefault("orb.backends.device_discovery.host", DefaultAPIHost) - v.SetDefault("orb.backends.device_discovery.port", DefaultAPIPort) + v.SetDefault("orb.backends.device_discovery.host", defaultAPIHost) + v.SetDefault("orb.backends.device_discovery.port", defaultAPIPort) } diff --git a/agent/backend/networkdiscovery/network_discovery.go b/agent/backend/networkdiscovery/network_discovery.go index 2542d70..e0e004e 100644 --- a/agent/backend/networkdiscovery/network_discovery.go +++ b/agent/backend/networkdiscovery/network_discovery.go @@ -22,22 +22,21 @@ import ( var _ backend.Backend = (*networkDiscoveryBackend)(nil) const ( - VersionTimeout = 2 - CapabilitiesTimeout = 5 - ReadinessBackoff = 10 - ReadinessTimeout = 10 - ApplyPolicyTimeout = 10 - RemovePolicyTimeout = 20 - DefaultExec = "network-discovery" - DefaultAPIHost = "localhost" - DefaultAPIPort = "8073" + versionTimeout = 2 + capabilitiesTimeout = 5 + readinessBackoff = 10 + readinessTimeout = 10 + applyPolicyTimeout = 10 + removePolicyTimeout = 20 + defaultExec = "network-discovery" + defaultAPIHost = "localhost" + defaultAPIPort = "8073" ) type networkDiscoveryBackend struct { logger *zap.Logger policyRepo policies.PolicyRepo exec string - configFile string apiHost string apiPort string @@ -57,15 +56,16 @@ type networkDiscoveryBackend struct { otlpMetricsTopic string } -type Info struct { +type info struct { Version string `json:"version"` UpTimeMin float64 `json:"up_time_seconds"` } +// Register registers the network discovery backend func Register() bool { backend.Register("network_discovery", &networkDiscoveryBackend{ apiProtocol: "http", - exec: DefaultExec, + exec: defaultExec, }) return true } @@ -76,10 +76,10 @@ func (d *networkDiscoveryBackend) Configure(logger *zap.Logger, repo policies.Po var prs bool if d.apiHost, prs = config["host"].(string); !prs { - d.apiHost = DefaultAPIHost + d.apiHost = defaultAPIHost } if d.apiPort, prs = config["port"].(string); !prs { - d.apiPort = DefaultAPIPort + d.apiPort = defaultAPIPort } d.diodeTarget = common.Diode.Target @@ -96,8 +96,8 @@ func (d *networkDiscoveryBackend) SetCommsClient(agentID string, client *mqtt.Cl } func (d *networkDiscoveryBackend) Version() (string, error) { - var info Info - err := d.request("status", &info, http.MethodGet, http.NoBody, "application/json", VersionTimeout) + var info info + err := d.request("status", &info, http.MethodGet, http.NoBody, "application/json", versionTimeout) if err != nil { return "", err } @@ -172,7 +172,7 @@ func (d *networkDiscoveryBackend) Start(ctx context.Context, cancelFunc context. d.logger.Info("network-discovery process started", zap.Int("pid", status.PID)) var readinessErr error - for backoff := 0; backoff < ReadinessBackoff; backoff++ { + for backoff := 0; backoff < readinessBackoff; backoff++ { version, readinessErr := d.Version() if readinessErr == nil { d.logger.Info("network-discovery readiness ok, got version ", zap.String("network_discovery_version", version)) @@ -196,7 +196,7 @@ func (d *networkDiscoveryBackend) Start(ctx context.Context, cancelFunc context. } func (d *networkDiscoveryBackend) Stop(ctx context.Context) error { - d.logger.Info("routine call to stop network-discovery", zap.Any("routine", ctx.Value("routine"))) + d.logger.Info("routine call to stop network-discovery", zap.Any("routine", ctx.Value(config.ContextKey("routine")))) defer d.cancelFunc() err := d.proc.Stop() finalStatus := <-d.statusChan @@ -216,7 +216,7 @@ func (d *networkDiscoveryBackend) FullReset(ctx context.Context) error { } } // for each policy, restart the scraper - backendCtx, cancelFunc := context.WithCancel(context.WithValue(ctx, "routine", "network-discovery")) + backendCtx, cancelFunc := context.WithCancel(context.WithValue(ctx, config.ContextKey("routine"), "network-discovery")) // start it if err := d.Start(backendCtx, cancelFunc); err != nil { d.logger.Error("failed to start backend on restart procedure", zap.Error(err)) @@ -231,7 +231,7 @@ func (d *networkDiscoveryBackend) GetStartTime() time.Time { func (d *networkDiscoveryBackend) GetCapabilities() (map[string]interface{}, error) { caps := make(map[string]interface{}) - err := d.request("capabilities", &caps, http.MethodGet, http.NoBody, "application/json", CapabilitiesTimeout) + err := d.request("capabilities", &caps, http.MethodGet, http.NoBody, "application/json", capabilitiesTimeout) if err != nil { return nil, err } @@ -280,7 +280,7 @@ func (d *networkDiscoveryBackend) ApplyPolicy(data policies.PolicyData, updatePo } var resp map[string]interface{} - err = d.request("policies", &resp, http.MethodPost, bytes.NewBuffer(policyYaml), "application/x-yaml", ApplyPolicyTimeout) + err = d.request("policies", &resp, http.MethodPost, bytes.NewBuffer(policyYaml), "application/x-yaml", applyPolicyTimeout) if err != nil { d.logger.Warn("yaml policy application failure", zap.String("policy_id", data.ID), zap.ByteString("policy", policyYaml)) return err @@ -297,7 +297,7 @@ func (d *networkDiscoveryBackend) RemovePolicy(data policies.PolicyData) error { if data.PreviousPolicyData != nil && data.PreviousPolicyData.Name != data.Name { name = data.PreviousPolicyData.Name } - err := d.request(fmt.Sprintf("policies/%s", name), &resp, http.MethodDelete, http.NoBody, "application/json", RemovePolicyTimeout) + err := d.request(fmt.Sprintf("policies/%s", name), &resp, http.MethodDelete, http.NoBody, "application/json", removePolicyTimeout) if err != nil { return err } diff --git a/agent/backend/networkdiscovery/utils.go b/agent/backend/networkdiscovery/utils.go index 2d0d40b..6be0435 100644 --- a/agent/backend/networkdiscovery/utils.go +++ b/agent/backend/networkdiscovery/utils.go @@ -2,7 +2,6 @@ package networkdiscovery import ( "encoding/json" - "errors" "fmt" "io" "net/http" @@ -63,19 +62,25 @@ func (d *networkDiscoveryBackend) request(url string, payload interface{}, metho return getErr } + defer func() { + if err := res.Body.Close(); err != nil { + d.logger.Error("failed to close response body", zap.Error(err)) + } + }() + if (res.StatusCode < 200) || (res.StatusCode > 299) { body, err := io.ReadAll(res.Body) if err != nil { - return errors.New(fmt.Sprintf("non 2xx HTTP error code from network-discovery, no or invalid body: %d", res.StatusCode)) + return fmt.Errorf("non 2xx HTTP error code from network-discovery, no or invalid body: %d", res.StatusCode) } if len(body) == 0 { - return errors.New(fmt.Sprintf("%d empty body", res.StatusCode)) + return fmt.Errorf("%d empty body", res.StatusCode) } else if body[0] == '{' { var jsonBody map[string]interface{} err := json.Unmarshal(body, &jsonBody) if err == nil { if errMsg, ok := jsonBody["error"]; ok { - return errors.New(fmt.Sprintf("%d %s", res.StatusCode, errMsg)) + return fmt.Errorf("%d %s", res.StatusCode, errMsg) } } } diff --git a/agent/backend/networkdiscovery/vars.go b/agent/backend/networkdiscovery/vars.go index c11c0fe..405c736 100644 --- a/agent/backend/networkdiscovery/vars.go +++ b/agent/backend/networkdiscovery/vars.go @@ -4,7 +4,8 @@ import ( "github.com/spf13/viper" ) +// RegisterBackendSpecificVariables registers the backend specific variables for the network discovery backend func RegisterBackendSpecificVariables(v *viper.Viper) { - v.SetDefault("orb.backends.network_discovery.host", DefaultAPIHost) - v.SetDefault("orb.backends.network_discovery.port", DefaultAPIPort) + v.SetDefault("orb.backends.network_discovery.host", defaultAPIHost) + v.SetDefault("orb.backends.network_discovery.port", defaultAPIPort) } diff --git a/agent/backend/otel/exporter_builder.go b/agent/backend/otel/exporter_builder.go index a1f49b7..60991dc 100644 --- a/agent/backend/otel/exporter_builder.go +++ b/agent/backend/otel/exporter_builder.go @@ -7,6 +7,7 @@ import ( "gopkg.in/yaml.v3" ) +// ExporterBuilder is an interface that defines the methods to build an exporter type ExporterBuilder interface { GetStructFromYaml(yamlString string) (openTelemetryConfig, error) MergeDefaultValueWithPolicy(config openTelemetryConfig, policyName string) (openTelemetryConfig, error) @@ -22,7 +23,7 @@ type openTelemetryConfig struct { type defaultOtlpExporter struct { Endpoint string `yaml:"endpoint"` - Tls *tls `yaml:"tls"` + TLS *tls `yaml:"tls"` } type tls struct { @@ -84,11 +85,11 @@ func (e *exporterBuilder) GetStructFromYaml(yamlString string) (openTelemetryCon return config, nil } -func (e *exporterBuilder) MergeDefaultValueWithPolicy(config openTelemetryConfig, policyId string, policyName string) (openTelemetryConfig, error) { +func (e *exporterBuilder) MergeDefaultValueWithPolicy(config openTelemetryConfig, policyID string, policyName string) (openTelemetryConfig, error) { endpoint := e.host + ":" + strconv.Itoa(e.port) defaultOtlpExporter := defaultOtlpExporter{ Endpoint: endpoint, - Tls: &tls{ + TLS: &tls{ Insecure: true, }, } @@ -104,7 +105,7 @@ func (e *exporterBuilder) MergeDefaultValueWithPolicy(config openTelemetryConfig "metric_statements": map[string]interface{}{ "context": "scope", "statements": []string{ - `set(attributes["policy_id"], "` + policyId + `")`, + `set(attributes["policy_id"], "` + policyID + `")`, `set(attributes["policy_name"], "` + policyName + `")`, }, }, @@ -131,25 +132,3 @@ func (e *exporterBuilder) MergeDefaultValueWithPolicy(config openTelemetryConfig } return config, nil } - -func (o *openTelemetryBackend) buildDefaultExporterAndProcessor(policyYaml string, policyId string, policyName string, telemetryPort int) (openTelemetryConfig, error) { - defaultPolicyYaml, err := yaml.Marshal(policyYaml) - if err != nil { - o.logger.Warn("yaml policy marshal failure", zap.String("policy_id", policyId)) - return openTelemetryConfig{}, err - } - defaultPolicyString := string(defaultPolicyYaml) - builder := getExporterBuilder(o.logger, o.otelReceiverHost, o.otelReceiverPort) - defaultPolicyStruct, err := builder.GetStructFromYaml(defaultPolicyString) - if err != nil { - return openTelemetryConfig{}, err - } - defaultPolicyStruct, err = builder.MergeDefaultValueWithPolicy( - defaultPolicyStruct, - policyId, - policyName) - if err != nil { - return openTelemetryConfig{}, err - } - return defaultPolicyStruct, nil -} diff --git a/agent/backend/otel/exporter_builder_test.go b/agent/backend/otel/exporter_builder_test.go index 835e21e..cbcdd50 100644 --- a/agent/backend/otel/exporter_builder_test.go +++ b/agent/backend/otel/exporter_builder_test.go @@ -10,7 +10,7 @@ func TestBuildDefaultPolicy(t *testing.T) { testCases := []struct { caseName string inputString string - policyId string + policyID string policyName string expectedStruct openTelemetryConfig processedString string @@ -44,7 +44,7 @@ service: receivers: - httpcheck `, - policyId: "test-policy-id", + policyID: "test-policy-id", policyName: "test-policy", }, } @@ -56,7 +56,7 @@ service: if err != nil { t.Errorf("failed to merge default value with policy: %v", err) } - expectedStruct, err := exporterBuilder.MergeDefaultValueWithPolicy(gotOtelConfig, testCase.policyId, testCase.policyName) + expectedStruct, err := exporterBuilder.MergeDefaultValueWithPolicy(gotOtelConfig, testCase.policyID, testCase.policyName) if err != nil { t.Errorf("failed to merge default value with policy: %v", err) } diff --git a/agent/backend/otel/otel.go b/agent/backend/otel/otel.go index d996aca..7d2f740 100644 --- a/agent/backend/otel/otel.go +++ b/agent/backend/otel/otel.go @@ -2,7 +2,6 @@ package otel import ( "context" - _ "embed" "fmt" "os" "os/exec" @@ -11,8 +10,6 @@ import ( mqtt "github.com/eclipse/paho.mqtt.golang" "github.com/go-cmd/cmd" - "go.opentelemetry.io/collector/exporter" - "go.opentelemetry.io/collector/receiver" "go.uber.org/zap" "github.com/netboxlabs/orb-agent/agent/backend" @@ -23,9 +20,9 @@ import ( var _ backend.Backend = (*openTelemetryBackend)(nil) const ( - DefaultPath = "otelcol-contrib" - DefaultHost = "localhost" - DefaultPort = 4317 + defaultPath = "otelcol-contrib" + defaultHost = "localhost" + defaultPort = 4317 ) type openTelemetryBackend struct { @@ -42,8 +39,6 @@ type openTelemetryBackend struct { runningCollectors map[string]runningPolicy mainCancelFunction context.CancelFunc - // MQTT Config for OTEL MQTT Exporter - mqttConfig config.MQTTConfig mqttClient *mqtt.Client otlpMetricsTopic string @@ -55,13 +50,6 @@ type openTelemetryBackend struct { otelReceiverHost string otelReceiverPort int otelExecutablePath string - - metricsReceiver receiver.Metrics - metricsExporter exporter.Metrics - tracesReceiver receiver.Traces - tracesExporter exporter.Traces - logsReceiver receiver.Logs - logsExporter exporter.Logs } // Configure initializes the backend with the given configuration @@ -74,10 +62,14 @@ func (o *openTelemetryBackend) Configure(logger *zap.Logger, repo policies.Polic var err error o.otelReceiverTaps = []string{"otelcol-contrib", "receivers", "processors", "extensions"} o.policyConfigDirectory, err = os.MkdirTemp("", "otel-policies") + if err != nil { + o.logger.Error("failed to create temporary directory for policy configs", zap.Error(err)) + return err + } if path, ok := config["binary"].(string); ok { o.otelExecutablePath = path } else { - o.otelExecutablePath = DefaultPath + o.otelExecutablePath = defaultPath } _, err = exec.LookPath(o.otelExecutablePath) if err != nil { @@ -94,15 +86,15 @@ func (o *openTelemetryBackend) Configure(logger *zap.Logger, repo policies.Polic o.otelReceiverPort, err = strconv.Atoi(otelPort.(string)) if err != nil { o.logger.Error("failed to parse otlp port using default", zap.Error(err)) - o.otelReceiverPort = DefaultPort + o.otelReceiverPort = defaultPort } } else { - o.otelReceiverPort = DefaultPort + o.otelReceiverPort = defaultPort } if otelHost, ok := config["otlp_host"].(string); ok { o.otelReceiverHost = otelHost } else { - o.otelReceiverHost = DefaultHost + o.otelReceiverHost = defaultHost } return nil @@ -124,6 +116,7 @@ func (o *openTelemetryBackend) Version() (string, error) { case finalStatus := <-status: if finalStatus.Error != nil { o.logger.Error("error during call of otelcol-contrib version", zap.Error(finalStatus.Error)) + cancel() return "", finalStatus.Error } else { output := finalStatus.Stdout @@ -186,13 +179,14 @@ func (o *openTelemetryBackend) Stop(_ context.Context) error { func (o *openTelemetryBackend) FullReset(ctx context.Context) error { o.logger.Info("restarting otel backend", zap.Int("running policies", len(o.runningCollectors))) - backendCtx, cancelFunc := context.WithCancel(context.WithValue(ctx, "routine", "otel")) + backendCtx, cancelFunc := context.WithCancel(context.WithValue(ctx, config.ContextKey("routine"), "otel")) if err := o.Start(backendCtx, cancelFunc); err != nil { return err } return nil } +// Register registers otel backend func Register() bool { backend.Register("otel", &openTelemetryBackend{}) return true diff --git a/agent/backend/otel/policy.go b/agent/backend/otel/policy.go index c177e3c..de8f4a1 100644 --- a/agent/backend/otel/policy.go +++ b/agent/backend/otel/policy.go @@ -11,18 +11,18 @@ import ( "golang.org/x/exp/slices" "gopkg.in/yaml.v3" + "github.com/netboxlabs/orb-agent/agent/config" "github.com/netboxlabs/orb-agent/agent/policies" ) const tempFileNamePattern = "otel-%s-config.yml" type runningPolicy struct { - ctx context.Context - cancel context.CancelFunc - policyId string - telemetryPort int - policyData policies.PolicyData - statusChan *cmd.Status + ctx context.Context + cancel context.CancelFunc + policyID string + policyData policies.PolicyData + statusChan *cmd.Status } func (o *openTelemetryBackend) ApplyPolicy(newPolicyData policies.PolicyData, updatePolicy bool) error { @@ -95,13 +95,13 @@ func (o *openTelemetryBackend) ApplyPolicy(newPolicyData policies.PolicyData, up } func (o *openTelemetryBackend) addRunner(policyData policies.PolicyData, policyFilePath string) error { - policyContext, policyCancel := context.WithCancel(context.WithValue(o.mainContext, "policy_id", policyData.ID)) + policyContext, policyCancel := context.WithCancel(context.WithValue(o.mainContext, config.ContextKey("policy_id"), policyData.ID)) command := cmd.NewCmdOptions(cmd.Options{Buffered: false, Streaming: true}, o.otelExecutablePath, "--config", policyFilePath) go func(ctx context.Context, logger *zap.Logger) { status := command.Start() o.logger.Info("starting otel policy", zap.String("policy_id", policyData.ID), zap.Any("status", command.Status()), zap.Int("process id", command.Status().PID)) - for command.Status().Complete == false { + for !command.Status().Complete { select { case v := <-ctx.Done(): err := command.Stop() @@ -127,7 +127,7 @@ func (o *openTelemetryBackend) addRunner(policyData policies.PolicyData, policyF policyEntry := runningPolicy{ ctx: policyContext, cancel: policyCancel, - policyId: policyData.ID, + policyID: policyData.ID, policyData: policyData, statusChan: &status, } diff --git a/agent/backend/otel/vars.go b/agent/backend/otel/vars.go index bf7401f..5611485 100644 --- a/agent/backend/otel/vars.go +++ b/agent/backend/otel/vars.go @@ -2,6 +2,7 @@ package otel import "github.com/spf13/viper" +// RegisterBackendSpecificVariables registers the backend specific variables for the otel backend func RegisterBackendSpecificVariables(v *viper.Viper) { v.SetDefault("orb.backends.otel.otlp_port", "4316") } diff --git a/agent/backend/pktvisor/pktvisor.go b/agent/backend/pktvisor/pktvisor.go index e671161..38b68a6 100644 --- a/agent/backend/pktvisor/pktvisor.go +++ b/agent/backend/pktvisor/pktvisor.go @@ -13,8 +13,6 @@ import ( mqtt "github.com/eclipse/paho.mqtt.golang" "github.com/go-cmd/cmd" - "go.opentelemetry.io/collector/exporter" - "go.opentelemetry.io/collector/receiver" "go.uber.org/zap" "github.com/netboxlabs/orb-agent/agent/backend" @@ -25,17 +23,17 @@ import ( var _ backend.Backend = (*pktvisorBackend)(nil) const ( - DefaultBinary = "pktvisord" - ReadinessBackoff = 10 - ReadinessTimeout = 10 - ApplyPolicyTimeout = 10 - RemovePolicyTimeout = 20 - VersionTimeout = 2 - ScrapeTimeout = 5 - TapsTimeout = 5 - DefaultConfigPath = "/opt/orb/agent.yaml" - DefaultAPIHost = "localhost" - DefaultAPIPort = "10853" + defaultBinary = "pktvisord" + readinessBackoff = 10 + readinessTimeout = 10 + applyPolicyTimeout = 10 + removePolicyTimeout = 20 + versionTimeout = 2 + scrapeTimeout = 5 + tapsTimeout = 5 + defaultConfigPath = "/opt/orb/agent.yaml" + defaultAPIHost = "localhost" + defaultAPIPort = "10853" ) // AppInfo represents server application information @@ -57,9 +55,6 @@ type pktvisorBackend struct { cancelFunc context.CancelFunc ctx context.Context - // MQTT Config for OTEL MQTT Exporter - mqttConfig config.MQTTConfig - mqttClient *mqtt.Client metricsTopic string otlpMetricsTopic string @@ -75,8 +70,6 @@ type pktvisorBackend struct { // OpenTelemetry management otelReceiverHost string otelReceiverPort int - receiver receiver.Metrics - exporter exporter.Metrics } func (p *pktvisorBackend) getFreePort() (int, error) { @@ -88,7 +81,11 @@ func (p *pktvisorBackend) getFreePort() (int, error) { if err != nil { return 0, err } - defer l.Close() + defer func() { + if err := l.Close(); err != nil { + p.logger.Error("failed to close socket", zap.Error(err)) + } + }() return l.Addr().(*net.TCPAddr).Port, nil } @@ -234,9 +231,9 @@ func (p *pktvisorBackend) Start(ctx context.Context, cancelFunc context.CancelFu p.logger.Info("pktvisor process started", zap.Int("pid", status.PID)) var readinessError error - for backoff := 0; backoff < ReadinessBackoff; backoff++ { + for backoff := 0; backoff < readinessBackoff; backoff++ { var appMetrics AppInfo - readinessError = p.request("metrics/app", &appMetrics, http.MethodGet, http.NoBody, "application/json", ReadinessTimeout) + readinessError = p.request("metrics/app", &appMetrics, http.MethodGet, http.NoBody, "application/json", readinessTimeout) if readinessError == nil { p.logger.Info("pktvisor readiness ok, got version ", zap.String("pktvisor_version", appMetrics.App.Version)) break @@ -259,7 +256,7 @@ func (p *pktvisorBackend) Start(ctx context.Context, cancelFunc context.CancelFu } func (p *pktvisorBackend) Stop(ctx context.Context) error { - p.logger.Info("routine call to stop pktvisor", zap.Any("routine", ctx.Value("routine"))) + p.logger.Info("routine call to stop pktvisor", zap.Any("routine", ctx.Value(config.ContextKey("routine")))) defer p.cancelFunc() err := p.proc.Stop() finalStatus := <-p.statusChan @@ -278,16 +275,16 @@ func (p *pktvisorBackend) Configure(logger *zap.Logger, repo policies.PolicyRepo var prs bool if p.binary, prs = config["binary"].(string); !prs { - p.binary = DefaultBinary + p.binary = defaultBinary } if p.configFile, prs = config["config_file"].(string); !prs { - p.configFile = DefaultConfigPath + p.configFile = defaultConfigPath } if p.adminAPIHost, prs = config["api_host"].(string); !prs { - p.adminAPIHost = DefaultAPIHost + p.adminAPIHost = defaultAPIHost } if p.adminAPIPort, prs = config["api_port"].(string); !prs { - p.adminAPIPort = DefaultAPIPort + p.adminAPIPort = defaultAPIPort } p.agentTags = common.Otel.AgentTags @@ -308,7 +305,7 @@ func (p *pktvisorBackend) Configure(logger *zap.Logger, repo policies.PolicyRepo func (p *pktvisorBackend) GetCapabilities() (map[string]interface{}, error) { var taps interface{} - err := p.request("taps", &taps, http.MethodGet, http.NoBody, "application/json", TapsTimeout) + err := p.request("taps", &taps, http.MethodGet, http.NoBody, "application/json", tapsTimeout) if err != nil { return nil, err } @@ -327,7 +324,7 @@ func (p *pktvisorBackend) FullReset(ctx context.Context) error { } // for each policy, restart the scraper - backendCtx, cancelFunc := context.WithCancel(context.WithValue(ctx, "routine", "pktvisor")) + backendCtx, cancelFunc := context.WithCancel(context.WithValue(ctx, config.ContextKey("routine"), "pktvisor")) // start it if err := p.Start(backendCtx, cancelFunc); err != nil { @@ -338,6 +335,7 @@ func (p *pktvisorBackend) FullReset(ctx context.Context) error { return nil } +// Register registers pktvisor backend func Register() bool { backend.Register("pktvisor", &pktvisorBackend{ adminAPIProtocol: "http", diff --git a/agent/backend/pktvisor/policy.go b/agent/backend/pktvisor/policy.go index c670b7c..58c203b 100644 --- a/agent/backend/pktvisor/policy.go +++ b/agent/backend/pktvisor/policy.go @@ -37,7 +37,7 @@ func (p *pktvisorBackend) ApplyPolicy(data policies.PolicyData, updatePolicy boo } var resp map[string]interface{} - err = p.request("policies", &resp, http.MethodPost, bytes.NewBuffer(policyYaml), "application/x-yaml", ApplyPolicyTimeout) + err = p.request("policies", &resp, http.MethodPost, bytes.NewBuffer(policyYaml), "application/x-yaml", applyPolicyTimeout) if err != nil { p.logger.Warn("yaml policy application failure", zap.String("policy_id", data.ID), zap.ByteString("policy", policyYaml)) return err @@ -56,7 +56,7 @@ func (p *pktvisorBackend) RemovePolicy(data policies.PolicyData) error { } else { name = data.Name } - err := p.request(fmt.Sprintf("policies/%s", name), &resp, http.MethodDelete, http.NoBody, "application/json", RemovePolicyTimeout) + err := p.request(fmt.Sprintf("policies/%s", name), &resp, http.MethodDelete, http.NoBody, "application/json", removePolicyTimeout) if err != nil { return err } diff --git a/agent/backend/pktvisor/utils.go b/agent/backend/pktvisor/utils.go index 391141b..fd62633 100644 --- a/agent/backend/pktvisor/utils.go +++ b/agent/backend/pktvisor/utils.go @@ -2,7 +2,6 @@ package pktvisor import ( "encoding/json" - "errors" "fmt" "io" "net/http" @@ -41,19 +40,25 @@ func (p *pktvisorBackend) request(url string, payload interface{}, method string return getErr } + defer func() { + if err := res.Body.Close(); err != nil { + p.logger.Error("failed to close response body", zap.Error(err)) + } + }() + if (res.StatusCode < 200) || (res.StatusCode > 299) { body, err := io.ReadAll(res.Body) if err != nil { - return errors.New(fmt.Sprintf("non 2xx HTTP error code from pktvisord, no or invalid body: %d", res.StatusCode)) + return fmt.Errorf("non 2xx HTTP error code from pktvisord, no or invalid body: %d", res.StatusCode) } if len(body) == 0 { - return errors.New(fmt.Sprintf("%d empty body", res.StatusCode)) + return fmt.Errorf("%d empty body", res.StatusCode) } else if body[0] == '{' { var jsonBody map[string]interface{} err := json.Unmarshal(body, &jsonBody) if err == nil { if errMsg, ok := jsonBody["error"]; ok { - return errors.New(fmt.Sprintf("%d %s", res.StatusCode, errMsg)) + return fmt.Errorf("%d %s", res.StatusCode, errMsg) } } } @@ -93,6 +98,6 @@ func (p *pktvisorBackend) getProcRunningStatus() (backend.RunningStatus, string, // also used for HTTP REST API readiness check func (p *pktvisorBackend) getAppInfo() (AppInfo, error) { var appInfo AppInfo - err := p.request("metrics/app", &appInfo, http.MethodGet, http.NoBody, "application/json", VersionTimeout) + err := p.request("metrics/app", &appInfo, http.MethodGet, http.NoBody, "application/json", versionTimeout) return appInfo, err } diff --git a/agent/backend/pktvisor/vars.go b/agent/backend/pktvisor/vars.go index c98ead6..df3db3d 100644 --- a/agent/backend/pktvisor/vars.go +++ b/agent/backend/pktvisor/vars.go @@ -4,6 +4,7 @@ import ( "github.com/spf13/viper" ) +// RegisterBackendSpecificVariables registers the backend specific variables for the pktvisor backend func RegisterBackendSpecificVariables(v *viper.Viper) { v.SetDefault("orb.backends.pktvisor.binary", "/usr/local/sbin/pktvisord") v.SetDefault("orb.backends.pktvisor.config_file", "/opt/orb/agent.yaml") diff --git a/agent/config/cloud.go b/agent/config/cloud.go index bf64885..894f0a5 100644 --- a/agent/config/cloud.go +++ b/agent/config/cloud.go @@ -19,7 +19,7 @@ import ( "go.uber.org/zap" ) -var _ ConfigManager = (*cloudConfigManager)(nil) +var _ Manager = (*cloudConfigManager)(nil) type cloudConfigManager struct { logger *zap.Logger @@ -150,7 +150,7 @@ func (cc *cloudConfigManager) autoProvision(apiAddress string, token string) (MQ } return MQTTConfig{ - Id: result.ID, + ID: result.ID, Key: result.Key, ChannelID: result.ChannelID, }, nil @@ -168,13 +168,13 @@ func (cc *cloudConfigManager) GetConfig() (MQTTConfig, error) { // this may change in the future mqtt := cc.config.MQTT - if len(mqtt.Id) > 0 && len(mqtt.Key) > 0 && len(mqtt.ChannelID) > 0 { + if len(mqtt.ID) > 0 && len(mqtt.Key) > 0 && len(mqtt.ChannelID) > 0 { cc.logger.Info("using explicitly specified cloud configuration", zap.String("address", mqtt.Address), - zap.String("id", mqtt.Id)) + zap.String("id", mqtt.ID)) return MQTTConfig{ Address: mqtt.Address, - Id: mqtt.Id, + ID: mqtt.ID, Key: mqtt.Key, ChannelID: mqtt.ChannelID, }, nil @@ -193,7 +193,7 @@ func (cc *cloudConfigManager) GetConfig() (MQTTConfig, error) { // see if we have an existing auto provisioned configuration saved locally q := `SELECT id, key, channel FROM cloud_config ORDER BY ts_created DESC LIMIT 1` dba := MQTTConfig{} - if err := cc.db.QueryRowx(q).Scan(&dba.Id, &dba.Key, &dba.ChannelID); err != nil { + if err := cc.db.QueryRowx(q).Scan(&dba.ID, &dba.Key, &dba.ChannelID); err != nil { if err != sql.ErrNoRows { return MQTTConfig{}, err } @@ -202,7 +202,7 @@ func (cc *cloudConfigManager) GetConfig() (MQTTConfig, error) { dba.Address = mqtt.Address cc.logger.Info("using previous auto provisioned cloud configuration loaded from local storage", zap.String("address", mqtt.Address), - zap.String("id", dba.Id)) + zap.String("id", dba.ID)) return dba, nil } @@ -219,17 +219,17 @@ func (cc *cloudConfigManager) GetConfig() (MQTTConfig, error) { result.Address = mqtt.Address cc.logger.Info("using auto provisioned cloud configuration", zap.String("address", mqtt.Address), - zap.String("id", result.Id)) + zap.String("id", result.ID)) result.Connect = true return result, nil } func (cc *cloudConfigManager) GetContext(ctx context.Context) context.Context { - if cc.config.MQTT.Id != "" { - ctx = context.WithValue(ctx, "agent_id", cc.config.MQTT.Id) + if cc.config.MQTT.ID != "" { + ctx = context.WithValue(ctx, ContextKey("agent_id"), cc.config.MQTT.ID) } else { - ctx = context.WithValue(ctx, "agent_id", "auto-provisioning-without-id") + ctx = context.WithValue(ctx, ContextKey("agent_id"), "auto-provisioning-without-id") } return ctx } diff --git a/agent/config/local.go b/agent/config/local.go index af8f5ab..8f0b2d7 100644 --- a/agent/config/local.go +++ b/agent/config/local.go @@ -6,7 +6,7 @@ import ( "go.uber.org/zap" ) -var _ ConfigManager = (*localConfigManager)(nil) +var _ Manager = (*localConfigManager)(nil) type localConfigManager struct { logger *zap.Logger diff --git a/agent/config/manager.go b/agent/config/manager.go index 6448540..4989835 100644 --- a/agent/config/manager.go +++ b/agent/config/manager.go @@ -6,14 +6,14 @@ import ( "go.uber.org/zap" ) -// ConfigManager is the interface for configuration manager -type ConfigManager interface { +// Manager is the interface for configuration manager +type Manager interface { GetConfig() (MQTTConfig, error) GetContext(ctx context.Context) context.Context } // New creates a new instance of ConfigManager based on the configuration -func New(logger *zap.Logger, c ManagerConfig) ConfigManager { +func New(logger *zap.Logger, c ManagerConfig) Manager { switch c.Active { case "local": return &localConfigManager{logger: logger, config: c.Backends.Local} diff --git a/agent/config/types.go b/agent/config/types.go index 762f1ee..87a10a0 100644 --- a/agent/config/types.go +++ b/agent/config/types.go @@ -1,5 +1,8 @@ package config +// ContextKey represents the key for the context +type ContextKey string + // APIConfig represents the configuration for the API connection type APIConfig struct { Address string `mapstructure:"address"` @@ -10,7 +13,7 @@ type APIConfig struct { type MQTTConfig struct { Connect bool `mapstructure:"connect"` Address string `mapstructure:"address"` - Id string `mapstructure:"id"` + ID string `mapstructure:"id"` Key string `mapstructure:"key"` ChannelID string `mapstructure:"channel_id"` } diff --git a/agent/heartbeats.go b/agent/heartbeats.go index d76fea1..a055dff 100644 --- a/agent/heartbeats.go +++ b/agent/heartbeats.go @@ -16,8 +16,8 @@ import ( // HeartbeatFreq how often to heartbeat const HeartbeatFreq = 50 * time.Second -// RestartTimeMin minimum time to wait between restarts -const RestartTimeMin = 5 * time.Minute +// RestartTime minimum time to wait between restarts +const RestartTime = 5 * time.Minute func (a *orbAgent) sendSingleHeartbeat(ctx context.Context, t time.Time, agentsState fleet.State) { if a.heartbeatsTopic == "" { @@ -46,7 +46,7 @@ func (a *orbAgent) sendSingleHeartbeat(ctx context.Context, t time.Time, agentsS } // status is not running so we have a current error besi.Error = a.backendState[name].LastError - if time.Now().Sub(be.GetStartTime()) >= RestartTimeMin { + if time.Since(be.GetStartTime()) >= RestartTime { a.logger.Info("attempting backend restart due to failed status during heartbeat") ctx = a.configManager.GetContext(ctx) err := a.RestartBackend(ctx, name, "failed during heartbeat") @@ -54,7 +54,7 @@ func (a *orbAgent) sendSingleHeartbeat(ctx context.Context, t time.Time, agentsS a.logger.Error("failed to restart backend", zap.Error(err), zap.String("backend", name)) } } else { - a.logger.Info("waiting to attempt backend restart due to failed status", zap.Duration("remaining_secs", RestartTimeMin-(time.Now().Sub(be.GetStartTime())))) + a.logger.Info("waiting to attempt backend restart due to failed status", zap.Duration("remaining_secs", RestartTime-(time.Since(be.GetStartTime())))) } } else { // status is Running so no current error @@ -133,7 +133,7 @@ func (a *orbAgent) sendSingleHeartbeat(ctx context.Context, t time.Time, agentsS } func (a *orbAgent) sendHeartbeats(ctx context.Context, cancelFunc context.CancelFunc) { - a.logger.Debug("start heartbeats routine", zap.Any("routine", ctx.Value("routine"))) + a.logger.Debug("start heartbeats routine", zap.Any("routine", ctx.Value(routineKey))) a.sendSingleHeartbeat(ctx, time.Now(), fleet.Online) defer func() { cancelFunc() diff --git a/agent/logging.go b/agent/logging.go index 7cebe2c..f751583 100644 --- a/agent/logging.go +++ b/agent/logging.go @@ -29,7 +29,7 @@ func (a *agentLoggerWarn) Println(v ...interface{}) { a.a.logger.Warn("WARN mqtt log", zap.Any("payload", v)) } -func (a *agentLoggerWarn) Printf(format string, v ...interface{}) { +func (a *agentLoggerWarn) Printf(_ string, v ...interface{}) { a.a.logger.Warn("WARN mqtt log", zap.Any("payload", v)) } @@ -37,7 +37,7 @@ func (a *agentLoggerDebug) Println(v ...interface{}) { a.a.logger.Debug("DEBUG mqtt log", zap.Any("payload", v)) } -func (a *agentLoggerDebug) Printf(format string, v ...interface{}) { +func (a *agentLoggerDebug) Printf(_ string, v ...interface{}) { a.a.logger.Debug("DEBUG mqtt log", zap.Any("payload", v)) } @@ -45,7 +45,7 @@ func (a *agentLoggerCritical) Println(v ...interface{}) { a.a.logger.Error("CRITICAL mqtt log", zap.Any("payload", v)) } -func (a *agentLoggerCritical) Printf(format string, v ...interface{}) { +func (a *agentLoggerCritical) Printf(_ string, v ...interface{}) { a.a.logger.Error("CRITICAL mqtt log", zap.Any("payload", v)) } @@ -53,6 +53,6 @@ func (a *agentLoggerError) Println(v ...interface{}) { a.a.logger.Error("ERROR mqtt log", zap.Any("payload", v)) } -func (a *agentLoggerError) Printf(format string, v ...interface{}) { +func (a *agentLoggerError) Printf(_ string, v ...interface{}) { a.a.logger.Error("ERROR mqtt log", zap.Any("payload", v)) } diff --git a/cmd/e2e_agent_test.go b/cmd/e2e_agent_test.go index 71c032c..c835c17 100644 --- a/cmd/e2e_agent_test.go +++ b/cmd/e2e_agent_test.go @@ -16,7 +16,6 @@ import ( "go.uber.org/zap/zapcore" "github.com/netboxlabs/orb-agent/agent" - "github.com/netboxlabs/orb-agent/agent/backend/pktvisor" "github.com/netboxlabs/orb-agent/agent/config" ) @@ -35,7 +34,7 @@ func Test_e2e_orbAgent_ConfigFile(t *testing.T) { } runCmd.Flags().StringSliceVarP(&cfgFiles, "config", "c", []string{}, "Path to config files (may be specified multiple times)") - runCmd.PersistentFlags().BoolVarP(&Debug, "debug", "d", false, "Enable verbose (debug level) output") + runCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "Enable verbose (debug level) output") rootCmd.AddCommand(runCmd) rootCmd.SetArgs([]string{"run", "-d", "-c", "/home/lpegoraro/workspace/orb/localconfig/config.yaml"}) @@ -45,11 +44,8 @@ func Test_e2e_orbAgent_ConfigFile(t *testing.T) { t.Fail() } - select { - case <-ctx.Done(): - cancelF() - return - } + <-ctx.Done() + cancelF() } func Test_main(t *testing.T) { @@ -67,21 +63,10 @@ func Test_main(t *testing.T) { cfg.OrbAgent.Debug.Enable = true - // include pktvisor backend by default if binary is at default location - _, err = os.Stat(pktvisor.DefaultBinary) - if err == nil && cfg.OrbAgent.Backends == nil { - cfg.OrbAgent.Backends = make(map[string]map[string]interface{}) - cfg.OrbAgent.Backends["pktvisor"] = make(map[string]interface{}) - cfg.OrbAgent.Backends["pktvisor"]["binary"] = pktvisor.DefaultBinary - if len(cfgFiles) > 0 { - cfg.OrbAgent.Backends["pktvisor"]["config_file"] = "/home/lpegoraro/workspace/orb/localconfig/config.yaml" - } - } - // logger var logger *zap.Logger atomicLevel := zap.NewAtomicLevel() - if Debug { + if debug { atomicLevel.SetLevel(zap.DebugLevel) } else { atomicLevel.SetLevel(zap.InfoLevel) @@ -107,7 +92,7 @@ func Test_main(t *testing.T) { // handle signals done := make(chan bool, 1) - rootCtx, cancelFunc := context.WithTimeout(context.WithValue(context.Background(), "routine", "mainRoutine"), 15*time.Minute) + rootCtx, cancelFunc := context.WithTimeout(context.WithValue(context.Background(), routineKey, "mainRoutine"), 15*time.Minute) go func() { sigs := make(chan os.Signal, 1) diff --git a/cmd/main.go b/cmd/main.go index 35eca6e..a591cc4 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -23,12 +23,13 @@ import ( ) const ( - defaultConfig = "/opt/orb/agent_default.yaml" + defaultConfig = "/opt/orb/agent_default.yaml" + routineKey config.ContextKey = "routine" ) var ( cfgFiles []string - Debug bool + debug bool ) func init() { @@ -38,11 +39,13 @@ func init() { networkdiscovery.Register() } +// Version prints the version of the agent func Version(_ *cobra.Command, _ []string) { fmt.Printf("orb-agent %s\n", version.GetBuildVersion()) os.Exit(0) } +// Run starts the agent func Run(_ *cobra.Command, _ []string) { initConfig() @@ -57,7 +60,7 @@ func Run(_ *cobra.Command, _ []string) { // logger var logger *zap.Logger atomicLevel := zap.NewAtomicLevel() - if Debug { + if debug { atomicLevel.SetLevel(zap.DebugLevel) } else { atomicLevel.SetLevel(zap.InfoLevel) @@ -74,7 +77,6 @@ func Run(_ *cobra.Command, _ []string) { _ = logger.Sync() }(logger) - _, err = os.Stat(pktvisor.DefaultBinary) logger.Info("backends loaded", zap.Any("backends", configData.OrbAgent.Backends)) configData.OrbAgent.ConfigFile = defaultConfig @@ -91,11 +93,11 @@ func Run(_ *cobra.Command, _ []string) { // handle signals done := make(chan bool, 1) - rootCtx, cancelFunc := context.WithCancel(context.WithValue(context.Background(), "routine", "mainRoutine")) + rootCtx, cancelFunc := context.WithCancel(context.WithValue(context.Background(), routineKey, "mainRoutine")) go func() { sigs := make(chan os.Signal, 1) - signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) select { case <-sigs: logger.Warn("stop signal received stopping agent") @@ -202,7 +204,7 @@ func main() { } runCmd.Flags().StringSliceVarP(&cfgFiles, "config", "c", []string{}, "Path to config files (may be specified multiple times)") - runCmd.PersistentFlags().BoolVarP(&Debug, "debug", "d", false, "Enable verbose (debug level) output") + runCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "Enable verbose (debug level) output") rootCmd.AddCommand(runCmd) rootCmd.AddCommand(versionCmd) From 57023bd858ef85b3f120b6c812a8845cfb6e6487 Mon Sep 17 00:00:00 2001 From: Leonardo Parente <23251360+leoparente@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:15:05 -0300 Subject: [PATCH 09/10] chore: update golang.org/x/* (#35) --- go.mod | 24 +--- go.sum | 370 ++------------------------------------------------------- 2 files changed, 11 insertions(+), 383 deletions(-) diff --git a/go.mod b/go.mod index c1a0776..024e968 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/go-cmd/cmd v1.4.2 github.com/google/uuid v1.4.0 github.com/jmoiron/sqlx v1.4.0 - github.com/mattn/go-sqlite3 v1.14.22 github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 github.com/orb-community/orb v0.30.0 github.com/pkg/profile v1.7.0 @@ -15,10 +14,8 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/exporter v0.91.0 - go.opentelemetry.io/collector/receiver v0.91.0 go.uber.org/zap v1.26.0 - golang.org/x/exp v0.0.0-20231127185646-65229373498e + golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 gopkg.in/yaml.v3 v3.0.1 ) @@ -39,23 +36,17 @@ require ( github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.4 // indirect - github.com/knadh/koanf v1.5.0 // indirect - github.com/knadh/koanf/v2 v2.0.1 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mainflux/mainflux v0.0.0-20220415135135-92d8fb99bf82 // indirect github.com/mainflux/senml v1.5.0 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/reflectwalk v1.0.2 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect github.com/nats-io/nats.go v1.32.0 // indirect github.com/nats-io/nkeys v0.4.7 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -64,19 +55,10 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/x448/float16 v0.8.4 // indirect - go.opentelemetry.io/collector/component v0.91.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.91.0 // indirect - go.opentelemetry.io/collector/confmap v0.91.0 // indirect - go.opentelemetry.io/collector/consumer v0.91.0 // indirect - go.opentelemetry.io/collector/featuregate v1.0.0 // indirect - go.opentelemetry.io/collector/pdata v1.0.0 // indirect - go.opentelemetry.io/otel v1.21.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect go.uber.org/goleak v1.2.1 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.31.0 // indirect - golang.org/x/net v0.23.0 // indirect + golang.org/x/net v0.33.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect diff --git a/go.sum b/go.sum index 14fd508..13fe3bd 100644 --- a/go.sum +++ b/go.sum @@ -1,61 +1,28 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= -github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= -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/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= -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/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= -github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/benbjohnson/immutable v0.4.3 h1:GYHcksoJ9K6HyAUpGxwZURrbTkXA0Dh4otXGqbhdrjA= github.com/benbjohnson/immutable v0.4.3/go.mod h1:qJIKKSmdqz1tVzNtst1DZzvaqOU1onk1rc03IeM3Owk= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -69,22 +36,12 @@ github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eclipse/paho.mqtt.golang v1.4.3 h1:2kwcUGn8seMUfWndX0hGbvH8r7crgcJguQNCyp70xik= github.com/eclipse/paho.mqtt.golang v1.4.3/go.mod h1:CSYvoAlsMkhYOXh/oKyxa8EcBci6dVkLCbo5tTC1RIE= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fxamacker/cbor/v2 v2.2.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= @@ -96,151 +53,52 @@ github.com/go-cmd/cmd v1.4.2 h1:pnX38iIJHh4huzBSqfkAZkfXrVwM/5EccAJmrVqMnbg= github.com/go-cmd/cmd v1.4.2/go.mod h1:u3hxg/ry+D5kwh8WvUkHLAMe2zQCaXd00t35WfQaOFk= github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs= github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/go-zoo/bone v1.3.0 h1:PY6sHq37FnQhj+4ZyqFIzJQHvrrGx0GEc3vTZZC/OsI= github.com/go-zoo/bone v1.3.0/go.mod h1:HI3Lhb7G3UQcAwEhOJ2WyNcsFtQX1WYHa0Hl4OBbhW8= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 h1:CqYfpuYIjnlNxM3msdyPRKabhXZWbKjf3Q8BWROFBso= github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.13.0/go.mod h1:ZlVrynguJKcYr54zGaDbaL3fOvKC9m72FhPvA8T35KQ= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= -github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= -github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= -github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= -github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q= -github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M= -github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E= github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= -github.com/knadh/koanf v1.5.0 h1:q2TSd/3Pyc/5yP9ldIrSdIz26MCcyNQzW0pEAugLPNs= -github.com/knadh/koanf v1.5.0/go.mod h1:Hgyjp4y8v44hpZtPzs7JZfRAW5AhN7KfZcwv1RYggDs= -github.com/knadh/koanf/v2 v2.0.1 h1:1dYGITt1I23x8cfx8ZnldtezdyaZtfAuRtIFOiRzK7g= -github.com/knadh/koanf/v2 v2.0.1/go.mod h1:ZeiIlIDXTE7w1lMT6UVcNiRAS2/rCeLn/GdLNvY1Dus= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= @@ -251,57 +109,20 @@ github.com/mainflux/mainflux v0.0.0-20220415135135-92d8fb99bf82 h1:UWQLBZ7ychamG github.com/mainflux/mainflux v0.0.0-20220415135135-92d8fb99bf82/go.mod h1:YPGCoouBMT7gP6u4Hnj7vafJqRzT5yiuKtBNMC/DUIE= github.com/mainflux/senml v1.5.0 h1:GAd1y1eMohfa6sVYcr2iQfVfkkh9l/q7B1TWF5L68xs= github.com/mainflux/senml v1.5.0/go.mod h1:SMX76mM5yenjLVjZOM27+njCGkP+AA64O46nRQiBRlE= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= -github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= -github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 h1:BpfhmLKZf+SjVanKKhCgf3bg+511DmU9eDQTen7LLbY= github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= -github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nats-io/nats.go v1.32.0 h1:Bx9BZS+aXYlxW08k8Gd3yR2s73pV5XSoAQUyp1Kwvp0= github.com/nats-io/nats.go v1.32.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid/v2 v2.0.2 h1:r4fFzBm+bv0wNKNh5eXTwU7i85y5x+uwkxCUTNVQqLc= github.com/oklog/ulid/v2 v2.0.2/go.mod h1:mtBL0Qe/0HAx6/a4Z30qxVIAL1eQDweXq5lxOEiwQ68= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -318,14 +139,8 @@ github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4a github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= github.com/ory/keto/proto/ory/keto/acl/v1alpha1 v0.0.0-20210616104402-80e043246cf9 h1:gP86NkMkUlqMOTjFQ8lt8T1HbHtCJGGeeeh/6c+nla0= github.com/ory/keto/proto/ory/keto/acl/v1alpha1 v0.0.0-20210616104402-80e043246cf9/go.mod h1:8IoeBQqIRKWU5L6dTKQTlTwVhlUawpqSBJZWfLLN4FM= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA= @@ -333,51 +148,25 @@ github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDj github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/poy/onpar v1.1.2 h1:QaNrNiZx0+Nar5dLgTVp5mXkyoVFIbepjyEoGSnhbAY= github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjzg= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.46.0 h1:doXzt5ybi1HBKpsZOL0sSkaNHJJqkyfEWZGGqqScV0Y= github.com/prometheus/common v0.46.0/go.mod h1:Tp0qkxpb9Jsg54QMe+EAmqXkSV7Evdy1BTn+g2pa/hQ= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rubenv/sql-migrate v1.7.0 h1:HtQq1xyTN2ISmQDggnh0c9U3JlP8apWh8YO2jzlXpTI= github.com/rubenv/sql-migrate v1.7.0/go.mod h1:S4wtDEG1CKn+0ShpTtzWhFpHHI5PvCUtiGI+C+Z2THE= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= @@ -393,14 +182,10 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -418,211 +203,72 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17 github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= -go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= -go.opentelemetry.io/collector/component v0.91.0 h1:aBT1i2zGyfh9PalYJLfXVvQp+osHyalwyDFselI1CtA= -go.opentelemetry.io/collector/component v0.91.0/go.mod h1:2KBHvjNFdU7oOjsObQeC4Ta2Ef607OISU5obznW00fw= -go.opentelemetry.io/collector/config/configtelemetry v0.91.0 h1:mEwvqrYfwUJ7LwYfpcF9M8z7LHFoYaKhEPhnERD/88E= -go.opentelemetry.io/collector/config/configtelemetry v0.91.0/go.mod h1:+LAXM5WFMW/UbTlAuSs6L/W72WC+q8TBJt/6z39FPOU= -go.opentelemetry.io/collector/confmap v0.91.0 h1:7U2MT+u74oEzq/WWrpXSLKB7nX5jPNC4drwtQdYfwKk= -go.opentelemetry.io/collector/confmap v0.91.0/go.mod h1:uxV+fZ85kG31oovL6Cl3fAMQ3RRPwUvfAbbA9WT1Yhk= -go.opentelemetry.io/collector/consumer v0.91.0 h1:0nU1lUe2S0b8iOmF3w3R/9Dt24n413thRTbXz/nJgrM= -go.opentelemetry.io/collector/consumer v0.91.0/go.mod h1:phTUQmr7hpYfwXyDXo4mFHVjYrlSbZE+nZYlKlbVxGs= -go.opentelemetry.io/collector/exporter v0.91.0 h1:guWcGflFjaenp3BMxAmAKjb8RQG80jQQKjuUFouS+z8= -go.opentelemetry.io/collector/exporter v0.91.0/go.mod h1:hkOBunNNWu6CaTtkRsCJ/OJ509REJZg+DDElevFIQCQ= -go.opentelemetry.io/collector/featuregate v1.0.0 h1:5MGqe2v5zxaoo73BUOvUTunftX5J8RGrbFsC2Ha7N3g= -go.opentelemetry.io/collector/featuregate v1.0.0/go.mod h1:xGbRuw+GbutRtVVSEy3YR2yuOlEyiUMhN2M9DJljgqY= -go.opentelemetry.io/collector/pdata v1.0.0 h1:ECP2jnLztewsHmL1opL8BeMtWVc7/oSlKNhfY9jP8ec= -go.opentelemetry.io/collector/pdata v1.0.0/go.mod h1:TsDFgs4JLNG7t6x9D8kGswXUz4mme+MyNChHx8zSF6k= -go.opentelemetry.io/collector/receiver v0.91.0 h1:0TZF/0OXoJtxgm+mvOinRRXo9LgVyOsOgCQfWkNGXJA= -go.opentelemetry.io/collector/receiver v0.91.0/go.mod h1:d5qo2mpovqKoi47hrMxj5BLdLzOXM0mUHL5CKrjfWNM= -go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= -go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= -go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= -go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= -go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= -go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 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/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No= -golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 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-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f h1:Vn+VyHU5guc9KjB5KrjI2q0wCOWEOIh0OEsleqakHJg= google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= 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 10/10] 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) {