/
summary.go
31 lines (25 loc) · 863 Bytes
/
summary.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package hermes_client
import (
"fmt"
log "github.com/sirupsen/logrus"
)
type HermesSummaryPacket struct {
MetricName string `json:"metric_name"`
Payload HermesSummaryPayload `json:"payload"`
}
type HermesSummaryPayload struct {
SummaryObservation float64 `json:"observation"`
SummaryLabels map[string]string `json:"labels"`
}
// function used to make an observation on a summary metric
func(c *HermesClient) ObserveSummary(metricName string, labels map[string]string, observation float64) {
log.Debug(fmt.Sprintf("setting observation on histogram %s", metricName))
packet := HermesSummaryPacket{
MetricName: metricName,
Payload: HermesSummaryPayload{
SummaryLabels: labels,
SummaryObservation: observation,
},
}
c.SendUDPPacket(packet)
}