Skip to content
This repository was archived by the owner on May 15, 2023. It is now read-only.

Comments

Added string() to metric labels for printing and added const metric strings.#73

Open
evanSpendlove wants to merge 2 commits intomasterfrom
evan/metricChange
Open

Added string() to metric labels for printing and added const metric strings.#73
evanSpendlove wants to merge 2 commits intomasterfrom
evan/metricChange

Conversation

@evanSpendlove
Copy link
Contributor

No description provided.


// String returns the ProbeOperation as a string.
func (p ProbeOperation) String() string {
return ProbeOpName[p]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: if this is the only usage of ProbeOpName, then make it non-exported.


// String returns the APICall as a string.
func (a APICall) String() string {
return APICallName[a]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

)

func (e ExitStatus) String() string {
return ExitStatusName[e]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

AllFilesMissing: "all_files_missing",
}

ProbeLatency = "hermes_probe_latency_seconds"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ProbeLatencyMetric?

}

ProbeLatency = "hermes_probe_latency_seconds"
APILatency = "hermes_api_latency_Seconds"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

m.ProbeOpLatency[op][e] = metrics.NewEventMetrics(time.Now()).
AddMetric("hermes_probe_latency_seconds", probeOpLatDist.Clone()).
AddMetric(ProbeLatency, probeOpLatDist.Clone()).
AddLabel("storage_system", target.GetTargetSystem().String()).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make these labels consts too.

if err != nil {
mp.logger.Errorf(err.Error())
t.LatencyMetrics.ProbeOpLatency[metrics.TotalProbeRun][exitStatus].Metric("latency").AddFloat64(time.Now().Sub(start).Seconds())
t.LatencyMetrics.ProbeOpLatency[metrics.TotalProbeRun][exitStatus].Metric("hermes_probe_latency_seconds").AddFloat64(time.Now().Sub(start).Seconds())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the consts.
Here and elsewhere.

@@ -161,10 +161,10 @@ func (mp *Probe) runProbe(ctx context.Context, metricChan chan<- *cpmetrics.Even
exitStatus, err := mp.runProbeForTarget(probeCtx, t)
if err != nil {
mp.logger.Errorf(err.Error())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this change, but you should add some context to this error.

Copy link

@cianbgoog cianbgoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to LGTM, assuming you fix all leczb's comments.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants