本文整理汇总了TypeScript中dd-trace.use函数的典型用法代码示例。如果您正苦于以下问题:TypeScript use函数的具体用法?TypeScript use怎么用?TypeScript use使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了use函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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`,
})
}
示例2: useWebFrameworkPlugin
function useWebFrameworkPlugin(plugin: "express" | "hapi" | "koa" | "restify") {
tracer.use(plugin, {
service: "incoming-request",
headers: ["User-Agent"],
validateStatus: code => code !== 418,
});
}
示例3:
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`,
})
}