Skip to content

Commit

Permalink
[chore] [processor/metricstransform] Enable exhaustive linter (open-t…
Browse files Browse the repository at this point in the history
…elemetry#24559)

related to open-telemetry#23266

Signed-off-by: Ziqi Zhao <[email protected]>
  • Loading branch information
fatsheep9146 committed Jul 26, 2023
1 parent ba90c67 commit 368c836
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func extractMetricWithMatchingAttrs(metric pmetric.Metric, f internalFilter) pme
newMetric.SetUnit(metric.Unit())

switch metric.Type() {
//exhaustive:enforce
case pmetric.MetricTypeGauge:
newMetric.SetEmptyGauge().DataPoints().EnsureCapacity(matchedDpsCount)
for i := 0; i < metric.Gauge().DataPoints().Len(); i++ {
Expand Down Expand Up @@ -443,6 +444,7 @@ func copyMetricDetails(from, to pmetric.Metric) {
to.SetName(from.Name())
to.SetUnit(from.Unit())
to.SetDescription(from.Description())
//exhaustive:enforce
switch from.Type() {
case pmetric.MetricTypeGauge:
to.SetEmptyGauge()
Expand All @@ -461,6 +463,7 @@ func copyMetricDetails(from, to pmetric.Metric) {
// rangeDataPointAttributes calls f sequentially on attributes of every metric data point.
// The iteration terminates if f returns false.
func rangeDataPointAttributes(metric pmetric.Metric, f func(pcommon.Map) bool) {
//exhaustive:enforce
switch metric.Type() {
case pmetric.MetricTypeGauge:
for i := 0; i < metric.Gauge().DataPoints().Len(); i++ {
Expand Down Expand Up @@ -501,6 +504,7 @@ func rangeDataPointAttributes(metric pmetric.Metric, f func(pcommon.Map) bool) {
}

func countDataPoints(metric pmetric.Metric) int {
//exhaustive:enforce
switch metric.Type() {
case pmetric.MetricTypeGauge:
return metric.Gauge().DataPoints().Len()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// deleteLabelValueOp deletes a label value and all data associated with it
func deleteLabelValueOp(metric pmetric.Metric, mtpOp internalOperation) {
op := mtpOp.configOperation
//exhaustive:enforce
switch metric.Type() {
case pmetric.MetricTypeGauge:
metric.Gauge().DataPoints().RemoveIf(func(dp pmetric.NumberDataPoint) bool {
Expand Down

0 comments on commit 368c836

Please sign in to comment.