Skip to content

Commit

Permalink
OTT-1277: remove Prometheus stats for req.Device.Geo.Country (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pubmatic-Supriya-Patil authored Nov 2, 2023
1 parent 9f38f2f commit dcaa2a6
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 64 deletions.
7 changes: 0 additions & 7 deletions modules/pubmatic/openwrap/metrics/config/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,3 @@ func (me *MultiMetricsEngine) RecordOWServerPanic(endpoint, methodName, nodeName
thisME.RecordOWServerPanic(endpoint, methodName, nodeName, podName)
}
}

// RecordCountry records count of requests received with req.device.geo.country
func (me *MultiMetricsEngine) RecordCountry(pubID string) {
for _, thisME := range *me {
thisME.RecordCountry(pubID)
}
}
2 changes: 0 additions & 2 deletions modules/pubmatic/openwrap/metrics/config/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ func TestRecordFunctionForMultiMetricsEngine(t *testing.T) {
mockEngine.EXPECT().RecordSendLoggerDataTime("requestType", "profileid", time.Second)
mockEngine.EXPECT().RecordRequestTime("requestType", time.Second)
mockEngine.EXPECT().RecordOWServerPanic("endpoint", "methodName", "nodeName", "podName")
mockEngine.EXPECT().RecordCountry("pubID")

// create the multi-metric engine
multiMetricEngine := MultiMetricsEngine{}
Expand Down Expand Up @@ -280,5 +279,4 @@ func TestRecordFunctionForMultiMetricsEngine(t *testing.T) {
multiMetricEngine.RecordSendLoggerDataTime("requestType", "profileid", time.Second)
multiMetricEngine.RecordRequestTime("requestType", time.Second)
multiMetricEngine.RecordOWServerPanic("endpoint", "methodName", "nodeName", "podName")
multiMetricEngine.RecordCountry("pubID")
}
1 change: 0 additions & 1 deletion modules/pubmatic/openwrap/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,4 @@ type MetricsEngine interface {
RecordSendLoggerDataTime(requestType, profileid string, sendTime time.Duration)
RecordRequestTime(requestType string, requestTime time.Duration)
RecordOWServerPanic(endpoint, methodName, nodeName, podName string)
RecordCountry(pubID string)
}
12 changes: 0 additions & 12 deletions modules/pubmatic/openwrap/metrics/mock/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion modules/pubmatic/openwrap/metrics/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ type Metrics struct {
panicCounts *prometheus.CounterVec
sendLoggerData *prometheus.HistogramVec
owRequestTime *prometheus.HistogramVec
country *prometheus.CounterVec
}

const (
Expand Down
12 changes: 0 additions & 12 deletions modules/pubmatic/openwrap/metrics/prometheus/prometheus_sshb.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ func newSSHBMetrics(metrics *Metrics, cfg *config.PrometheusMetrics, promRegistr
"Counts the header-bidding server panic.",
[]string{nodeNameLabel, podNameLabel, methodNameLabel, endpointLabel})

metrics.country = newCounter(cfg, promRegistry,
"sshb_country",
"Count of requests received with publishers Country by publisher id.",
[]string{pubIDLabel})

preloadLabelValues(metrics)
}

Expand Down Expand Up @@ -199,13 +194,6 @@ func (m *Metrics) RecordOWServerPanic(endpoint, methodName, nodeName, podName st
}).Inc()
}

// RecordCountry records count of requests received with req.device.geo.country
func (m *Metrics) RecordCountry(pubID string) {
m.country.With(prometheus.Labels{
pubIDLabel: pubID,
}).Inc()
}

func preloadLabelValues(m *Metrics) {
var (
requestStatusValues = requestStatusesAsString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,31 +387,3 @@ func TestRegisterLabelPermutations(t *testing.T) {
assert.ElementsMatch(t, test.expectedLabels, resultLabels)
}
}

func TestMetricsRecordCountry(t *testing.T) {
m := createMetricsForTesting()
type args struct {
pubID string
}
tests := []struct {
name string
args args
want float64
}{
{
name: "call_record_country",
args: args{
pubID: "1010",
},
want: 1,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
m.RecordCountry(tt.args.pubID)
assertCounterVecValue(t, "", "country", m.country, tt.want, prometheus.Labels{
pubIDLabel: tt.args.pubID,
})
})
}
}
1 change: 0 additions & 1 deletion modules/pubmatic/openwrap/metrics/stats/tcp_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,3 @@ func (st *StatsTCP) RecordCtvUaAccuracy(pubId, status string)
func (st *StatsTCP) RecordSendLoggerDataTime(requestType, profileid string, sendTime time.Duration) {}
func (st *StatsTCP) RecordRequestTime(requestType string, requestTime time.Duration) {}
func (st *StatsTCP) RecordOWServerPanic(endpoint, methodName, nodeName, podName string) {}
func (st *StatsTCP) RecordCountry(pubID string) {}

0 comments on commit dcaa2a6

Please sign in to comment.