Skip to content

Commit

Permalink
[chore] Remove unnecessary type declaration in templated transforms (o…
Browse files Browse the repository at this point in the history
…pen-telemetry#5906)

The type is fully defined by the switch, no need to be redundant.
  • Loading branch information
MrAlias authored Oct 22, 2024
1 parent 92ccad7 commit 86a51dc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ func metric(m metricdata.Metrics) (*mpb.Metric, error) {
}
switch a := m.Data.(type) {
case metricdata.Gauge[int64]:
out.Data = Gauge[int64](a)
out.Data = Gauge(a)
case metricdata.Gauge[float64]:
out.Data = Gauge[float64](a)
out.Data = Gauge(a)
case metricdata.Sum[int64]:
out.Data, err = Sum[int64](a)
out.Data, err = Sum(a)
case metricdata.Sum[float64]:
out.Data, err = Sum[float64](a)
out.Data, err = Sum(a)
case metricdata.Histogram[int64]:
out.Data, err = Histogram(a)
case metricdata.Histogram[float64]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ func metric(m metricdata.Metrics) (*mpb.Metric, error) {
}
switch a := m.Data.(type) {
case metricdata.Gauge[int64]:
out.Data = Gauge[int64](a)
out.Data = Gauge(a)
case metricdata.Gauge[float64]:
out.Data = Gauge[float64](a)
out.Data = Gauge(a)
case metricdata.Sum[int64]:
out.Data, err = Sum[int64](a)
out.Data, err = Sum(a)
case metricdata.Sum[float64]:
out.Data, err = Sum[float64](a)
out.Data, err = Sum(a)
case metricdata.Histogram[int64]:
out.Data, err = Histogram(a)
case metricdata.Histogram[float64]:
Expand Down
8 changes: 4 additions & 4 deletions internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ func metric(m metricdata.Metrics) (*mpb.Metric, error) {
}
switch a := m.Data.(type) {
case metricdata.Gauge[int64]:
out.Data = Gauge[int64](a)
out.Data = Gauge(a)
case metricdata.Gauge[float64]:
out.Data = Gauge[float64](a)
out.Data = Gauge(a)
case metricdata.Sum[int64]:
out.Data, err = Sum[int64](a)
out.Data, err = Sum(a)
case metricdata.Sum[float64]:
out.Data, err = Sum[float64](a)
out.Data, err = Sum(a)
case metricdata.Histogram[int64]:
out.Data, err = Histogram(a)
case metricdata.Histogram[float64]:
Expand Down

0 comments on commit 86a51dc

Please sign in to comment.