apm-agent-nodejs icon indicating copy to clipboard operation
apm-agent-nodejs copied to clipboard

"Cassandra" Instrumentation Should Include Missing Destination Context

Open astorm opened this issue 5 years ago • 1 comments

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.

astorm avatar Nov 26 '20 01:11 astorm

Notes for if/when adding cassandra-driver destination context:

  • A successful cassandra-driver query will return a ResultSet from which queriedHost can 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? queriedHost is preferred, IMO, but might not always be available.
  • Also this is a good time to add captureError for query/connect errors.
  • Also span.setOutcome based on error-or-not

trentm avatar Sep 08 '22 22:09 trentm