-
Notifications
You must be signed in to change notification settings - Fork 421
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-12989 Reduce error logs from diagnostic data on arbiter nodes #820
Conversation
Also, update actions workflow to output docker logs on failure
479139d
to
3ed4e27
Compare
- 3 Instances for shard 1 at ports 17001, 17002, 17003 (with no authentication) | ||
- 3 instances for shard 2 at ports 17004, 17005, 17006 (with authentication enabled) |
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.
👍
logger.Errorf("failed to run command: getCmdLineOptions: %s", err) | ||
} else if securityMetric != nil { | ||
metrics = append(metrics, securityMetric) | ||
} | ||
} | ||
|
||
if d.compatibleMode { |
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.
at this point m
might be empty, so it makes not much sense to call lines https://github.com/percona/mongodb_exporter/pull/820/files#diff-f08bb8e2230b960e7f7941dbdf020e3aa607391de1dc0f8683c315265d77b2f6R112-R116
I would include them to else part of the statement above
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.
BTW can we get diagnostic data from mongos?
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.
BTW can we get diagnostic data from mongos?
No actually, the command won't fail, but m["data"]
will be empty.
exporter/v1_compatibility.go
Outdated
if engine, err := storageEngine(m); err != nil { | ||
l.Errorf("cannot retrieve engine type: %s", err) | ||
} else { |
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.
do we know when we can't retrieve engine? it's important to not just hide an error, but hide it only for reason.
metrics = append(metrics, hm...) | ||
} | ||
} else { | ||
if nodeType != typeArbiter { |
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 nodeType != typeArbiter
has complex nested blocks (complexity: 5) (nestif)
exporter/v1_compatibility.go
Outdated
@@ -782,7 +782,7 @@ | |||
} | |||
} | |||
|
|||
func specialMetrics(ctx context.Context, client *mongo.Client, m bson.M, l *logrus.Logger) []prometheus.Metric { | |||
func specialMetrics(ctx context.Context, client *mongo.Client, m bson.M, nodeType mongoDBNodeType, l *logrus.Logger) []prometheus.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 🐶
calculated cyclomatic complexity for function specialMetrics is 12, max is 10 (cyclop)
4f1f516
to
5dd6a44
Compare
exporter/v1_compatibility.go
Outdated
@@ -782,7 +782,7 @@ func specialMetricDefinitions() []specialMetric { | |||
} | |||
} | |||
|
|||
func specialMetrics(ctx context.Context, client *mongo.Client, m bson.M, l *logrus.Logger) []prometheus.Metric { | |||
func specialMetrics(ctx context.Context, client *mongo.Client, m bson.M, nodeType mongoDBNodeType, l *logrus.Logger) []prometheus.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 🐶
calculated cyclomatic complexity for function specialMetrics is 11, max is 10 (cyclop)
var metrics []prometheus.Metric | ||
cmd := bson.D{{Key: "getDiagnosticData", Value: "1"}} | ||
res := client.Database("admin").RunCommand(d.ctx, cmd) | ||
if nodeType != typeArbiter { |
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 nodeType != typeArbiter
has complex nested blocks (complexity: 16) (nestif)
@@ -782,7 +782,7 @@ func specialMetricDefinitions() []specialMetric { | |||
} | |||
} | |||
|
|||
func specialMetrics(ctx context.Context, client *mongo.Client, m bson.M, l *logrus.Entry) []prometheus.Metric { | |||
func specialMetrics(ctx context.Context, client *mongo.Client, m bson.M, nodeType mongoDBNodeType, l *logrus.Entry) []prometheus.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 🐶
calculated cyclomatic complexity for function specialMetrics is 11, max is 10 (cyclop)
PMM-12989 (optional, if ticket reported)
Below we provide a basic checklist of things that would make it a good PR:
Once all checks pass and the code is ready for review, please add
pmm-review-exporters
team as the reviewer. That would assign people from the review team automatically. Report any issues on our Forum.