Sha256: f582581160423d74adb36b98493de3f40f33b03dbaf4e2cf788484a9488544ba

Contents?: true

Size: 1.58 KB

Versions: 21

Compression:

Stored size: 1.58 KB

Contents

/* eslint-disable class-methods-use-this */
const { obfuscate, analyzeQuery } = require('../../database');
const EventTree = require('./eventTree');

/**
 * At TRACE level, the order of labeled function calls matters, and all function class
 * and method names are retained. SQL queries are also retained in order. HTTP
 * server and client request parameters are retained.
 */
class Canonicalize extends EventTree {
  sql(event) {
    const analyzedQuery = analyzeQuery(event.sql);
    const result = {
      kind: 'sql',
      sql: {
        normalized_query: obfuscate(event.sqlQuery, event.sql.database_type),
      },
    };
    if (typeof analyzedQuery === 'object') {
      result.analyzed_query = analyzedQuery;
    }
    return result;
  }

  httpClientRequest(event) {
    return {
      kind: 'http_client_request',
      route: event.route,
      parameter_names: event.message ? event.message.map((m) => m.name) : null,
      status_code: event.httpClientResponse
        ? event.httpClientResponse.status_code
        : null,
    };
  }

  httpServerRequest(event) {
    return {
      kind: 'http_server_request',
      route: event.route,
      parameter_names: event.message ? event.message.map((m) => m.name) : null,
      status_code: event.httpServerResponse
        ? event.httpServerResponse.status ||
          event.httpServerResponse.status_code
        : null,
    };
  }

  functionCall(event) {
    return {
      kind: 'function',
      function: event.codeObject.id,
      labels: [...event.codeObject.labels],
    };
  }
}

module.exports = (appmap) => new Canonicalize(appmap).execute();

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
appmap-0.72.2 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.72.1 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.72.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.71.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.70.2 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.70.1 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.70.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.69.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.68.2 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.68.1 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.68.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.67.1 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.67.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.66.2 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.66.1 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.66.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.65.1 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.65.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.64.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js
appmap-0.63.0 ./node_modules/@appland/appmap/src/fingerprint/canonicalize/trace.js