diff --git a/collector/connector/validationconnector/README.md b/collector/connector/validationconnector/README.md index 987c3a8dc8..839d8074bf 100644 --- a/collector/connector/validationconnector/README.md +++ b/collector/connector/validationconnector/README.md @@ -14,7 +14,7 @@ is resolved this component cannot be reliably used. ## Configuration This connector can be used to test any exporter and receiver pair that -are able to propagate metadata using the Colector's +are able to propagate metadata using the Collector's `client.Metadata.Info` mechanism. For example, to test an OTel Arrow collector configuration, configure a loopback receiver: @@ -131,7 +131,8 @@ cases using two kinds of context variable. matching data. For each expected and actual data item, the support method -`AssertEquiv` library in `../../../pkg/otel/assert/` is used to ensure -that the data is equivalent. This package uses a definition of -equivalence that tolerates reordering of unordered fields, which is -necesary to validate the OTel Arrow components in this repository. +`AssertEquiv` library in [pkg/otel/asasert](https://github.com/open-telemetry/otel-arrow/tree/main/pkg/otel/assert/README.md) is used to ensure +that the data are equivalent. This package supports the comparison of +two distinct structures that are semantically equivalent but +structurally different in several ways that can happen as a result of +the Arrow encoding. diff --git a/collector/processor/obfuscationprocessor/config.go b/collector/processor/obfuscationprocessor/config.go index 5d35238012..1d897d71a8 100644 --- a/collector/processor/obfuscationprocessor/config.go +++ b/collector/processor/obfuscationprocessor/config.go @@ -6,7 +6,7 @@ type Config struct { Rounds int `mapstructure:"rounds"` // KeyLength is a Fiestel parameter which determines the - // length of the keyt used to obfuscate. Default 128. + // length of the key used to obfuscate. Default 128. KeyLength int `mapstructure:"key_length"` // EncryptAll indicates that all byte-array and string values diff --git a/collector/processor/obfuscationprocessor/factory.go b/collector/processor/obfuscationprocessor/factory.go index 653f827c14..968c0356ea 100644 --- a/collector/processor/obfuscationprocessor/factory.go +++ b/collector/processor/obfuscationprocessor/factory.go @@ -100,7 +100,7 @@ func createTracesProcessor( processorhelper.WithShutdown(processor.Shutdown)) } -// createTracesProcessor creates an instance of obfuscation for processing traces +// createLogsProcessor creates an instance of obfuscation for processing logs. func createLogsProcessor( ctx context.Context, set processor.CreateSettings, diff --git a/pkg/otel/assert/README.md b/pkg/otel/assert/README.md new file mode 100644 index 0000000000..7b3e435b2d --- /dev/null +++ b/pkg/otel/assert/README.md @@ -0,0 +1,16 @@ +This package supports validation of data that has passed through Arrow +encoding and decoding, recognizing that there may be structural +differences for semantically equivalent data. + +Examples of transformations that are allowed by `assert.Equiv()`: + +- Appearance of duplicate Resource, Scope, and Metric entities +- Order of Resource instances in a Resource list +- Order of Scope items in a Resource +- Order of Span, Metric, and LogRecord items in a Scope +- Order of Links/Events in a Span +- and so on. + +The `assert.Equiv()` method in this package should be used for +unittesting and validation of data in an OTel Arrow pipeline. See the +[code](equiv.go) for details. diff --git a/tools/trace_verify/main.go b/tools/trace_verify/main.go index 4dfda02e3a..05c9776ffc 100644 --- a/tools/trace_verify/main.go +++ b/tools/trace_verify/main.go @@ -20,6 +20,7 @@ import ( "bufio" "encoding/json" "flag" + "io" "log" "os" @@ -48,11 +49,17 @@ func main() { log.Fatalf("open: %s: %v", file, err) return } - scanner := bufio.NewScanner(f) - for scanner.Scan() { + scanner := bufio.NewReader(f) + for { + line, err := scanner.ReadString('\n') + if err == io.EOF { + break + } else if err != nil { + log.Fatalf("read: %v", err) + } var un ptrace.JSONUnmarshaler - expected, err := un.UnmarshalTraces([]byte(scanner.Text())) + expected, err := un.UnmarshalTraces([]byte(line)) if err != nil { log.Fatalf("parse: %v", err) } @@ -78,8 +85,5 @@ func main() { log.Printf("Verified %d traces\n", expected.SpanCount()) } - if err := scanner.Err(); err != nil { - log.Fatalf("read: %v", err) - } } }