Skip to content

Commit 6963854

Browse files
committed
Reorder struct fields as per upstream spec discussion
See also open-telemetry/opentelemetry-specification#4719 (comment)
1 parent ca75c64 commit 6963854

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

process-context/c-and-cpp/otel_process_ctx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ static const otel_process_ctx_data empty_data = {
7676
typedef struct __attribute__((packed, aligned(8))) {
7777
char otel_process_ctx_signature[8]; // Always "OTEL_CTX"
7878
uint32_t otel_process_ctx_version; // Always > 0, incremented when the data structure changes, currently v2
79-
uint64_t otel_process_ctx_published_at_ns; // Always > 0, timestamp from when the context was published in nanoseconds since epoch
8079
uint32_t otel_process_payload_size; // Always > 0, size of storage
80+
uint64_t otel_process_ctx_published_at_ns; // Always > 0, timestamp from when the context was published in nanoseconds since epoch
8181
char *otel_process_payload; // Always non-null, points to the storage for the data; expected to be a protobuf map of string key/value pairs, null-terminated
8282
} otel_process_ctx_mapping;
8383

@@ -171,8 +171,8 @@ otel_process_ctx_result otel_process_ctx_publish(const otel_process_ctx_data *da
171171
*published_state.mapping = (otel_process_ctx_mapping) {
172172
.otel_process_ctx_signature = {0}, // Set in "Step: Populate the signature into the mapping" below
173173
.otel_process_ctx_version = 2,
174-
.otel_process_ctx_published_at_ns = published_at_ns,
175174
.otel_process_payload_size = payload_size,
175+
.otel_process_ctx_published_at_ns = published_at_ns,
176176
.otel_process_payload = published_state.payload
177177
};
178178

process-context/c-and-cpp/otel_process_ctx_dump.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ signature="$(
8282
version="$(
8383
printf '%s' "$data_b64" | base64 -d | dd bs=1 skip=8 count=4 status=none | od -An -t u4 | tr -d ' '
8484
)"
85-
published_at_ns="$(
86-
printf '%s' "$data_b64" | base64 -d | dd bs=1 skip=12 count=8 status=none | od -An -t u8 | tr -d ' '
87-
)"
8885
payload_size="$(
89-
printf '%s' "$data_b64" | base64 -d | dd bs=1 skip=20 count=4 status=none | od -An -t u4 | tr -d ' '
86+
printf '%s' "$data_b64" | base64 -d | dd bs=1 skip=12 count=4 status=none | od -An -t u4 | tr -d ' '
87+
)"
88+
published_at_ns="$(
89+
printf '%s' "$data_b64" | base64 -d | dd bs=1 skip=16 count=8 status=none | od -An -t u8 | tr -d ' '
9090
)"
9191
payload_ptr_hex="$(
9292
printf '%s' "$data_b64" | base64 -d | dd bs=1 skip=24 count=8 status=none | od -An -t x8 | tr -d ' '
@@ -98,8 +98,8 @@ echo " otel_process_ctx_version : $version"
9898
# Convert nanoseconds to seconds for date command
9999
published_at_s=$((published_at_ns / 1000000000))
100100
published_at_pretty="$(date -d "@$published_at_s" '+%Y-%m-%d %H:%M:%S %Z')"
101-
echo " otel_process_ctx_published_at_ns : $published_at_ns ($published_at_pretty)"
102101
echo " otel_process_payload_size : $payload_size"
102+
echo " otel_process_ctx_published_at_ns : $published_at_ns ($published_at_pretty)"
103103
echo " otel_process_payload : 0x$payload_ptr_hex"
104104

105105
echo "Payload dump ($payload_size bytes):"

0 commit comments

Comments
 (0)