-
Notifications
You must be signed in to change notification settings - Fork 318
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
Apply service naming flow to messaging integrations #2961
Changes from all commits
765bb2d
4a9ca82
23fe077
123ea5c
78b3994
50b1fe7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { resolveNaming } = require('../../dd-trace/test/plugins/helpers') | ||
|
||
module.exports = resolveNaming({ | ||
send: { | ||
v0: { | ||
opName: 'amqp.send', | ||
serviceName: 'test-amqp' | ||
}, | ||
v1: { | ||
opName: 'amqp.send', | ||
serviceName: 'test' | ||
} | ||
}, | ||
receive: { | ||
v0: { | ||
opName: 'amqp.receive', | ||
serviceName: 'test-amqp' | ||
}, | ||
v1: { | ||
opName: 'amqp.process', | ||
serviceName: 'test' | ||
} | ||
} | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,18 @@ const { getResourceName } = require('./util') | |
|
||
class AmqplibClientPlugin extends ClientPlugin { | ||
static get id () { return 'amqplib' } | ||
static get type () { return 'messaging' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is redundant with both the span kind and the IO direction, and could be set in the base class for most cases. Can we settle on just 1 and make sure that everything is normalized accordingly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Span kind can be integrated in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 05ad286 |
||
static get operation () { return 'command' } | ||
|
||
start ({ channel = {}, method, fields }) { | ||
if (method === 'basic.deliver' || method === 'basic.get') return | ||
if (method === 'basic.publish') return | ||
|
||
const stream = (channel.connection && channel.connection.stream) || {} | ||
const span = this.startSpan('amqp.command', { | ||
service: this.config.service || `${this.tracer._service}-amqp`, | ||
const span = this.startSpan(this.operationName(), { | ||
service: this.config.service || this.serviceName(), | ||
resource: getResourceName(method, fields), | ||
kind: 'client', | ||
kind: this.constructor.kind, | ||
meta: { | ||
'out.host': stream._host, | ||
[CLIENT_PORT_KEY]: stream.remotePort, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const { resolveNaming } = require('../../dd-trace/test/plugins/helpers') | ||
|
||
module.exports = resolveNaming({ | ||
send: { | ||
v0: { | ||
opName: 'amqp.command', | ||
serviceName: 'test-amqp' | ||
}, | ||
v1: { | ||
opName: 'amqp.send', | ||
serviceName: 'test' | ||
} | ||
}, | ||
receive: { | ||
v0: { | ||
opName: 'amqp.command', | ||
serviceName: 'test-amqp' | ||
}, | ||
v1: { | ||
opName: 'amqp.process', | ||
serviceName: 'test' | ||
} | ||
}, | ||
controlPlane: { | ||
v0: { | ||
opName: 'amqp.command', | ||
serviceName: 'test-amqp' | ||
}, | ||
v1: { | ||
opName: 'amqp.command', | ||
serviceName: 'test' | ||
} | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these need to be functions? Accepting an object could make this easier also when an override is not needed, for example
withNamingSchema(() => {}, namingSchema.send)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the way the tests are performed, they do need to be functions. I'm open to other ideas since I'm not a huge fan either 😅
namingSchema
is a proxy that resolves thev0
/v1
part of the naming schema, so it must be accessed inside the test case, because the configuration change that controlsv0
/v1
is kept at the test case level.