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

fix: treat instanceId metadata as a number #713

Merged
merged 3 commits into from Apr 2, 2018

Conversation

kjin
Copy link
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
Copy link
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.

const labels: LabelObject = {};
this.defaultLabels = {};
// tslint:disable-next-line:no-any
const labels: {[key: string]: any} = {};

This comment was marked as spam.

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

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.

@@ -145,14 +145,14 @@ export class TraceWriter extends common.Service {
'node ' + pjson.name + ' v' + pjson.version;
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.

this.defaultLabels = {};
addDefaultLabel(
TraceLabels.AGENT_DATA,
'node ' + pjson.name + ' v' + pjson.version);

This comment was marked as spam.

@kjin kjin merged commit 1434d5d into googleapis:master Apr 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants