-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use custom data type and custom JSON serialization for traceid (#1840)
Contributes to #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.
- Loading branch information
1 parent
430c002
commit 75b1ac1
Showing
55 changed files
with
662 additions
and
530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package pdata | ||
|
||
import ( | ||
otlpcommon "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/common/v1" | ||
) | ||
|
||
// TraceID is an alias of OTLP TraceID data type. | ||
type TraceID otlpcommon.TraceID | ||
|
||
func NewTraceID(bytes []byte) TraceID { | ||
return TraceID(otlpcommon.NewTraceID(bytes)) | ||
} | ||
|
||
func (t TraceID) Bytes() []byte { | ||
return otlpcommon.TraceID(t).Bytes() | ||
} | ||
|
||
func (t TraceID) HexString() string { | ||
return otlpcommon.TraceID(t).HexString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.