apm-agent-nodejs
apm-agent-nodejs copied to clipboard
"Cassandra" Instrumentation Should Include Missing Destination Context
Is your feature request related to a problem? Please describe.
Similar to this MongoDB ticket, it looks like our Cassandra Instrumentation does not set a destination context on its spans. This means Cassandra will be absent from the Service Map.
We should consider adding destination context to the Cassandra spans.
Notes for if/when adding cassandra-driver destination context:
- A successful cassandra-driver query will return a ResultSet from which
queriedHostcan be used for dest context.ResultSet { info: { queriedHost: '127.0.0.1:9042', triedHosts: [Object], speculativeExecutions: 0, achievedConsistency: 10, traceId: undefined, warnings: undefined, customPayload: undefined, isSchemaInAgreement: true }, rows: undefined, rowLength: undefined, columns: null, pageState: null, nextPage: undefined, nextPageAsync: undefined } } - This requires some light refactoring to cleaning get that ResultSet for callback and promise forms.
- This needs some testing for whether we get that 'queriedHost' for failed queries as well.
- An alternative is to use the ClientOptions configured
contactPoints(https://docs.datastax.com/en/developer/nodejs-driver/4.6/api/type.ClientOptions/). If so, which one? Also we need to normalize to add the default port?queriedHostis preferred, IMO, but might not always be available. - Also this is a good time to add
captureErrorfor query/connect errors. - Also
span.setOutcomebased on error-or-not