Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

fix: treat instanceId metadata as a number#713

Merged
kjin merged 3 commits intogoogleapis:masterfrom
kjin:trace-writer-2.6.1
Apr 2, 2018
Merged

fix: treat instanceId metadata as a number#713
kjin merged 3 commits intogoogleapis:masterfrom
kjin:trace-writer-2.6.1

Conversation

@kjin
Copy link
Copy Markdown
Contributor

@kjin kjin commented Apr 2, 2018

Fixes #712

This PR accounts for a change in #680 in how trace labels are applied. By directly assigning fields in a spans' labels instead of using addLabel, we were assuming that all default labels were strings. This isn't the case, because GCP instance IDs are numbers.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 2, 2018
@kjin kjin force-pushed the trace-writer-2.6.1 branch from a44ff58 to 9436c8a Compare April 2, 2018 20:16
@kjin kjin force-pushed the trace-writer-2.6.1 branch from 9436c8a to 7833e8f Compare April 2, 2018 20:17
Copy link
Copy Markdown
Contributor

@jinwoo jinwoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question.

Comment thread src/trace-writer.ts Outdated
const labels: LabelObject = {};
this.defaultLabels = {};
// tslint:disable-next-line:no-any
const labels: {[key: string]: any} = {};

This comment was marked as spam.

Comment thread src/trace-writer.ts Outdated
this.defaultLabels = labels;
// Coerce values to strings.
for (const key of Object.keys(labels)) {
this.defaultLabels[key] = `${labels[key]}`;

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2018

Codecov Report

Merging #713 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #713      +/-   ##
==========================================
+ Coverage   90.77%   90.78%   +<.01%     
==========================================
  Files          29       29              
  Lines        1485     1486       +1     
  Branches      293      293              
==========================================
+ Hits         1348     1349       +1     
  Misses         57       57              
  Partials       80       80
Impacted Files Coverage Δ
src/trace-writer.ts 91.59% <100%> (+0.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0236217...281767a. Read the comment docs.

Comment thread src/trace-writer.ts Outdated
labels[TraceLabels.GCE_HOSTNAME] = hostname;
if (instanceId) {
labels[TraceLabels.GCE_INSTANCE_ID] = instanceId;
labels[TraceLabels.GCE_INSTANCE_ID] = `${instanceId}`;

This comment was marked as spam.

Comment thread src/trace-writer.ts Outdated
this.defaultLabels = {};
addDefaultLabel(
TraceLabels.AGENT_DATA,
'node ' + pjson.name + ' v' + pjson.version);

This comment was marked as spam.

@kjin kjin force-pushed the trace-writer-2.6.1 branch from f22db89 to 281767a Compare April 2, 2018 20:41
@kjin kjin merged commit 1434d5d into googleapis:master Apr 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants