How to use the @dynatrace/oneagent-sdk.DatabaseVendor function in @dynatrace/oneagent-sdk

To help you get started, we’ve selected a few @dynatrace/oneagent-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dynatrace / OneAgent-SDK-for-NodeJs / samples / Database / DatabaseRequestSample.js View on Github external
// ----------------------------------------------------------------------------
// Create the connection to database
const dbConfig = {
  host: "localhost",
  port: 57615,
  user: "root",
  password: "12345",
  database: "TestDb"
};
const connection = somesqldb.createConnection(dbConfig);

// Static info describing the database
const dbInfo = {
  name: dbConfig.database,
  vendor: Sdk.DatabaseVendor.MARIADB,
  host: dbConfig.host,
  port: dbConfig.port
};

// Issue a traced SQL database request
function tracedSqlDatabaseRequest(sql, clientCb) {
  // create a SQL database tracer
  const tracer = Api.traceSQLDatabaseRequest(dbInfo, {
    statement: sql
  });

  // start tracer, calls connection.query(sql, cb) with connection set as this in query()
  tracer.startWithContext(connection.query, connection, sql, (err, results, fields) => {
    if (err) {
      // set the error on the tracer
      tracer.error(err);

@dynatrace/oneagent-sdk

Node.js SDK for Dynatrace OneAgent

Apache-2.0
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis