func (p *HttpStartStopProcessor) ProcessHttpStartStopHttpRequestCount(event *events.HttpStartStop) *metrics.CounterMetric { statPrefix := "http.requests." hostname := strings.Replace(strings.Split(event.GetUri(), "/")[0], ".", "_", -1) stat := statPrefix + hostname metric := metrics.NewCounterMetric(stat, isPeer(event)) return metric }
func (p *HttpStartStopProcessor) ProcessHttpStartStopStatusCodeCount(event *events.HttpStartStop) *metrics.CounterMetric { statPrefix := "http.statuscodes." hostname := strings.Replace(strings.Split(event.GetUri(), "/")[0], ".", "_", -1) stat := statPrefix + hostname + "." + strconv.Itoa(int(event.GetStatusCode())) metric := metrics.NewCounterMetric(stat, isPeer(event)) return metric }
func (p *HttpStartStopProcessor) ProcessHttpStartStopResponseTime(event *events.HttpStartStop) *metrics.TimingMetric { statPrefix := "http.responsetimes." hostname := strings.Replace(strings.Split(event.GetUri(), "/")[0], ".", "_", -1) stat := statPrefix + hostname startTimestamp := event.GetStartTimestamp() stopTimestamp := event.GetStopTimestamp() durationNanos := stopTimestamp - startTimestamp durationMillis := durationNanos / 1000000 // NB: loss of precision here metric := metrics.NewTimingMetric(stat, durationMillis) return metric }
func (p *HttpStartStopProcessor) ProcessHttpStartStopHttpErrorCount(event *events.HttpStartStop) *metrics.CounterMetric { var incrementValue int64 statPrefix := "http.errors." hostname := strings.Replace(strings.Split(event.GetUri(), "/")[0], ".", "_", -1) stat := statPrefix + hostname if 299 < event.GetStatusCode() && 1 == isPeer(event) { incrementValue = 1 } else { incrementValue = 0 } metric := metrics.NewCounterMetric(stat, incrementValue) return metric }