-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PMM-8646 postgres_exporter on stalled after intermittent connection latency. #48
Conversation
PMM-2705: Add security code. Rebrand exporter.
Test with all PostgreSQL versions README claims are supported.
…ds-for-PostgreSQL PMM-3436 investigate some dashboards for PostgreSQL
# Conflicts: # .travis.yml # Makefile # README.md # cmd/postgres_exporter/pg_setting.go # cmd/postgres_exporter/postgres_exporter.go # cmd/postgres_exporter/postgres_exporter_integration_test.go
PMM-3905 Port upstream changes.
PMM-3154 adding example
- Added Go 1.13.x - Made it skip non-trunk PMM-XXXX branch builds, but still build pull requests.
PMM-5192 Remove go1.12 from .travis.yml
PMM-6213 Remove go 1.13 from travis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci-lint
cmd/postgres_exporter/main.go|62| line is 196 characters (lll)
cmd/postgres_exporter/main.go|63| line is 194 characters (lll)
cmd/postgres_exporter/namespace.go|106| line is 149 characters (lll)
cmd/postgres_exporter/namespace.go|112| line is 142 characters (lll)
cmd/postgres_exporter/namespace.go|117| line is 155 characters (lll)
cmd/postgres_exporter/namespace.go|135| line is 173 characters (lll)
cmd/postgres_exporter/namespace.go|141| line is 141 characters (lll)
cmd/postgres_exporter/namespace.go|146| line is 175 characters (lll)
cmd/postgres_exporter/namespace.go|158| line is 166 characters (lll)
cmd/postgres_exporter/namespace.go|173| line is 155 characters (lll)
cmd/postgres_exporter/namespace.go|96 col 4| if ok
is deeply nested (complexity: 23) (nestif)
cmd/postgres_exporter/datasource.go|98 col 2| if len(dsn) == 0
is deeply nested (complexity: 12) (nestif)
cmd/postgres_exporter/queries.go|255 col 75| addQueries - result 0 (error) is always nil (unparam)
cmd/postgres_exporter/datasource.go|38 col 3| only one cuddle assignment allowed before if statement (wsl)
cmd/postgres_exporter/datasource.go|49 col 3| if statements should only be cuddled with assignments (wsl)
cmd/postgres_exporter/datasource.go|57 col 4| assignments should only be cuddled with other assignments (wsl)
cmd/postgres_exporter/datasource.go|53 col 3| only one cuddle assignment allowed before range statement (wsl)
cmd/postgres_exporter/datasource.go|29 col 2| ranges should only be cuddled with assignments used in the iteration (wsl)
cmd/postgres_exporter/datasource.go|64 col 2| only one cuddle assignment allowed before range statement (wsl)
cmd/postgres_exporter/datasource.go|100 col 3| declarations should never be cuddled (wsl)
cmd/postgres_exporter/datasource.go|101 col 3| declarations should never be cuddled (wsl)
cmd/postgres_exporter/datasource.go|108 col 4| assignments should only be cuddled with other assignments (wsl)
cmd/postgres_exporter/datasource.go|118 col 4| assignments should only be cuddled with other assignments (wsl)
cmd/postgres_exporter/datasource.go|139 col 2| return statements should not be cuddled if block has more than two lines (wsl)
cmd/postgres_exporter/namespace.go|43 col 2| declarations should never be cuddled (wsl)
cmd/postgres_exporter/namespace.go|52 col 2| if statements should only be cuddled with assignments (wsl)
cmd/postgres_exporter/namespace.go|59 col 2| only one cuddle assignment allowed before if statement (wsl)
cmd/postgres_exporter/namespace.go|71 col 2| only one cuddle assignment allowed before range statement (wsl)
cmd/postgres_exporter/namespace.go|105 col 6| only one cuddle assignment allowed before if statement (wsl)
cmd/postgres_exporter/namespace.go|121 col 6| ranges should only be cuddled with assignments used in the iteration (wsl)
cmd/postgres_exporter/namespace.go|178 col 4| append only allowed to cuddle with appended value (wsl)
cmd/postgres_exporter/namespace.go|181 col 2| return statements should not be cuddled if block has more than two lines (wsl)
cmd/postgres_exporter/queries.go|190 col 5| branch statements should not be cuddled if block has more than two lines (wsl)
cmd/postgres_exporter/queries.go|304 col 3| append only allowed to cuddle with appended value (wsl)
cmd/postgres_exporter/server.go|174 col 4| branch statements should not be cuddled if block has more than two lines (wsl)
cmd/postgres_exporter/server.go|158 col 2| for statement without condition should never be cuddled (wsl)
cmd/postgres_exporter/util.go|41 col 2| only one cuddle assignment allowed before switch statement (wsl)
cmd/postgres_exporter/util.go|72 col 1| calculated cyclomatic complexity for function dbToFloat64 is 12, max is 10 (cyclop)
cmd/postgres_exporter/util.go|110 col 1| calculated cyclomatic complexity for function dbToUint64 is 13, max is 10 (cyclop)
cmd/postgres_exporter/namespace.go|53 col 119| non-wrapping format verb for fmt.Errorf. Use %w
to format errors (errorlint)
cmd/postgres_exporter/main.go|140 col 48| PidFn, Namespace, ReportErrors are missing in ProcessCollectorOpts (exhaustivestruct)
cmd/postgres_exporter/server.go|76 col 8| runonserver, lastMapVersion, metricMap, queryOverrides, mappingMtx, cacheMtx are missing in Server (exhaustivestruct)
cmd/postgres_exporter/server.go|143 col 10| m is missing in Servers (exhaustivestruct)
cmd/postgres_exporter/main.go|29 col 5| Branch is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|32 col 5| BuildDate is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|35 col 5| Revision is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|39 col 5| Version is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|42 col 5| VersionShort is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|52 col 2| onlyDumpMaps is a global variable (gochecknoglobals)
cmd/postgres_exporter/queries.go|50 col 5| queryOverrides is a global variable (gochecknoglobals)
cmd/postgres_exporter/namespace.go|60 col 44| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("Error retrieving column list for: ", namespace, err))" (goerr113)
cmd/postgres_exporter/namespace.go|82 col 45| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("Error retrieving rows:", namespace, err))" (goerr113)
cmd/postgres_exporter/namespace.go|130 col 47| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("Missing column: ", namespace, columnName+"_sum"))" (goerr113)
cmd/postgres_exporter/queries.go|302 col 16| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("Error retrieving rows:", err))" (goerr113)
cmd/postgres_exporter/queries.go|308 col 15| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("error retrieving rows:", err))" (goerr113)
cmd/postgres_exporter/server.go|128 col 9| err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("queryNamespaceMappings returned %d errors", len(errMap))" (goerr113)
cmd/postgres_exporter/util.go|64 col 9| err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("wrong ColumnUsage given : %s", s)" (goerr113)
cmd/postgres_exporter/util.go|183 col 15| err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("malformed dsn %q", dsn)" (goerr113)
cmd/postgres_exporter/util.go|182 col 23| mnd: Magic number: 2, in detected (gomnd)
cmd/postgres_exporter/queries.go|258 col 3| error is not nil (line 256) but it returns nil (nilerr)
cmd/postgres_exporter/datasource.go|33 col 4| continue with no blank line before (nlreturn)
cmd/postgres_exporter/datasource.go|40 col 4| continue with no blank line before (nlreturn)
cmd/postgres_exporter/datasource.go|51 col 4| continue with no blank line before (nlreturn)
cmd/postgres_exporter/main.go|99 col 3| return with no blank line before (nlreturn)
cmd/postgres_exporter/namespace.go|48 col 30| rows.Err must be checked (rowserrcheck)
cmd/postgres_exporter/namespace.go|50 col 30| rows.Err must be checked (rowserrcheck)
cmd/postgres_exporter/queries.go|31 col 25| yaml(camel): got 'cache_seconds' want 'cacheSeconds' (tagliatelle)
cmd/postgres_exporter/queries.go|207 col 20| error returned from external package is unwrapped: sig: func gopkg.in/yaml.v2.Unmarshal(in []byte, out interface{}) (err error) (wrapcheck)
cmd/postgres_exporter/server.go|69 col 15| error returned from external package is unwrapped: sig: func database/sql.Open(driverName string, dataSourceName string) (*database/sql.DB, error) (wrapcheck)
cmd/postgres_exporter/server.go|94 col 9| error returned from external package is unwrapped: sig: func (*database/sql.DB).Close() error (wrapcheck)
cmd/postgres_exporter/queries.go|26 col 1| directive // nolint: golint
is unused for linter "golint" (nolintlint)
cmd/postgres_exporter/queries.go|36 col 1| directive // nolint: golint
is unused for linter "golint" (nolintlint)
cmd/postgres_exporter/main.go
Outdated
disableDefaultMetrics = kingpin.Flag("disable-default-metrics", "Do not include default metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_DEFAULT_METRICS").Bool() | ||
disableSettingsMetrics = kingpin.Flag("disable-settings-metrics", "Do not include pg_settings metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_SETTINGS_METRICS").Bool() | ||
autoDiscoverDatabases = kingpin.Flag("auto-discover-databases", "Whether to discover the databases on a server dynamically.").Default("false").Envar("PG_EXPORTER_AUTO_DISCOVER_DATABASES").Bool() | ||
queriesPath = kingpin.Flag("extend.query-path", "Path to custom queries to run.").Default("").Envar("PG_EXPORTER_EXTEND_QUERY_PATH").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶queriesPath
is unused (deadcode)
cmd/postgres_exporter/main.go
Outdated
constantLabelsList = kingpin.Flag("constantLabels", "A list of label=value separated by comma(,).").Default("").Envar("PG_EXPORTER_CONSTANT_LABELS").String() | ||
excludeDatabases = kingpin.Flag("exclude-databases", "A list of databases to remove when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_EXCLUDE_DATABASES").String() | ||
includeDatabases = kingpin.Flag("include-databases", "A list of databases to include when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_INCLUDE_DATABASES").String() | ||
metricPrefix = kingpin.Flag("metric-prefix", "A metric prefix can be used to have non-default (not \"pg\") prefixes for each of the metrics").Default("pg").Envar("PG_EXPORTER_METRIC_PREFIX").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶metricPrefix
is unused (deadcode)
includeDatabases = kingpin.Flag("include-databases", "A list of databases to include when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_INCLUDE_DATABASES").String() | ||
metricPrefix = kingpin.Flag("metric-prefix", "A metric prefix can be used to have non-default (not \"pg\") prefixes for each of the metrics").Default("pg").Envar("PG_EXPORTER_METRIC_PREFIX").String() | ||
logger = log.NewNopLogger() | ||
collectCustomQueryLr = kingpin.Flag("collect.custom_query.lr", "Enable custom queries with low resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_LR").Bool() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 192 characters (lll)
metricPrefix = kingpin.Flag("metric-prefix", "A metric prefix can be used to have non-default (not \"pg\") prefixes for each of the metrics").Default("pg").Envar("PG_EXPORTER_METRIC_PREFIX").String() | ||
logger = log.NewNopLogger() | ||
collectCustomQueryLr = kingpin.Flag("collect.custom_query.lr", "Enable custom queries with low resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_LR").Bool() | ||
collectCustomQueryMr = kingpin.Flag("collect.custom_query.mr", "Enable custom queries with medium resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_MR").Bool() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 195 characters (lll)
logger = log.NewNopLogger() | ||
collectCustomQueryLr = kingpin.Flag("collect.custom_query.lr", "Enable custom queries with low resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_LR").Bool() | ||
collectCustomQueryMr = kingpin.Flag("collect.custom_query.mr", "Enable custom queries with medium resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_MR").Bool() | ||
collectCustomQueryHr = kingpin.Flag("collect.custom_query.hr", "Enable custom queries with high resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_HR").Bool() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 193 characters (lll)
collectCustomQueryLr = kingpin.Flag("collect.custom_query.lr", "Enable custom queries with low resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_LR").Bool() | ||
collectCustomQueryMr = kingpin.Flag("collect.custom_query.mr", "Enable custom queries with medium resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_MR").Bool() | ||
collectCustomQueryHr = kingpin.Flag("collect.custom_query.hr", "Enable custom queries with high resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_HR").Bool() | ||
collectCustomQueryLrDirectory = kingpin.Flag("collect.custom_query.lr.directory", "Path to custom queries with low resolution directory.").Envar("PG_EXPORTER_EXTEND_QUERY_LR_PATH").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 193 characters (lll)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci-lint
cmd/postgres_exporter/namespace.go|178 col 4| append only allowed to cuddle with appended value (wsl)
cmd/postgres_exporter/namespace.go|181 col 2| return statements should not be cuddled if block has more than two lines (wsl)
cmd/postgres_exporter/queries.go|190 col 5| branch statements should not be cuddled if block has more than two lines (wsl)
cmd/postgres_exporter/queries.go|304 col 3| append only allowed to cuddle with appended value (wsl)
cmd/postgres_exporter/server.go|174 col 4| branch statements should not be cuddled if block has more than two lines (wsl)
cmd/postgres_exporter/server.go|158 col 2| for statement without condition should never be cuddled (wsl)
cmd/postgres_exporter/util.go|41 col 2| only one cuddle assignment allowed before switch statement (wsl)
cmd/postgres_exporter/util.go|72 col 1| calculated cyclomatic complexity for function dbToFloat64 is 12, max is 10 (cyclop)
cmd/postgres_exporter/util.go|110 col 1| calculated cyclomatic complexity for function dbToUint64 is 13, max is 10 (cyclop)
cmd/postgres_exporter/namespace.go|53 col 119| non-wrapping format verb for fmt.Errorf. Use %w
to format errors (errorlint)
cmd/postgres_exporter/main.go|140 col 48| PidFn, Namespace, ReportErrors are missing in ProcessCollectorOpts (exhaustivestruct)
cmd/postgres_exporter/server.go|76 col 8| runonserver, lastMapVersion, metricMap, queryOverrides, mappingMtx, cacheMtx are missing in Server (exhaustivestruct)
cmd/postgres_exporter/server.go|143 col 10| m is missing in Servers (exhaustivestruct)
cmd/postgres_exporter/main.go|29 col 5| Branch is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|32 col 5| BuildDate is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|35 col 5| Revision is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|39 col 5| Version is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|42 col 5| VersionShort is a global variable (gochecknoglobals)
cmd/postgres_exporter/main.go|52 col 2| onlyDumpMaps is a global variable (gochecknoglobals)
cmd/postgres_exporter/queries.go|50 col 5| queryOverrides is a global variable (gochecknoglobals)
cmd/postgres_exporter/namespace.go|60 col 44| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("Error retrieving column list for: ", namespace, err))" (goerr113)
cmd/postgres_exporter/namespace.go|82 col 45| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("Error retrieving rows:", namespace, err))" (goerr113)
cmd/postgres_exporter/namespace.go|130 col 47| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("Missing column: ", namespace, columnName+"_sum"))" (goerr113)
cmd/postgres_exporter/queries.go|302 col 16| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("Error retrieving rows:", err))" (goerr113)
cmd/postgres_exporter/queries.go|308 col 15| err113: do not define dynamic errors, use wrapped static errors instead: "errors.New(fmt.Sprintln("error retrieving rows:", err))" (goerr113)
cmd/postgres_exporter/server.go|128 col 9| err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("queryNamespaceMappings returned %d errors", len(errMap))" (goerr113)
cmd/postgres_exporter/util.go|64 col 9| err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("wrong ColumnUsage given : %s", s)" (goerr113)
cmd/postgres_exporter/util.go|183 col 15| err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("malformed dsn %q", dsn)" (goerr113)
cmd/postgres_exporter/util.go|182 col 23| mnd: Magic number: 2, in detected (gomnd)
cmd/postgres_exporter/queries.go|258 col 3| error is not nil (line 256) but it returns nil (nilerr)
cmd/postgres_exporter/datasource.go|33 col 4| continue with no blank line before (nlreturn)
cmd/postgres_exporter/datasource.go|40 col 4| continue with no blank line before (nlreturn)
cmd/postgres_exporter/datasource.go|51 col 4| continue with no blank line before (nlreturn)
cmd/postgres_exporter/main.go|99 col 3| return with no blank line before (nlreturn)
cmd/postgres_exporter/namespace.go|48 col 30| rows.Err must be checked (rowserrcheck)
cmd/postgres_exporter/namespace.go|50 col 30| rows.Err must be checked (rowserrcheck)
cmd/postgres_exporter/queries.go|31 col 25| yaml(camel): got 'cache_seconds' want 'cacheSeconds' (tagliatelle)
cmd/postgres_exporter/queries.go|207 col 20| error returned from external package is unwrapped: sig: func gopkg.in/yaml.v2.Unmarshal(in []byte, out interface{}) (err error) (wrapcheck)
cmd/postgres_exporter/server.go|69 col 15| error returned from external package is unwrapped: sig: func database/sql.Open(driverName string, dataSourceName string) (*database/sql.DB, error) (wrapcheck)
cmd/postgres_exporter/server.go|94 col 9| error returned from external package is unwrapped: sig: func (*database/sql.DB).Close() error (wrapcheck)
cmd/postgres_exporter/queries.go|26 col 1| directive // nolint: golint
is unused for linter "golint" (nolintlint)
cmd/postgres_exporter/queries.go|36 col 1| directive // nolint: golint
is unused for linter "golint" (nolintlint)
collectCustomQueryMr = kingpin.Flag("collect.custom_query.mr", "Enable custom queries with medium resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_MR").Bool() | ||
collectCustomQueryHr = kingpin.Flag("collect.custom_query.hr", "Enable custom queries with high resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_HR").Bool() | ||
collectCustomQueryLrDirectory = kingpin.Flag("collect.custom_query.lr.directory", "Path to custom queries with low resolution directory.").Envar("PG_EXPORTER_EXTEND_QUERY_LR_PATH").String() | ||
collectCustomQueryMrDirectory = kingpin.Flag("collect.custom_query.mr.directory", "Path to custom queries with medium resolution directory.").Envar("PG_EXPORTER_EXTEND_QUERY_MR_PATH").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 196 characters (lll)
collectCustomQueryHr = kingpin.Flag("collect.custom_query.hr", "Enable custom queries with high resolution directory.").Default("false").Envar("PG_EXPORTER_EXTEND_QUERY_HR").Bool() | ||
collectCustomQueryLrDirectory = kingpin.Flag("collect.custom_query.lr.directory", "Path to custom queries with low resolution directory.").Envar("PG_EXPORTER_EXTEND_QUERY_LR_PATH").String() | ||
collectCustomQueryMrDirectory = kingpin.Flag("collect.custom_query.mr.directory", "Path to custom queries with medium resolution directory.").Envar("PG_EXPORTER_EXTEND_QUERY_MR_PATH").String() | ||
collectCustomQueryHrDirectory = kingpin.Flag("collect.custom_query.hr.directory", "Path to custom queries with high resolution directory.").Envar("PG_EXPORTER_EXTEND_QUERY_HR_PATH").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 194 characters (lll)
cmd/postgres_exporter/namespace.go
Outdated
var keys []float64 | ||
err = pq.Array(&keys).Scan(columnData[idx]) | ||
if err != nil { | ||
return []prometheus.Metric{}, []error{}, errors.New(fmt.Sprintln("Error retrieving", columnName, "buckets:", namespace, err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 149 characters (lll)
cmd/postgres_exporter/namespace.go
Outdated
var values []int64 | ||
valuesIdx, ok := columnIdx[columnName+"_bucket"] | ||
if !ok { | ||
nonfatalErrors = append(nonfatalErrors, errors.New(fmt.Sprintln("Missing column: ", namespace, columnName+"_bucket"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 142 characters (lll)
cmd/postgres_exporter/namespace.go
Outdated
} | ||
err = pq.Array(&values).Scan(columnData[valuesIdx]) | ||
if err != nil { | ||
return []prometheus.Metric{}, []error{}, errors.New(fmt.Sprintln("Error retrieving", columnName, "bucket values:", namespace, err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 155 characters (lll)
cmd/postgres_exporter/namespace.go
Outdated
} else { | ||
rows, err = server.db.Query(query) | ||
} | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
if statements should only be cuddled with assignments (wsl)
cmd/postgres_exporter/namespace.go
Outdated
|
||
var columnNames []string | ||
columnNames, err = rows.Columns() | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
only one cuddle assignment allowed before if statement (wsl)
cmd/postgres_exporter/namespace.go
Outdated
|
||
var columnData = make([]interface{}, len(columnNames)) | ||
var scanArgs = make([]interface{}, len(columnNames)) | ||
for i := range columnData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
cmd/postgres_exporter/namespace.go
Outdated
if metricMapping.histogram { | ||
var keys []float64 | ||
err = pq.Array(&keys).Scan(columnData[idx]) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
only one cuddle assignment allowed before if statement (wsl)
cmd/postgres_exporter/namespace.go
Outdated
} | ||
|
||
buckets := make(map[float64]uint64, len(keys)) | ||
for i, key := range keys { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci-lint
cmd/postgres_exporter/datasource.go|33 col 4| continue with no blank line before (nlreturn)
cmd/postgres_exporter/datasource.go|40 col 4| continue with no blank line before (nlreturn)
cmd/postgres_exporter/datasource.go|51 col 4| continue with no blank line before (nlreturn)
cmd/postgres_exporter/main.go|99 col 3| return with no blank line before (nlreturn)
cmd/postgres_exporter/namespace.go|48 col 30| rows.Err must be checked (rowserrcheck)
cmd/postgres_exporter/namespace.go|50 col 30| rows.Err must be checked (rowserrcheck)
cmd/postgres_exporter/queries.go|31 col 25| yaml(camel): got 'cache_seconds' want 'cacheSeconds' (tagliatelle)
cmd/postgres_exporter/queries.go|207 col 20| error returned from external package is unwrapped: sig: func gopkg.in/yaml.v2.Unmarshal(in []byte, out interface{}) (err error) (wrapcheck)
cmd/postgres_exporter/server.go|69 col 15| error returned from external package is unwrapped: sig: func database/sql.Open(driverName string, dataSourceName string) (*database/sql.DB, error) (wrapcheck)
cmd/postgres_exporter/server.go|94 col 9| error returned from external package is unwrapped: sig: func (*database/sql.DB).Close() error (wrapcheck)
cmd/postgres_exporter/queries.go|26 col 1| directive // nolint: golint
is unused for linter "golint" (nolintlint)
cmd/postgres_exporter/queries.go|36 col 1| directive // nolint: golint
is unused for linter "golint" (nolintlint)
cmd/postgres_exporter/namespace.go
Outdated
} | ||
metric = prometheus.MustNewConstMetric(desc, prometheus.UntypedValue, value, labels...) | ||
} | ||
metrics = append(metrics, metric) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
cmd/postgres_exporter/namespace.go
Outdated
metrics = append(metrics, metric) | ||
} | ||
} | ||
return metrics, nonfatalErrors, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
return statements should not be cuddled if block has more than two lines (wsl)
cmd/postgres_exporter/queries.go
Outdated
if queryDef.versionRange(pgVersion) { | ||
resultMap[name] = queryDef.query | ||
matched = true | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
branch statements should not be cuddled if block has more than two lines (wsl)
if err != nil { | ||
return nil, errors.New(fmt.Sprintln("Error retrieving rows:", err)) | ||
} | ||
result = append(result, databaseName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
cmd/postgres_exporter/server.go
Outdated
if err = server.Ping(); err != nil { | ||
delete(s.servers, dsn) | ||
time.Sleep(time.Duration(errCount) * time.Second) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
branch statements should not be cuddled if block has more than two lines (wsl)
cmd/postgres_exporter/server.go
Outdated
|
||
errMap := queryNamespaceMappings(ch, s) | ||
if len(errMap) > 0 { | ||
err = fmt.Errorf("queryNamespaceMappings returned %d errors", len(errMap)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("queryNamespaceMappings returned %d errors", len(errMap))" (goerr113)
cmd/postgres_exporter/util.go
Outdated
u = DURATION | ||
|
||
default: | ||
err = fmt.Errorf("wrong ColumnUsage given : %s", s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("wrong ColumnUsage given : %s", s)" (goerr113)
cmd/postgres_exporter/util.go
Outdated
for _, pair := range pairs { | ||
splitted := strings.SplitN(pair, "=", 2) | ||
if len(splitted) != 2 { | ||
return "", fmt.Errorf("malformed dsn %q", dsn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("malformed dsn %q", dsn)" (goerr113)
cmd/postgres_exporter/util.go
Outdated
kv := make(map[string]string, len(pairs)) | ||
for _, pair := range pairs { | ||
splitted := strings.SplitN(pair, "=", 2) | ||
if len(splitted) != 2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
mnd: Magic number: 2, in detected (gomnd)
func addQueries(content []byte, pgVersion semver.Version, server *Server) error { | ||
metricMaps, newQueryOverrides, err := parseUserQueries(content) | ||
if err != nil { | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
error is not nil (line 256) but it returns nil (nilerr)
parsedDSN, err := url.Parse(dsn) | ||
if err != nil { | ||
log.Errorf("Unable to parse DSN (%s): %v", loggableDSN(dsn), err) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
continue with no blank line before (nlreturn)
server, err := e.servers.GetServer(dsn) | ||
if err != nil { | ||
log.Errorf("Error opening connection to database (%s): %v", loggableDSN(dsn), err) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
continue with no blank line before (nlreturn)
server.mappingMtx.Unlock() | ||
if err != nil { | ||
log.Errorf("Error querying databases (%s): %v", loggableDSN(dsn), err) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
continue with no blank line before (nlreturn)
|
||
if *onlyDumpMaps { | ||
dumpMaps() | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
return with no blank line before (nlreturn)
cmd/postgres_exporter/namespace.go
Outdated
if !found { | ||
// I've no idea how to avoid this properly at the moment, but this is | ||
// an admin tool so you're not injecting SQL right? | ||
rows, err = server.db.Query(fmt.Sprintf("SELECT * FROM %s;", namespace)) // nolint: gas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
rows.Err must be checked (rowserrcheck)
cmd/postgres_exporter/queries.go
Outdated
|
||
err := yaml.Unmarshal(content, &userQueries) | ||
if err != nil { | ||
return nil, nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
error returned from external package is unwrapped: sig: func gopkg.in/yaml.v2.Unmarshal(in []byte, out interface{}) (err error) (wrapcheck)
|
||
db, err := sql.Open("postgres", dsn) | ||
if err != nil { | ||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
error returned from external package is unwrapped: sig: func database/sql.Open(driverName string, dataSourceName string) (*database/sql.DB, error) (wrapcheck)
cmd/postgres_exporter/server.go
Outdated
|
||
// Close disconnects from Postgres. | ||
func (s *Server) Close() error { | ||
return s.db.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
error returned from external package is unwrapped: sig: func (*database/sql.DB).Close() error (wrapcheck)
) | ||
|
||
// UserQuery represents a user defined query | ||
// nolint: golint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
directive // nolint: golint
is unused for linter "golint" (nolintlint)
} | ||
|
||
// UserQueries represents a set of UserQuery objects | ||
// nolint: golint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
directive // nolint: golint
is unused for linter "golint" (nolintlint)
|
||
var ( | ||
listenAddress = kingpin.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9187").Envar("PG_EXPORTER_WEB_LISTEN_ADDRESS").String() | ||
//webConfig = webflag.AddFlags(kingpin.CommandLine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
commentFormatting: put a space between //
and comment text (gocritic)
disableDefaultMetrics = kingpin.Flag("disable-default-metrics", "Do not include default metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_DEFAULT_METRICS").Bool() | ||
disableSettingsMetrics = kingpin.Flag("disable-settings-metrics", "Do not include pg_settings metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_SETTINGS_METRICS").Bool() | ||
autoDiscoverDatabases = kingpin.Flag("auto-discover-databases", "Whether to discover the databases on a server dynamically.").Default("false").Envar("PG_EXPORTER_AUTO_DISCOVER_DATABASES").Bool() | ||
//queriesPath = kingpin.Flag("extend.query-path", "Path to custom queries to run.").Default("").Envar("PG_EXPORTER_EXTEND_QUERY_PATH").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
commentFormatting: put a space between //
and comment text (gocritic)
onlyDumpMaps = kingpin.Flag("dumpmaps", "Do not run, simply dump the maps.").Bool() | ||
constantLabelsList = kingpin.Flag("constantLabels", "A list of label=value separated by comma(,).").Default("").Envar("PG_EXPORTER_CONSTANT_LABELS").String() | ||
excludeDatabases = kingpin.Flag("exclude-databases", "A list of databases to remove when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_EXCLUDE_DATABASES").String() | ||
//includeDatabases = kingpin.Flag("include-databases", "A list of databases to include when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_INCLUDE_DATABASES").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
commentFormatting: put a space between //
and comment text (gocritic)
excludeDatabases = kingpin.Flag("exclude-databases", "A list of databases to remove when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_EXCLUDE_DATABASES").String() | ||
//includeDatabases = kingpin.Flag("include-databases", "A list of databases to include when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_INCLUDE_DATABASES").String() | ||
//metricPrefix = kingpin.Flag("metric-prefix", "A metric prefix can be used to have non-default (not \"pg\") prefixes for each of the metrics").Default("pg").Envar("PG_EXPORTER_METRIC_PREFIX").String() | ||
//logger = log.NewNopLogger() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
Comment should end in a period (godot)
var VersionShort = "0.0.1" | ||
|
||
var ( | ||
listenAddress = kingpin.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9187").Envar("PG_EXPORTER_WEB_LISTEN_ADDRESS").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 177 characters (lll)
disableSettingsMetrics = kingpin.Flag("disable-settings-metrics", "Do not include pg_settings metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_SETTINGS_METRICS").Bool() | ||
autoDiscoverDatabases = kingpin.Flag("auto-discover-databases", "Whether to discover the databases on a server dynamically.").Default("false").Envar("PG_EXPORTER_AUTO_DISCOVER_DATABASES").Bool() | ||
//queriesPath = kingpin.Flag("extend.query-path", "Path to custom queries to run.").Default("").Envar("PG_EXPORTER_EXTEND_QUERY_PATH").String() | ||
onlyDumpMaps = kingpin.Flag("dumpmaps", "Do not run, simply dump the maps.").Bool() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
onlyDumpMaps is a global variable (gochecknoglobals)
case []byte: | ||
// Try and convert to string and then parse to a float64 | ||
strV := string(v) | ||
result, err := strconv.ParseFloat(strV, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
mnd: Magic number: 64, in detected (gomnd)
} | ||
return result, true | ||
case string: | ||
result, err := strconv.ParseFloat(v, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
mnd: Magic number: 64, in detected (gomnd)
case []byte: | ||
// Try and convert to string and then parse to a uint64 | ||
strV := string(v) | ||
result, err := strconv.ParseUint(strV, 10, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
mnd: Magic number: 10, in detected (gomnd)
} | ||
return result, true | ||
case string: | ||
result, err := strconv.ParseUint(v, 10, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
mnd: Magic number: 10, in detected (gomnd)
|
||
var ( | ||
listenAddress = kingpin.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9187").Envar("PG_EXPORTER_WEB_LISTEN_ADDRESS").String() | ||
//webConfig = webflag.AddFlags(kingpin.CommandLine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
commentFormatting: put a space between //
and comment text (gocritic)
disableDefaultMetrics = kingpin.Flag("disable-default-metrics", "Do not include default metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_DEFAULT_METRICS").Bool() | ||
disableSettingsMetrics = kingpin.Flag("disable-settings-metrics", "Do not include pg_settings metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_SETTINGS_METRICS").Bool() | ||
autoDiscoverDatabases = kingpin.Flag("auto-discover-databases", "Whether to discover the databases on a server dynamically.").Default("false").Envar("PG_EXPORTER_AUTO_DISCOVER_DATABASES").Bool() | ||
//queriesPath = kingpin.Flag("extend.query-path", "Path to custom queries to run.").Default("").Envar("PG_EXPORTER_EXTEND_QUERY_PATH").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
commentFormatting: put a space between //
and comment text (gocritic)
onlyDumpMaps = kingpin.Flag("dumpmaps", "Do not run, simply dump the maps.").Bool() | ||
constantLabelsList = kingpin.Flag("constantLabels", "A list of label=value separated by comma(,).").Default("").Envar("PG_EXPORTER_CONSTANT_LABELS").String() | ||
excludeDatabases = kingpin.Flag("exclude-databases", "A list of databases to remove when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_EXCLUDE_DATABASES").String() | ||
//includeDatabases = kingpin.Flag("include-databases", "A list of databases to include when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_INCLUDE_DATABASES").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
commentFormatting: put a space between //
and comment text (gocritic)
excludeDatabases = kingpin.Flag("exclude-databases", "A list of databases to remove when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_EXCLUDE_DATABASES").String() | ||
//includeDatabases = kingpin.Flag("include-databases", "A list of databases to include when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_INCLUDE_DATABASES").String() | ||
//metricPrefix = kingpin.Flag("metric-prefix", "A metric prefix can be used to have non-default (not \"pg\") prefixes for each of the metrics").Default("pg").Envar("PG_EXPORTER_METRIC_PREFIX").String() | ||
//logger = log.NewNopLogger() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
Comment should end in a period (godot)
var VersionShort = "0.0.1" | ||
|
||
var ( | ||
listenAddress = kingpin.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9187").Envar("PG_EXPORTER_WEB_LISTEN_ADDRESS").String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 177 characters (lll)
disableSettingsMetrics = kingpin.Flag("disable-settings-metrics", "Do not include pg_settings metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_SETTINGS_METRICS").Bool() | ||
autoDiscoverDatabases = kingpin.Flag("auto-discover-databases", "Whether to discover the databases on a server dynamically.").Default("false").Envar("PG_EXPORTER_AUTO_DISCOVER_DATABASES").Bool() | ||
//queriesPath = kingpin.Flag("extend.query-path", "Path to custom queries to run.").Default("").Envar("PG_EXPORTER_EXTEND_QUERY_PATH").String() | ||
onlyDumpMaps = kingpin.Flag("dumpmaps", "Do not run, simply dump the maps.").Bool() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
onlyDumpMaps is a global variable (gochecknoglobals)
case []byte: | ||
// Try and convert to string and then parse to a float64 | ||
strV := string(v) | ||
result, err := strconv.ParseFloat(strV, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
mnd: Magic number: 64, in detected (gomnd)
} | ||
return result, true | ||
case string: | ||
result, err := strconv.ParseFloat(v, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
mnd: Magic number: 64, in detected (gomnd)
case []byte: | ||
// Try and convert to string and then parse to a uint64 | ||
strV := string(v) | ||
result, err := strconv.ParseUint(strV, 10, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
mnd: Magic number: 10, in detected (gomnd)
} | ||
return result, true | ||
case string: | ||
result, err := strconv.ParseUint(v, 10, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
mnd: Magic number: 10, in detected (gomnd)
Our exporter merged with upstream one. Remains fix many lint errors to pass build and then test new functionality.