Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
  • Loading branch information
bacherfl committed Jun 5, 2024
1 parent 549bdc3 commit fb04e21
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion pkg/ottl/ottlfuncs/func_scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (
"context"
"errors"
"fmt"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"

"go.opentelemetry.io/collector/pdata/pmetric"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"
)

type ScaleArguments[K any] struct {
Expand Down
26 changes: 14 additions & 12 deletions pkg/ottl/ottlfuncs/func_scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ package ottlfuncs

import (
"context"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"
"testing"

"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric"
"testing"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"
)

func TestScale(t *testing.T) {
Expand All @@ -28,7 +30,7 @@ func TestScale(t *testing.T) {
name: "scale float value",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
return 1.05, nil
},
},
Expand All @@ -43,7 +45,7 @@ func TestScale(t *testing.T) {
name: "scale int value",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
return int64(1), nil
},
},
Expand All @@ -58,7 +60,7 @@ func TestScale(t *testing.T) {
name: "unsupported data type",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
return "foo", nil
},
},
Expand All @@ -73,7 +75,7 @@ func TestScale(t *testing.T) {
name: "scale gauge float metric",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
metric := pmetric.NewMetric()
metric.SetName("test-metric")
metric.SetEmptyGauge()
Expand All @@ -98,7 +100,7 @@ func TestScale(t *testing.T) {
name: "scale gauge int metric",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
metric := pmetric.NewMetric()
metric.SetName("test-metric")
metric.SetEmptyGauge()
Expand All @@ -123,7 +125,7 @@ func TestScale(t *testing.T) {
name: "scale sum metric",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
metric := pmetric.NewMetric()
metric.SetName("test-metric")
metric.SetEmptySum()
Expand All @@ -148,7 +150,7 @@ func TestScale(t *testing.T) {
name: "scale histogram metric",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
metric := getTestHistogramMetric(1, 4, 1, 3, []float64{1, 10}, []uint64{1, 2}, []float64{1.0}, 1, 1)
return metric.Histogram().DataPoints(), nil

Expand All @@ -166,7 +168,7 @@ func TestScale(t *testing.T) {
name: "scale SummaryDataPointValueAtQuantileSlice",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
metric := pmetric.NewSummaryDataPointValueAtQuantileSlice()
metric.AppendEmpty().SetValue(1.0)
return metric, nil
Expand All @@ -186,7 +188,7 @@ func TestScale(t *testing.T) {
name: "scale ExemplarSlice",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
metric := pmetric.NewExemplarSlice()
metric.AppendEmpty().SetDoubleValue(1.0)
return metric, nil
Expand All @@ -205,7 +207,7 @@ func TestScale(t *testing.T) {
name: "unsupported: exponential histogram metric",
args: args{
value: &ottl.StandardGetSetter[any]{
Getter: func(ctx context.Context, tCtx any) (any, error) {
Getter: func(_ context.Context, _ any) (any, error) {
return pmetric.NewExponentialHistogramDataPointSlice(), nil

},
Expand Down

0 comments on commit fb04e21

Please sign in to comment.