From 0b883f6e344e1a0a7ced7c9a77794552b1770886 Mon Sep 17 00:00:00 2001 From: Nurlan Moldomurov Date: Fri, 8 Nov 2024 11:55:38 +0300 Subject: [PATCH] PMM-13416 Fix imports linter. --- api/inventory/v1/{types => }/log_levels.go | 7 +++--- docker-compose.yml | 4 ++++ managed/services/converters.go | 25 +++++++++++----------- managed/services/management/agent.go | 4 ++-- 4 files changed, 21 insertions(+), 19 deletions(-) rename api/inventory/v1/{types => }/log_levels.go (77%) diff --git a/api/inventory/v1/types/log_levels.go b/api/inventory/v1/log_levels.go similarity index 77% rename from api/inventory/v1/types/log_levels.go rename to api/inventory/v1/log_levels.go index e85419e64a..e377714f32 100644 --- a/api/inventory/v1/types/log_levels.go +++ b/api/inventory/v1/log_levels.go @@ -13,15 +13,14 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package types +package inventoryv1 import ( "github.com/AlekSi/pointer" - inventoryv1 "github.com/percona/pmm/api/inventory/v1" "github.com/percona/pmm/utils/enums" ) -func LogLevelAPIValue(l *string) inventoryv1.LogLevel { - return inventoryv1.LogLevel(inventoryv1.LogLevel_value[enums.ConvertEnum("LOG_LEVEL", pointer.Get(l))]) +func LogLevelAPIValue(l *string) LogLevel { + return LogLevel(LogLevel_value[enums.ConvertEnum("LOG_LEVEL", pointer.Get(l))]) } diff --git a/docker-compose.yml b/docker-compose.yml index e7f5554918..8436ae3714 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -90,6 +90,10 @@ services: # caching - go-modules:/root/go/pkg/mod - root-cache:/root/.cache + # grafana +# - "../grafana:/workspace" +# - "../grafana/public:/usr/share/grafana/public" +# - "../grafana/conf/grafana.local-dev.ini:/usr/share/grafana/conf/defaults.ini" # command: > # bash -c " # rm -rf /tmp/certs diff --git a/managed/services/converters.go b/managed/services/converters.go index 41fe35af48..10589cc07f 100644 --- a/managed/services/converters.go +++ b/managed/services/converters.go @@ -27,7 +27,6 @@ import ( "github.com/percona/pmm/api/common" inventoryv1 "github.com/percona/pmm/api/inventory/v1" - "github.com/percona/pmm/api/inventory/v1/types" "github.com/percona/pmm/managed/models" ) @@ -240,7 +239,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro PushMetricsEnabled: agent.PushMetrics, DisabledCollectors: agent.DisabledCollectors, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), ExposeExporter: agent.ExposeExporter, MetricsResolutions: ConvertMetricsResolutions(agent.MetricsResolutions), }, nil @@ -263,7 +262,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro PushMetricsEnabled: agent.PushMetrics, DisabledCollectors: agent.DisabledCollectors, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), ExposeExporter: agent.ExposeExporter, MetricsResolutions: ConvertMetricsResolutions(agent.MetricsResolutions), }, nil @@ -283,7 +282,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro PushMetricsEnabled: agent.PushMetrics, DisabledCollectors: agent.DisabledCollectors, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), ExposeExporter: agent.ExposeExporter, MetricsResolutions: ConvertMetricsResolutions(agent.MetricsResolutions), } @@ -309,7 +308,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro PushMetricsEnabled: agent.PushMetrics, DisabledCollectors: agent.DisabledCollectors, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), ExposeExporter: agent.ExposeExporter, MetricsResolutions: ConvertMetricsResolutions(agent.MetricsResolutions), } @@ -333,7 +332,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro QueryExamplesDisabled: agent.QueryExamplesDisabled, DisableCommentsParsing: agent.CommentsParsingDisabled, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), }, nil case models.QANMySQLSlowlogAgentType: @@ -351,7 +350,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro DisableCommentsParsing: agent.CommentsParsingDisabled, MaxSlowlogFileSize: agent.MaxQueryLogSize, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), }, nil case models.QANMongoDBProfilerAgentType: @@ -367,7 +366,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro TlsSkipVerify: agent.TLSSkipVerify, MaxQueryLength: agent.MaxQueryLength, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), // TODO QueryExamplesDisabled https://jira.percona.com/browse/PMM-4650 }, nil @@ -386,7 +385,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro PushMetricsEnabled: agent.PushMetrics, DisabledCollectors: agent.DisabledCollectors, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), ExposeExporter: agent.ExposeExporter, MetricsResolutions: ConvertMetricsResolutions(agent.MetricsResolutions), }, nil @@ -405,7 +404,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro Tls: agent.TLS, TlsSkipVerify: agent.TLSSkipVerify, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), }, nil case models.QANPostgreSQLPgStatMonitorAgentType: @@ -423,7 +422,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro QueryExamplesDisabled: agent.QueryExamplesDisabled, DisableCommentsParsing: agent.CommentsParsingDisabled, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), }, nil case models.RDSExporterType: @@ -440,7 +439,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro EnhancedMetricsDisabled: agent.RDSEnhancedMetricsDisabled, PushMetricsEnabled: agent.PushMetrics, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), MetricsResolutions: ConvertMetricsResolutions(agent.MetricsResolutions), }, nil @@ -478,7 +477,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventoryv1.Agent, erro ListenPort: uint32(pointer.GetUint16(agent.ListenPort)), CustomLabels: labels, ProcessExecPath: processExecPath, - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), MetricsResolutions: ConvertMetricsResolutions(agent.MetricsResolutions), }, nil diff --git a/managed/services/management/agent.go b/managed/services/management/agent.go index fea8c48b3e..6d4bf61963 100644 --- a/managed/services/management/agent.go +++ b/managed/services/management/agent.go @@ -26,7 +26,7 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "gopkg.in/reform.v1" - "github.com/percona/pmm/api/inventory/v1/types" + inventoryv1 "github.com/percona/pmm/api/inventory/v1" managementv1 "github.com/percona/pmm/api/management/v1" "github.com/percona/pmm/managed/models" "github.com/percona/pmm/version" @@ -135,7 +135,7 @@ func (s *ManagementService) agentToAPI(agent *models.Agent) (*managementv1.Unive IsAwsSecretKeySet: pointer.GetString(agent.AWSSecretKey) != "", IsPasswordSet: pointer.GetString(agent.Password) != "", ListenPort: uint32(pointer.GetUint16(agent.ListenPort)), - LogLevel: types.LogLevelAPIValue(agent.LogLevel), + LogLevel: inventoryv1.LogLevelAPIValue(agent.LogLevel), MaxQueryLength: agent.MaxQueryLength, MaxQueryLogSize: agent.MaxQueryLogSize, MetricsPath: pointer.GetString(agent.MetricsPath),