Skip to content

Commit

Permalink
add counter suffix test
Browse files Browse the repository at this point in the history
Signed-off-by: naseemkullah <naseem@transit.app>
  • Loading branch information
naseemkullah committed Mar 8, 2021
1 parent a52e16e commit 69e31e7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
6 changes: 6 additions & 0 deletions exporter/prometheusremotewriteexporter/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ func Test_getPromMetricName(t *testing.T) {
ns1,
"test_ns_" + validIntSum + counterSuffix,
},
{
"already_has_total_suffix",
validMetrics1[validAptlyNamedIntSum],
ns1,
"test_ns_" + validAptlyNamedIntSum,
},
{
"dirty_string",
validMetrics2[validIntGaugeDirty],
Expand Down
27 changes: 20 additions & 7 deletions exporter/prometheusremotewriteexporter/testutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ var (
quantileValues = []float64{7, 8, 9}
quantiles = getQuantiles(quantileBounds, quantileValues)

validIntGauge = "valid_IntGauge"
validDoubleGauge = "valid_DoubleGauge"
validIntSum = "valid_IntSum"
validDoubleSum = "valid_DoubleSum"
validIntHistogram = "valid_IntHistogram"
validDoubleHistogram = "valid_DoubleHistogram"
validDoubleSummary = "valid_DoubleSummary"
validIntGauge = "valid_IntGauge"
validDoubleGauge = "valid_DoubleGauge"
validIntSum = "valid_IntSum"
validAptlyNamedIntSum = "valid_IntSum_total"
validDoubleSum = "valid_DoubleSum"
validIntHistogram = "valid_IntHistogram"
validDoubleHistogram = "valid_DoubleHistogram"
validDoubleSummary = "valid_DoubleSummary"

validIntGaugeDirty = "*valid_IntGauge$"

Expand Down Expand Up @@ -136,6 +137,18 @@ var (
},
},
},
validAptlyNamedIntSum: {
Name: validAptlyNamedIntSum,
Data: &otlp.Metric_IntSum{
IntSum: &otlp.IntSum{
DataPoints: []*otlp.IntDataPoint{
getIntDataPoint(lbs1, intVal1, time1),
nil,
},
AggregationTemporality: otlp.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE,
},
},
},
validDoubleSum: {
Name: validDoubleSum,
Data: &otlp.Metric_DoubleSum{
Expand Down

0 comments on commit 69e31e7

Please sign in to comment.