How to use @opencensus/instrumentation-http - 4 common examples

To help you get started, we’ve selected a few @opencensus/instrumentation-http 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 census-ecosystem / opencensus-experiments / interoptest / src / nodejsservice / server.js View on Github external
function enableHttpPlugin (tracer) {
  // 1. Define node version
  const version = process.versions.node;

  // 2. Enable HTTP plugin
  httpPlugin.plugin.enable(http, tracer, version, null);
}
github magma / magma / symphony / app / fbcnms-projects / platform-server / scripts / server.js View on Github external
import {PrometheusStatsExporter} from '@opencensus/exporter-prometheus';
import {globalStats} from '@opencensus/core';
import {registerAllViews} from '@opencensus/instrumentation-http';
import {runMigrations} from './runMigrations';

const {sequelize} = require('@fbcnms/sequelize-models');
const logger = logging.getLogger(module);
const port = parseInt(process.env.PORT || 80);

// Configure metrics
const prometheusExporter = new PrometheusStatsExporter({
  startServer: true,
  logger,
});
globalStats.registerExporter(prometheusExporter);
registerAllViews(globalStats);

let jaegerExporter = null;
if (process.env.TELEMETRY_TRACE_EXPORTER == 'jaeger') {
  if (
    !process.env.JAEGER_AGENT_ENDPOINT &&
    !process.env.JAEGER_COLLECTOR_ENDPOINT
  ) {
    throw new Error(
      'When using TELEMETRY_TRACE_EXPORTER = "jaeger", you ' +
        'must set either JAEGER_AGENT_ENDPOINT or JAEGER_COLLECTOR_ENDPOINT',
    );
  }
  // Configure opencensus for jaeger
  const agentEndpoint = process.env.JAEGER_AGENT_ENDPOINT;
  const [agentHost, agentPort] = agentEndpoint
    ? agentEndpoint.split(':')
github census-instrumentation / opencensus-node / packages / opencensus-instrumentation-http2 / src / http2.ts View on Github external
request.on('error', (err: Error) => {
        span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_NAME, err.name);
        span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_MESSAGE, err.message);

        span.end();
      });
github census-instrumentation / opencensus-node / packages / opencensus-instrumentation-http2 / src / http2.ts View on Github external
request.on('error', (err: Error) => {
        span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_NAME, err.name);
        span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_MESSAGE, err.message);

        span.end();
      });

@opencensus/instrumentation-http

Opencensus http automatic instrumentation package.

Apache-2.0
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis