[WIP] Added status metrics for gluster daemon and exporter#107
[WIP] Added status metrics for gluster daemon and exporter#107aruniiird wants to merge 4 commits intogluster:masterfrom
Conversation
Signed-off-by: Arun Kumar Mohan <arun.iiird@gmail.com>
Signed-off-by: Arun Kumar Mohan <arun.iiird@gmail.com>
|
@aravindavk @shtripat @sidharthanup |
Signed-off-by: Arun Kumar Mohan <arun.iiird@gmail.com>
|
|
||
| const ( | ||
| // GDaemonLabel provides static label to info/error provided from this metrics | ||
| GDaemonLabel = "Gluster_Daemon_Status" |
There was a problem hiding this comment.
What is the purpose served by this error message label? We are not using such labeling for other error messages. Do we really need this as all the gl-exporter logs go to a separate log file? @aravindavk suggestions?
| } | ||
| } else if conf.GlusterMgmt == glusterutils.MgmtGlusterd2 { | ||
| if conf.Glusterd2Endpoint == "" { | ||
| return errors.New("[" + GDaemonLabel + "] Empty GD2 Endpoint") |
There was a problem hiding this comment.
I feel better to use fmt.Sprintf() for formatting strings.
| if err != nil { | ||
| return errors.New("[" + GDaemonLabel + "] Error: " + err.Error()) | ||
| } | ||
| log.Println("GD Management: ", conf.GlusterMgmt) |
There was a problem hiding this comment.
Remove this. I feel this was added for debugging purpose.
| } | ||
| log.Println("GD Management: ", conf.GlusterMgmt) | ||
| genrlLbls := prometheus.Labels{ | ||
| "name": "Glusterd_Status", |
There was a problem hiding this comment.
I feel we follow all small case separated by underscore so use the same way for uniformity.
| if err != nil { | ||
| log.WithError(err).WithFields(log.Fields{ | ||
| "peer": peerID, | ||
| "name": "Glusterd_Status", |
| "peer": peerID, | ||
| "name": "Glusterd_Status", | ||
| }).Errorln("["+GDaemonLabel+"] Error:", err) | ||
| glusterDaemonStatus.With(genrlLbls).Set(float64(0)) |
| glusterDaemonStatus.With(genrlLbls).Set(float64(1)) | ||
| } | ||
| genrlLbls = prometheus.Labels{ | ||
| "name": "Gluster_Exporter_Status", |
There was a problem hiding this comment.
all small cases separated by underscores?
|
|
||
| // GDConfigFromInterface checks the given interface is compatible with 'GDConfigInterface' | ||
| // and returns a pointer to glusterutils.Config | ||
| func GDConfigFromInterface(iFace interface{}) (*Config, error) { |
There was a problem hiding this comment.
Can you explain the purpose of this change and ideally this should go as part of another infra level PR and not as part of some feature PR.
Fixes: /issues/85