本文整理汇总了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;未经允许,请勿转载。 |
请发表评论