• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript dd-trace.init函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中dd-trace.init函数的典型用法代码示例。如果您正苦于以下问题:TypeScript init函数的具体用法?TypeScript init怎么用?TypeScript init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了init函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: init

export function init() {
  const ddServicePrefix = "positron"

  tracer.init({
    // Setting the service name to  `.undetected` so that we detect services that
    // are running as part of the application, but aren't explicitly configured
    // with `tracer.use`. We want to to explicitly configure services so that we
    // can enforce our `.`-deliminited Service naming convention.
    service: `${ddServicePrefix}.undetected`,
    hostname: process.env.DATADOG_AGENT_HOSTNAME,
  })

  tracer.use("express", {
    service: `${ddServicePrefix}`,
  })

  tracer.use("mongodb-core", {
    service: `${ddServicePrefix}.mongodb`,
  })

  tracer.use("elasticsearch", {
    service: `${ddServicePrefix}.elasticsearch`,
  })

  tracer.use("http", {
    service: `${ddServicePrefix}.http`,
  })
}
开发者ID:artsy,项目名称:positron,代码行数:28,代码来源:tracer.ts


示例2: require

import * as ddTrace from 'dd-trace';
import SpanContext = require('dd-trace/src/opentracing/span_context');

const tracer = ddTrace.init({
    service: 'MyLovelyService',
    hostname: 'localhost',
    port: 8126,
});

tracer
    .trace('web.request', {
        service: 'my_service',
        childOf: new SpanContext({ traceId: 1337, spanId: 42 }),
        tags: {
            env: 'dev'
        }
    })
    .then(span => {
        span.setTag('my_tag', 'my_value');
        span.finish();
    });
开发者ID:Cellule,项目名称:DefinitelyTyped,代码行数:21,代码来源:dd-trace-tests.ts


示例3: require

import * as tracer from "dd-trace";
import SpanContext = require("dd-trace/src/opentracing/span_context");

tracer.init({
    enabled: true,
    service: "MyLovelyService",
    hostname: "localhost",
    port: 8126,
    env: "dev",
    logger: {
        debug: msg => {},
        error: err => {},
    }
});

function useWebFrameworkPlugin(plugin: "express" | "hapi" | "koa" | "restify") {
    tracer.use(plugin, {
        service: "incoming-request",
        headers: ["User-Agent"],
        validateStatus: code => code !== 418,
    });
}

tracer.use("graphql", {
    depth: 1,
    // Can’t use spread operator here due to https://github.com/Microsoft/TypeScript/issues/10727
    // tslint:disable-next-line:prefer-object-spread
    variables: variables => Object.assign({}, variables, { password: "REDACTED" }),
});

tracer.use("http", {
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:31,代码来源:dd-trace-tests.ts


示例4:

import ddTracer from "dd-trace"

if (process.env.DD_APM_ENABLED) {
  ddTracer.init({
    hostname: process.env.DD_TRACE_AGENT_HOSTNAME,
    service: "force",
    plugins: false,
  })
  ddTracer.use("express", {
    // We want the root spans of MP to be labelled as just `service`
    service: "force",
    headers: ["User-Agent"],
  })
  ddTracer.use("http", {
    service: `force.http-client`,
  })
}
开发者ID:artsy,项目名称:force-public,代码行数:17,代码来源:datadog.ts


示例5: require

import * as tracer from 'dd-trace';
import SpanContext = require('dd-trace/src/opentracing/span_context');

tracer.init({
    service: 'MyLovelyService',
    hostname: 'localhost',
    port: 8126,
    logger: {
        debug: msg => { },
        error: err => { }
    }
});

tracer
    .trace('web.request', {
        service: 'my_service',
        childOf: new SpanContext({ traceId: 1337, spanId: 42 }), // Childof must be an instance of this type. See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
        tags: {
            env: 'dev'
        }
    })
    .then(span => {
        span.setTag('my_tag', 'my_value');
        span.finish();
    });

const parentScope = tracer.scopeManager().active();
const span = tracer.startSpan('memcached', {
    childOf: parentScope && parentScope.span(),
    tags: {
        'service.name': 'my-memcached',
开发者ID:danmarshall,项目名称:DefinitelyTyped,代码行数:31,代码来源:dd-trace-tests.ts


示例6: require

import * as tracer from "dd-trace";
import SpanContext = require("dd-trace/src/opentracing/span_context");

tracer.init({
    service: "MyLovelyService",
    hostname: "localhost",
    port: 8126,
    logger: {
        debug: msg => {},
        error: err => {},
    },
    tags: { tracerEnv: 'dev'}
});

function useWebFrameworkPlugin(plugin: "express" | "hapi" | "koa" | "restify") {
    tracer.use(plugin, {
        service: "incoming-request",
        headers: ["User-Agent"],
        validateStatus: code => code !== 418,
    });
}

tracer.use("graphql", {
    depth: 1,
    // Can’t use spread operator here due to https://github.com/Microsoft/TypeScript/issues/10727
    // tslint:disable-next-line:prefer-object-spread
    variables: variables => Object.assign({}, variables, { password: "REDACTED" }),
});

tracer.use("http", {
    splitByDomain: true,
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:31,代码来源:dd-trace-tests.ts


示例7:

import * as ddTrace from 'dd-trace';

const tracer = ddTrace.init();

tracer
    .trace('web.request', {
        service: 'my_service'
    })
    .then(span => {
        span.setTag('my_tag', 'my_value');
        span.finish();
    });
开发者ID:clabough,项目名称:DefinitelyTyped,代码行数:12,代码来源:dd-trace-tests.ts



注:本文中的dd-trace.init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript dd-trace.use函数代码示例发布时间:2022-05-25
下一篇:
TypeScript dc.events类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap