Skip to content

Commit

Permalink
updates for ci, linted, added replace for batchpersignal dependency, …
Browse files Browse the repository at this point in the history
…added changelog yaml
  • Loading branch information
jwafle committed Dec 11, 2023
1 parent 3049887 commit 6adacba
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 20 deletions.
27 changes: 27 additions & 0 deletions .chloggen/kafka-exporter-key-by-traceid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: kafkaexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: add ability to publish kafka messages with message key of TraceID - it will allow partitioning of the kafka Topic.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [12318]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user, api]
2 changes: 2 additions & 0 deletions exporter/kafkaexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/corei

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka => ../../internal/kafka

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal => ../../pkg/batchpersignal

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger => ../../pkg/translator/jaeger

retract (
Expand Down
40 changes: 20 additions & 20 deletions exporter/kafkaexporter/marshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) {

// Since marshaling json is not guaranteed to be in order
// within a string, using a map to compare that the expected values are there
unkeyedOtlpJson := map[string]any{
unkeyedOtlpJSON := map[string]any{
"resourceSpans": []any{
map[string]any{
"resource": map[string]any{},
Expand Down Expand Up @@ -165,10 +165,10 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) {
},
}

unkeyedOtlpJsonResult := make([]any, 1)
unkeyedOtlpJsonResult[0] = unkeyedOtlpJson
unkeyedOtlpJSONResult := make([]any, 1)
unkeyedOtlpJSONResult[0] = unkeyedOtlpJSON

keyedOtlpJson1 := map[string]any{
keyedOtlpJSON1 := map[string]any{
"resourceSpans": []any{
map[string]any{
"resource": map[string]any{},
Expand Down Expand Up @@ -207,7 +207,7 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) {

unkeyedMessageKey := []sarama.Encoder{nil}

keyedOtlpJson2 := map[string]any{
keyedOtlpJSON2 := map[string]any{
"resourceSpans": []any{
map[string]any{
"resource": map[string]any{},
Expand All @@ -234,13 +234,13 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) {
},
}

keyedOtlpJsonResult := make([]any, 2)
keyedOtlpJsonResult[0] = keyedOtlpJson1
keyedOtlpJsonResult[1] = keyedOtlpJson2
keyedOtlpJSONResult := make([]any, 2)
keyedOtlpJSONResult[0] = keyedOtlpJSON1
keyedOtlpJSONResult[1] = keyedOtlpJSON2

keyedMessageKey := []sarama.Encoder{sarama.ByteEncoder("0102030405060708090a0b0c0d0e0f10"), sarama.ByteEncoder("1112131415161718191a1b1c1d1e1f20")}

unkeyedZipkinJson := []any{
unkeyedZipkinJSON := []any{
map[string]any{
"traceId": "0102030405060708090a0b0c0d0e0f10",
"id": "0001020304050607",
Expand Down Expand Up @@ -273,10 +273,10 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) {
},
}

unkeyedZipkinJsonResult := make([]any, 1)
unkeyedZipkinJsonResult[0] = unkeyedZipkinJson
unkeyedZipkinJSONResult := make([]any, 1)
unkeyedZipkinJSONResult[0] = unkeyedZipkinJSON

keyedZipkinJson1 := []any{
keyedZipkinJSON1 := []any{
map[string]any{
"traceId": "0102030405060708090a0b0c0d0e0f10",
"id": "0001020304050607",
Expand All @@ -299,7 +299,7 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) {
},
}

keyedZipkinJson2 := []any{
keyedZipkinJSON2 := []any{
map[string]any{
"traceId": "1112131415161718191a1b1c1d1e1f20",
"id": "161718191a1b1c00",
Expand All @@ -312,9 +312,9 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) {
},
}

keyedZipkinJsonResult := make([]any, 2)
keyedZipkinJsonResult[0] = keyedZipkinJson1
keyedZipkinJsonResult[1] = keyedZipkinJson2
keyedZipkinJSONResult := make([]any, 2)
keyedZipkinJSONResult[0] = keyedZipkinJSON1
keyedZipkinJSONResult[1] = keyedZipkinJSON2

tests := []struct {
encoding string
Expand All @@ -324,10 +324,10 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) {
expectedMessageKey []sarama.Encoder
unmarshaled any
}{
{encoding: "otlp_json", numExpectedMessages: 1, expectedJSON: unkeyedOtlpJsonResult, expectedMessageKey: unkeyedMessageKey, unmarshaled: map[string]any{}},
{encoding: "otlp_json", keyed: true, numExpectedMessages: 2, expectedJSON: keyedOtlpJsonResult, expectedMessageKey: keyedMessageKey, unmarshaled: map[string]any{}},
{encoding: "zipkin_json", numExpectedMessages: 1, expectedJSON: unkeyedZipkinJsonResult, expectedMessageKey: unkeyedMessageKey, unmarshaled: []map[string]any{}},
{encoding: "zipkin_json", keyed: true, numExpectedMessages: 2, expectedJSON: keyedZipkinJsonResult, expectedMessageKey: keyedMessageKey, unmarshaled: []map[string]any{}},
{encoding: "otlp_json", numExpectedMessages: 1, expectedJSON: unkeyedOtlpJSONResult, expectedMessageKey: unkeyedMessageKey, unmarshaled: map[string]any{}},
{encoding: "otlp_json", keyed: true, numExpectedMessages: 2, expectedJSON: keyedOtlpJSONResult, expectedMessageKey: keyedMessageKey, unmarshaled: map[string]any{}},
{encoding: "zipkin_json", numExpectedMessages: 1, expectedJSON: unkeyedZipkinJSONResult, expectedMessageKey: unkeyedMessageKey, unmarshaled: []map[string]any{}},
{encoding: "zipkin_json", keyed: true, numExpectedMessages: 2, expectedJSON: keyedZipkinJSONResult, expectedMessageKey: keyedMessageKey, unmarshaled: []map[string]any{}},
}

for _, test := range tests {
Expand Down

0 comments on commit 6adacba

Please sign in to comment.