Skip to content

Commit

Permalink
write out error log when PrepareGraphDefs returnes PluginFaultError
Browse files Browse the repository at this point in the history
  • Loading branch information
rmatsuoka committed Nov 18, 2024
1 parent b82d1ab commit 52338c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package agent

import (
"context"
"errors"
"time"

"github.com/mackerelio/mackerel-agent/checks"
Expand Down Expand Up @@ -98,7 +99,11 @@ func (agent *Agent) CollectGraphDefsOfPlugins() []*mkr.GraphDefsParam {

for _, g := range agent.PluginGenerators {
p, err := g.PrepareGraphDefs()
if err != nil {

var faultError *metrics.PluginFaultError
if errors.As(err, &faultError) {
logger.Errorf("Failed to fetch meta information from plugin %v; seems that the plugin has a bug: %v", g, err)
} else if err != nil {
logger.Debugf("Failed to fetch meta information from plugin %v (non critical); seems that this plugin does not have meta information: %v", g, err)
}
if p != nil {
Expand Down

0 comments on commit 52338c7

Please sign in to comment.