Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] extract resource from spans #1184

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adds test to be more strict
Tenaria committed Dec 13, 2021
commit 2c9b80c0805feac04c139f1dbad84be025090da6
23 changes: 23 additions & 0 deletions processor/spanmetricsprocessor/processor_test.go
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ package spanmetricsprocessor
import (
"context"
"fmt"
"reflect"
"testing"
"time"

@@ -759,3 +760,25 @@ func TestTraceWithoutServiceNameDoesNotGenerateMetrics(t *testing.T) {
// Verify
assert.NoError(t, err)
}

func TestDimensionsAndResourceAttributesOrdered(t *testing.T) {
// Prepare
factory := NewFactory()
cfg := factory.CreateDefaultConfig().(*Config)

// Test
next := new(consumertest.TracesSink)
p, err := newProcessor(zap.NewNop(), cfg, next)

// Verify
assert.NoError(t, err)

dimType := reflect.TypeOf(p.dimensions).Kind()
resourceAttrType := reflect.TypeOf(p.resourceAttributes).Kind()

// dimensions and resource attributes must be of an ordered type e.g Slice.
// This is because the aggregation generates a string of concatenated key value pairs
// and hence is dependent on the order of the keys.
assert.Equal(t, reflect.Slice, dimType)
assert.Equal(t, reflect.Slice, resourceAttrType)
}