Skip to content

Commit

Permalink
fix: rename requests_processing to request_processing_total
Browse files Browse the repository at this point in the history
  • Loading branch information
ev1lQuark committed Jun 8, 2023
1 parent a2d2b98 commit 3d02e59
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion metrics/prometheus/after_invocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (reporter *PrometheusReporter) ReportAfterInvocation(ctx context.Context, i

reporter.reportRTSummaryVec(role, &labels, cost.Milliseconds())
reporter.reportRequestsTotalCounterVec(role, &labels)
reporter.decRequestsProcessingGaugeVec(role, &labels)
reporter.decRequestsProcessingTotalGaugeVec(role, &labels)

if res != nil && res.Error() == nil {
// succeed
Expand Down
2 changes: 1 addition & 1 deletion metrics/prometheus/before_invocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ func (reporter *PrometheusReporter) ReportBeforeInvocation(ctx context.Context,
}
labels := buildLabels(url)

reporter.incRequestsProcessingGaugeVec(role, &labels)
reporter.incRequestsProcessingTotalGaugeVec(role, &labels)
}
12 changes: 6 additions & 6 deletions metrics/prometheus/metric_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ type metricSet struct {
// report the provider-side's request total counter data
providerRequestsTotalCounterVec *prometheus.CounterVec
// report the provider-side's processing request counter data
providerRequestsProcessingGaugeVec *prometheus.GaugeVec
providerRequestsProcessingTotalGaugeVec *prometheus.GaugeVec
// The number of requests successfully received by the provider
providerRequestsSucceedTotalCounterVec *prometheus.CounterVec

// report the consumer-side's request total counter data
consumerRequestsTotalCounterVec *prometheus.CounterVec
// report the consumer-side's processing request counter data
consumerRequestsProcessingGaugeVec *prometheus.GaugeVec
consumerRequestsProcessingTotalGaugeVec *prometheus.GaugeVec
// The number of successful requests sent by consumers
consumerRequestsSucceedTotalCounterVec *prometheus.CounterVec
}
Expand All @@ -59,8 +59,8 @@ func (ms *metricSet) initAndRegister(reporterConfig *metrics.ReporterConfig) {
ms.providerRTSummaryVec = newSummaryVec(buildMetricsName(providerField, rtField, milliSecondsField, summaryField), reporterConfig.Namespace, labelNames, reporterConfig.SummaryMaxAge)
ms.consumerRequestsTotalCounterVec = newCounterVec(buildMetricsName(consumerField, requestsField, totalField), reporterConfig.Namespace, labelNames)
ms.providerRequestsTotalCounterVec = newCounterVec(buildMetricsName(providerField, requestsField, totalField), reporterConfig.Namespace, labelNames)
ms.consumerRequestsProcessingGaugeVec = newGaugeVec(buildMetricsName(consumerField, requestsField, processingField), reporterConfig.Namespace, labelNames)
ms.providerRequestsProcessingGaugeVec = newGaugeVec(buildMetricsName(providerField, requestsField, processingField), reporterConfig.Namespace, labelNames)
ms.consumerRequestsProcessingTotalGaugeVec = newGaugeVec(buildMetricsName(consumerField, requestsField, processingField, totalField), reporterConfig.Namespace, labelNames)
ms.providerRequestsProcessingTotalGaugeVec = newGaugeVec(buildMetricsName(providerField, requestsField, processingField, totalField), reporterConfig.Namespace, labelNames)
ms.consumerRequestsSucceedTotalCounterVec = newCounterVec(buildMetricsName(consumerField, requestsField, succeedField, totalField), reporterConfig.Namespace, labelNames)
ms.providerRequestsSucceedTotalCounterVec = newCounterVec(buildMetricsName(providerField, requestsField, succeedField, totalField), reporterConfig.Namespace, labelNames)

Expand All @@ -69,8 +69,8 @@ func (ms *metricSet) initAndRegister(reporterConfig *metrics.ReporterConfig) {
ms.providerRTSummaryVec,
ms.consumerRequestsTotalCounterVec,
ms.providerRequestsTotalCounterVec,
ms.consumerRequestsProcessingGaugeVec,
ms.providerRequestsProcessingGaugeVec,
ms.consumerRequestsProcessingTotalGaugeVec,
ms.providerRequestsProcessingTotalGaugeVec,
ms.consumerRequestsSucceedTotalCounterVec,
ms.providerRequestsSucceedTotalCounterVec,
)
Expand Down
12 changes: 6 additions & 6 deletions metrics/prometheus/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,21 @@ func (reporter *PrometheusReporter) reportRequestsTotalCounterVec(role string, l
}
}

func (reporter *PrometheusReporter) incRequestsProcessingGaugeVec(role string, labels *prometheus.Labels) {
func (reporter *PrometheusReporter) incRequestsProcessingTotalGaugeVec(role string, labels *prometheus.Labels) {
switch role {
case providerField:
reporter.providerRequestsProcessingGaugeVec.With(*labels).Inc()
reporter.providerRequestsProcessingTotalGaugeVec.With(*labels).Inc()
case consumerField:
reporter.consumerRequestsProcessingGaugeVec.With(*labels).Inc()
reporter.consumerRequestsProcessingTotalGaugeVec.With(*labels).Inc()
}
}

func (reporter *PrometheusReporter) decRequestsProcessingGaugeVec(role string, labels *prometheus.Labels) {
func (reporter *PrometheusReporter) decRequestsProcessingTotalGaugeVec(role string, labels *prometheus.Labels) {
switch role {
case providerField:
reporter.providerRequestsProcessingGaugeVec.With(*labels).Dec()
reporter.providerRequestsProcessingTotalGaugeVec.With(*labels).Dec()
case consumerField:
reporter.consumerRequestsProcessingGaugeVec.With(*labels).Dec()
reporter.consumerRequestsProcessingTotalGaugeVec.With(*labels).Dec()
}
}

Expand Down

0 comments on commit 3d02e59

Please sign in to comment.