Skip to content

Commit

Permalink
Add DroppedAttributeCount field to Otel/STEF schema (#22)
Browse files Browse the repository at this point in the history
Resolves #8

Otel/STEF schema changes:

- Added "DroppedAttributeCount" field in the "Resource", "Scope", "Span", etc structs.

Also updated testdata files (because the schema is now different) and renamed
the incorrect ".tefz" to ".stefz" extension.
  • Loading branch information
tigrannajaryan authored Jan 29, 2025
1 parent 21d5c60 commit 3332a0f
Show file tree
Hide file tree
Showing 44 changed files with 1,096 additions and 144 deletions.
2 changes: 1 addition & 1 deletion benchmarks/benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

var testEncodings = []encodings.MetricEncoding{
&otlp.OTLPEncoding{},
&stef.STEFEncoding{},
&stef.STEFEncoding{Opts: pkg.WriterOptions{Compression: pkg.CompressionNone}},
//&stef.STEFSEncoding{},
//&stef.STEFUEncoding{},
&otelarrow.OtelArrowEncoding{},
Expand Down
14 changes: 7 additions & 7 deletions benchmarks/readwrite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (

func TestCopy(t *testing.T) {
files := []string{
"oteldemo-with-histogram.tefz",
"hipstershop.tefz",
"hostandcollectormetrics.tefz",
"astronomyshop.tefz",
"oteldemo-with-histogram.stefz",
"hipstershop.stefz",
"hostandcollectormetrics.stefz",
"astronomyshop.stefz",
}

fmt.Printf(
Expand Down Expand Up @@ -78,7 +78,7 @@ func TestCopy(t *testing.T) {
}

func BenchmarkReadSTEF(b *testing.B) {
tefBytes, err := os.ReadFile("testdata/hipstershop.tefz")
tefBytes, err := os.ReadFile("testdata/hipstershop.stefz")
require.NoError(b, err)

tefSrc, err := oteltef.NewMetricsReader(bytes.NewBuffer(tefBytes))
Expand Down Expand Up @@ -136,7 +136,7 @@ func BenchmarkReadSTEF(b *testing.B) {
}

func BenchmarkReadSTEFZ(b *testing.B) {
tefBytes, err := os.ReadFile("testdata/hipstershop.tefz")
tefBytes, err := os.ReadFile("testdata/hipstershop.stefz")
require.NoError(b, err)

recCount := 0
Expand Down Expand Up @@ -164,7 +164,7 @@ func BenchmarkReadSTEFZ(b *testing.B) {
}

func BenchmarkReadSTEFZWriteSTEF(b *testing.B) {
tefBytes, err := os.ReadFile("testdata/hipstershop.tefz")
tefBytes, err := os.ReadFile("testdata/hipstershop.stefz")
require.NoError(b, err)

recCount := 0
Expand Down
22 changes: 18 additions & 4 deletions benchmarks/size_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"io"
"log"
"os"
"strings"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -89,6 +91,14 @@ func TestTracesMultipart(t *testing.T) {
}
}

func replaceExt(fname string, ext string) string {
idx := strings.Index(fname, ".")
if idx > 0 {
return fname[:idx] + ext
}
return fname
}

func TestMetricsSize(t *testing.T) {

dataVariations := []struct {
Expand Down Expand Up @@ -184,10 +194,14 @@ func TestMetricsSize(t *testing.T) {
log.Fatal(err)
}

//if enc, ok := encoding.(*stef.STEFEncoding); ok {
// fname := "testdata/" + dataVariation.generator.GetName() + "." + strings.ToLower(enc.Name())
// os.WriteFile(fname, bodyBytes, 0644)
//}
if enc, ok := encoding.(*stef.STEFEncoding); ok {
// Write STEF file if it does not exist
fname := "testdata/" + replaceExt(dataVariation.generator.GetName(), "."+strings.ToLower(enc.Name()))
_, err = os.Stat(fname)
if err != nil {
os.WriteFile(fname, bodyBytes, 0644)
}
}

zstdedBytes := testutils.CompressZstd(bodyBytes)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added benchmarks/testdata/oteldemo-with-histogram.stefz
Binary file not shown.
Binary file removed benchmarks/testdata/oteldemo-with-histogram.tefz
Binary file not shown.
20 changes: 20 additions & 0 deletions go/otel/oteltef.wire.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@
{
"multimap": "Attributes",
"name": "Attributes"
},
{
"name": "DroppedAttributesCount",
"primitive": 1
}
]
},
Expand All @@ -271,6 +275,10 @@
{
"multimap": "Attributes",
"name": "Attributes"
},
{
"name": "DroppedAttributesCount",
"primitive": 1
}
]
},
Expand Down Expand Up @@ -319,6 +327,10 @@
"multimap": "Attributes",
"name": "Attributes"
},
{
"name": "DroppedAttributesCount",
"primitive": 1
},
{
"array": {
"struct": "Event"
Expand Down Expand Up @@ -360,6 +372,10 @@
{
"multimap": "Attributes",
"name": "Attributes"
},
{
"name": "DroppedAttributesCount",
"primitive": 1
}
]
},
Expand All @@ -379,6 +395,10 @@
{
"multimap": "Attributes",
"name": "Attributes"
},
{
"name": "DroppedAttributesCount",
"primitive": 1
}
]
},
Expand Down
26 changes: 26 additions & 0 deletions go/otel/oteltef/anyvalue.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions go/otel/oteltef/anyvaluearray.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions go/otel/oteltef/attributes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions go/otel/oteltef/envelope.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions go/otel/oteltef/envelopeattributes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3332a0f

Please sign in to comment.