Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: do not convert ids to base64 #1583

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/opentelemetry-exporter-collector-proto/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ export function mockHistogram(): MetricRecord {
};
}

const traceIdBase64 = 'HxAI3I4nDoXECg18OTmyeA==';
const spanIdBase64 = 'XhByYfZPpT4=';
const parentIdBase64 = 'eKiRUJiGQ4g=';
const traceIdHex = '1f1008dc8e270e85c40a0d7c3939b278';
const spanIdHex = '5e107261f64fa53e';
const parentIdHex = '78a8915098864388';

export const mockedReadableSpan: ReadableSpan = {
name: 'documentFetch',
Expand Down Expand Up @@ -260,8 +260,8 @@ export function ensureProtoLinksAreCorrect(
attributes,
[
{
traceId: traceIdBase64,
spanId: parentIdBase64,
traceId: traceIdHex,
spanId: parentIdHex,
attributes: [
{
key: 'component',
Expand Down Expand Up @@ -289,15 +289,15 @@ export function ensureProtoSpanIsCorrect(
if (span.links) {
ensureProtoLinksAreCorrect(span.links);
}
assert.deepStrictEqual(span.traceId, traceIdBase64, 'traceId is wrong');
assert.deepStrictEqual(span.spanId, spanIdBase64, 'spanId is wrong');
assert.deepStrictEqual(span.traceId, traceIdHex, 'traceId is wrong');
assert.deepStrictEqual(span.spanId, spanIdHex, 'spanId is wrong');
assert.deepStrictEqual(
span.parentSpanId,
parentIdBase64,
parentIdHex,
'parentIdArr is wrong'
);
assert.strictEqual(span.name, 'documentFetch', 'name is wrong');
assert.strictEqual(span.kind, 'INTERNAL', 'kind is wrong');
assert.strictEqual(span.kind, 'SPAN_KIND_INTERNAL', 'kind is wrong');
assert.strictEqual(
span.startTimeUnixNano,
'1574120165429803008',
Expand All @@ -315,7 +315,7 @@ export function ensureProtoSpanIsCorrect(
);
assert.strictEqual(span.droppedEventsCount, 0, 'droppedEventsCount is wrong');
assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong');
assert.deepStrictEqual(span.status, { code: 'Ok' }, 'status is wrong');
assert.deepStrictEqual(span.status, { code: 'STATUS_CODE_OK' }, 'status is wrong');
}

export function ensureExportedCounterIsCorrect(
Expand Down
10 changes: 5 additions & 5 deletions packages/opentelemetry-exporter-collector/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ export function toCollectorLinks(
): opentelemetryProto.trace.v1.Span.Link[] {
return span.links.map((link: Link) => {
const protoLink: opentelemetryProto.trace.v1.Span.Link = {
traceId: core.hexToBase64(link.context.traceId),
spanId: core.hexToBase64(link.context.spanId),
traceId: link.context.traceId,
spanId: link.context.spanId,
attributes: toCollectorAttributes(link.attributes || {}),
droppedAttributesCount: 0,
};
Expand All @@ -156,10 +156,10 @@ export function toCollectorSpan(
span: ReadableSpan
): opentelemetryProto.trace.v1.Span {
return {
traceId: core.hexToBase64(span.spanContext.traceId),
spanId: core.hexToBase64(span.spanContext.spanId),
traceId: span.spanContext.traceId,
spanId: span.spanContext.spanId,
parentSpanId: span.parentSpanId
? core.hexToBase64(span.parentSpanId)
? span.parentSpanId
: undefined,
traceState: toCollectorTraceState(span.spanContext.traceState),
name: span.name,
Expand Down
16 changes: 8 additions & 8 deletions packages/opentelemetry-exporter-collector/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ export function mockHistogram(): MetricRecord {
};
}

const traceIdBase64 = 'HxAI3I4nDoXECg18OTmyeA==';
const spanIdBase64 = 'XhByYfZPpT4=';
const parentIdBase64 = 'eKiRUJiGQ4g=';
const traceIdHex = '1f1008dc8e270e85c40a0d7c3939b278';
const spanIdHex = '5e107261f64fa53e';
const parentIdHex = '78a8915098864388';

export const mockedReadableSpan: ReadableSpan = {
name: 'documentFetch',
Expand Down Expand Up @@ -423,8 +423,8 @@ export function ensureLinksAreCorrect(
attributes,
[
{
traceId: traceIdBase64,
spanId: parentIdBase64,
traceId: traceIdHex,
spanId: parentIdHex,
attributes: [
{
key: 'component',
Expand Down Expand Up @@ -452,11 +452,11 @@ export function ensureSpanIsCorrect(
if (span.links) {
ensureLinksAreCorrect(span.links);
}
assert.deepStrictEqual(span.traceId, traceIdBase64, 'traceId is wrong');
assert.deepStrictEqual(span.spanId, spanIdBase64, 'spanId is wrong');
assert.deepStrictEqual(span.traceId, traceIdHex, 'traceId is wrong');
assert.deepStrictEqual(span.spanId, spanIdHex, 'spanId is wrong');
assert.deepStrictEqual(
span.parentSpanId,
parentIdBase64,
parentIdHex,
'parentIdArr is wrong'
);
assert.strictEqual(span.name, 'documentFetch', 'name is wrong');
Expand Down