Remove hyphens sice the idiomatic style is to not have word delimiters
at all, or have `_` as an exception.
Remove `opentelemetry-` prefix since the package is within otlp already and
there a no types in that package directly i.e. alias is not a problem.
* Convert status to not be a pointer in the Span
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Fix lint errors
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Currently for slices of pointers, pdata exposes elements that are pointers to the pointer in the slice (double pointers in the internal implementation). Because of this users have to deal with possible nil values, have to initialize elements (in some cases) etc, but in reality the elements in the slice cannot be nil, so this just adds extra unnecessary complexity. This is possible because:
* Gogo proto (and protobuf) will not unmarshal any nil element in a slice;
* Our APIs to add elements/remove elements from the slice will guarantee that we never have a nil element in the slice between [0, len-1];
This is an important change because will allow us to change the internal representation (use slice of pointers or non-pointers) without affecting the public API.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Optimizations:
* For `CopyTo` ensures that if spaces enough in the slice (check for capacity not for length) a new slice is not allocated.
* For `Resize` if not enough capacity, allocate the right slice from the beginning instead of keep calling append which may do more allocations.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Contributes to https://github.com/open-telemetry/opentelemetry-collector/issues/1841
- Implemented the backward compatibility logic for sending and receiving
side for DeprecatedCode and Code fields according to OTLP spec.
- Had to modify pdata generator to allow generating fields without setters.
This is needed because the Status code field needs a custom setter logic
that implements the DeprecatedCode vs Code handling.
- Added tests that verify OTLP receiver behavior for Status Code/DeprecatedCode.
- Added tests that verify sending/setting behavior for Status Code/DeprecatedCode
for any component that uses pdata.Traces Status.SetCode().
- Modified all non-OTLP trace receivers and exporters (Jaeger, Zipkin, OpenCensus) to use
the new Status code.
- Modified correctness tests to use the new status Code instead of DeprecatedCode.
Contributes to https://github.com/open-telemetry/opentelemetry-collector/issues/1177
1. The TraceID type uses custom data type so that JSON serialization
is in hex format instead of base64 (which is the default Protobuf JSON
format). Hex format is required by OTLP spec:
https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/protocol/otlp.md#request
SpanID must be also modified similarly. Will be done in a future PR
to avoid creating a huge PR.
2. Moved pdata.TraceID to its own file. Note that there is pdata.TraceID which
is different from otlp TraceID custom data type. Due to the way packages are
structured we need both to keep OTLP generated data types decoupled from pdata
data types.
The majority of the changes in this commit are simply type changes from
[]byte to TraceID.
* Generate OTLP Go code in this repo
Generate ProtoBufs in this repository instead of importing from opentelemetry-proto.
This allows us to customize the generation process.
- Added opentelemetry-proto as a submodule.
- Added `make genproto` target that generates Go ProtoBufs from opentelemetry-proto
submodule and puts them in internal/opentelemetry-proto-gen.
Generation is done using Gogoproto instead of Go Protobuf.
- Modified all files to import OTLP Go code from internal/opentelemetry-proto-gen.
* Add wire compatibility tests