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: propagate context in koa tracing #594

Merged
merged 2 commits into from
Nov 14, 2017
Merged

Conversation

kjin
Copy link
Contributor

@kjin kjin commented Nov 13, 2017

Fixes #593

The Koa tracing plugin ignored the return value of api.wrap, resulting in trace context not being propagated correctly. This affects both Koa 1 and 2, but Koa 1 needs different patching logic altogether (as it relies on generator functions).

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 13, 2017
@@ -16,6 +16,7 @@
'use strict';

const shimmer = require('shimmer');
const co = require('co');
var urlParse = require('url').parse;

function startSpanForRequest(api, req, res, next) {

This comment was marked as spam.

This comment was marked as spam.

@@ -16,6 +16,7 @@
'use strict';

const shimmer = require('shimmer');
const co = require('co');

This comment was marked as spam.

@@ -42,7 +42,7 @@ describe('koa', function() {
});

Object.keys(appBuilders).forEach(function(version) {
describe(version, function() {
describe.skip(version, function() {

This comment was marked as spam.


startSpanForRequest(api, req, res, next);

console.log(next);

This comment was marked as spam.

This comment was marked as spam.


console.log(next);
next = startSpanForRequest(api, req, res, next);
console.log(next);

This comment was marked as spam.

This comment was marked as spam.

@@ -16,6 +16,7 @@
'use strict';

const shimmer = require('shimmer');
const co = require('co');
var urlParse = require('url').parse;

function startSpanForRequest(api, req, res, next) {

This comment was marked as spam.

@kjin kjin force-pushed the koa-prop branch 2 times, most recently from 870d481 to 21c4c2c Compare November 13, 2017 19:43
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.

I hope the functions are type-declared (at least for exported functions). But I guess that can be a separate PR.

@kjin
Copy link
Contributor Author

kjin commented Nov 13, 2017

@jinwoo Yep, adding types for plugins is in the pipeline. I'm trying to figure out how to import types for multiple versions of the same module, which is the major blocker.

@kjin kjin merged commit b9e6a3b into googleapis:master Nov 14, 2017
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.

4 participants