{
    "componentChunkName": "component---node-modules-shenhh-smooth-doc-src-templates-doc-js",
    "path": "/docs/languages/javascript/",
    "result": {"data":{"mdx":{"fields":{"pageType":"doc","title":"JavaScript/Node.js 接入指南","editLink":"https://gitlab.corp.youdao.com/DevOPS/apm/docs/edit/master/pages/docs/languages/javascript.mdx"},"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"JavaScript/Node.js 接入指南\",\n  \"section\": \"语言接入指南\",\n  \"slug\": \"/docs/languages/javascript/\",\n  \"order\": 4\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h1\", {\n    \"id\": \"javascriptnodejs-opentelemetry-接入指南\"\n  }, mdx(\"a\", {\n    parentName: \"h1\",\n    \"href\": \"#javascriptnodejs-opentelemetry-%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"JavaScript/Node.js OpenTelemetry \\u63A5\\u5165\\u6307\\u5357\"), mdx(\"p\", null, \"\\u672C\\u6587\\u6863\\u63D0\\u4F9B JavaScript/Node.js \\u5E94\\u7528\\u63A5\\u5165 OpenTelemetry \\u7684\\u5B8C\\u6574\\u6307\\u5357\\uFF0C\\u5305\\u62EC\\u96F6\\u4EE3\\u7801\\u63A5\\u5165\\u548C SDK \\u624B\\u52A8\\u63A5\\u5165\\u4E24\\u79CD\\u65B9\\u5F0F\\uFF0C\\u652F\\u6301 Node.js \\u548C\\u6D4F\\u89C8\\u5668\\u73AF\\u5883\\u3002\"), mdx(\"h2\", {\n    \"id\": \"目录\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#%E7%9B%AE%E5%BD%95\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u76EE\\u5F55\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#%E6%A6%82%E8%BF%B0\"\n  }, \"\\u6982\\u8FF0\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#%E9%9B%B6%E4%BB%A3%E7%A0%81%E6%8E%A5%E5%85%A5%E6%8E%A8%E8%8D%90\"\n  }, \"\\u96F6\\u4EE3\\u7801\\u63A5\\u5165\\uFF08\\u63A8\\u8350\\uFF09\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#sdk-%E6%89%8B%E5%8A%A8%E6%8E%A5%E5%85%A5\"\n  }, \"SDK \\u624B\\u52A8\\u63A5\\u5165\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#%E6%A1%86%E6%9E%B6%E9%9B%86%E6%88%90%E7%A4%BA%E4%BE%8B\"\n  }, \"\\u6846\\u67B6\\u96C6\\u6210\\u793A\\u4F8B\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#%E6%B5%8F%E8%A7%88%E5%99%A8%E7%AB%AF%E6%8E%A5%E5%85%A5\"\n  }, \"\\u6D4F\\u89C8\\u5668\\u7AEF\\u63A5\\u5165\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#%E9%AB%98%E7%BA%A7%E9%85%8D%E7%BD%AE\"\n  }, \"\\u9AD8\\u7EA7\\u914D\\u7F6E\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5\"\n  }, \"\\u6700\\u4F73\\u5B9E\\u8DF5\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#%E6%95%85%E9%9A%9C%E6%8E%92%E6%9F%A5\"\n  }, \"\\u6545\\u969C\\u6392\\u67E5\"))), mdx(\"hr\", null), mdx(\"h2\", {\n    \"id\": \"概述\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#%E6%A6%82%E8%BF%B0\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u6982\\u8FF0\"), mdx(\"h3\", {\n    \"id\": \"javascriptnodejs-特性\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#javascriptnodejs-%E7%89%B9%E6%80%A7\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"JavaScript/Node.js \\u7279\\u6027\"), mdx(\"p\", null, \"JavaScript/Node.js \\u7684 OpenTelemetry \\u652F\\u6301\\u5177\\u6709\\u4EE5\\u4E0B\\u7279\\u70B9:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"\\u6210\\u719F\\u7A33\\u5B9A\"), \": API \\u548C SDK \\u5DF2\\u8FBE\\u5230 1.0 \\u7A33\\u5B9A\\u7248\\u672C\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"\\u96F6\\u4EE3\\u7801\\u63A5\\u5165\"), \": \\u901A\\u8FC7\\u81EA\\u52A8\\u57CB\\u70B9\\u5E93\\u5B9E\\u73B0\\u96F6\\u4FB5\\u5165\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"\\u5168\\u6808\\u652F\\u6301\"), \": \\u540C\\u65F6\\u652F\\u6301 Node.js \\u670D\\u52A1\\u7AEF\\u548C\\u6D4F\\u89C8\\u5668\\u7AEF\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"\\u4E30\\u5BCC\\u7684\\u57CB\\u70B9\\u5E93\"), \": \\u652F\\u6301 30+ \\u4E3B\\u6D41\\u6846\\u67B6\\u548C\\u5E93\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"TypeScript \\u652F\\u6301\"), \": \\u5B8C\\u6574\\u7684 TypeScript \\u7C7B\\u578B\\u5B9A\\u4E49\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"\\u5F02\\u6B65\\u53CB\\u597D\"), \": \\u5B8C\\u7F8E\\u652F\\u6301 Promise \\u548C async/await\")), mdx(\"h3\", {\n    \"id\": \"版本要求\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u7248\\u672C\\u8981\\u6C42\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Node.js \\u7248\\u672C\"), \": 14.0.0+ (\\u63A8\\u8350 18.0.0+)\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"OpenTelemetry JS\"), \": v1.0.0+\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"\\u652F\\u6301\\u67B6\\u6784\"), \": x64, arm64\")), mdx(\"h3\", {\n    \"id\": \"支持的信号\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E6%94%AF%E6%8C%81%E7%9A%84%E4%BF%A1%E5%8F%B7\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u652F\\u6301\\u7684\\u4FE1\\u53F7\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"\\u2705 \", mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Traces\"), \": \\u5B8C\\u5168\\u652F\\u6301\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"\\u2705 \", mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Metrics\"), \": \\u5B8C\\u5168\\u652F\\u6301\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"\\u2705 \", mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Logs\"), \": \\u652F\\u6301\\uFF08\\u901A\\u8FC7\\u65E5\\u5FD7\\u5E93\\u96C6\\u6210\\uFF09\")), mdx(\"h3\", {\n    \"id\": \"适用场景\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E9%80%82%E7%94%A8%E5%9C%BA%E6%99%AF\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u9002\\u7528\\u573A\\u666F\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Node.js Web \\u670D\\u52A1\\uFF08Express\\u3001Koa\\u3001Fastify\\uFF09\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Next.js\\u3001Nuxt.js \\u7B49\\u5168\\u6808\\u6846\\u67B6\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"\\u6D4F\\u89C8\\u5668\\u7AEF\\u5E94\\u7528\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"\\u5FAE\\u670D\\u52A1\\u67B6\\u6784\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Serverless \\u51FD\\u6570\\uFF08AWS Lambda\\u3001Vercel Functions\\uFF09\")), mdx(\"hr\", null), mdx(\"h2\", {\n    \"id\": \"零代码接入推荐\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#%E9%9B%B6%E4%BB%A3%E7%A0%81%E6%8E%A5%E5%85%A5%E6%8E%A8%E8%8D%90\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u96F6\\u4EE3\\u7801\\u63A5\\u5165\\uFF08\\u63A8\\u8350\\uFF09\"), mdx(\"p\", null, \"\\u96F6\\u4EE3\\u7801\\u63A5\\u5165\\u65E0\\u9700\\u4FEE\\u6539\\u5E94\\u7528\\u4EE3\\u7801\\uFF0C\\u901A\\u8FC7\\u81EA\\u52A8\\u57CB\\u70B9\\u5E93\\u5373\\u53EF\\u5B9E\\u73B0\\u81EA\\u52A8\\u76D1\\u63A7\\u3002\\u8FD9\\u662F\\u6700\\u7B80\\u5355\\u5FEB\\u6377\\u7684\\u63A5\\u5165\\u65B9\\u5F0F\\u3002\"), mdx(\"h3\", {\n    \"id\": \"快速开始\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u5FEB\\u901F\\u5F00\\u59CB\"), mdx(\"h4\", {\n    \"id\": \"1-安装依赖\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#1-%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"1. \\u5B89\\u88C5\\u4F9D\\u8D56\"), mdx(\"p\", null, \"\\u53EA\\u9700\\u8981\\u5B89\\u88C5\\u4E24\\u4E2A\\u5305\\uFF1A\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"npm install --save @opentelemetry/api\\nnpm install --save @opentelemetry/auto-instrumentations-node\\n\")), mdx(\"p\", null, \"\\u6216\\u4F7F\\u7528 yarn:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"yarn add @opentelemetry/api @opentelemetry/auto-instrumentations-node\\n\")), mdx(\"p\", null, \"\\u6216\\u4F7F\\u7528 pnpm:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"pnpm add @opentelemetry/api @opentelemetry/auto-instrumentations-node\\n\")), mdx(\"h4\", {\n    \"id\": \"2-配置环境变量\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#2-%E9%85%8D%E7%BD%AE%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"2. \\u914D\\u7F6E\\u73AF\\u5883\\u53D8\\u91CF\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"# \\u670D\\u52A1\\u4FE1\\u606F\\nexport OTEL_SERVICE_NAME=my-node-service\\nexport OTEL_SERVICE_VERSION=1.0.0\\nexport OTEL_RESOURCE_ATTRIBUTES=deployment.environment=production\\n\\n# OTLP Exporter\\uFF08\\u5185\\u90E8\\u5E73\\u53F0\\uFF09\\nexport OTEL_EXPORTER_OTLP_ENDPOINT=uptrace-grpc.yodao.cn:4317\\nexport OTEL_EXPORTER_OTLP_PROTOCOL=grpc\\nexport OTEL_EXPORTER_OTLP_HEADERS=uptrace-dsn=http://token@uptrace-grpc.yodao.cn/project?grpc=4317\\n\\n# Traces \\u914D\\u7F6E\\nexport OTEL_TRACES_EXPORTER=otlp\\nexport OTEL_TRACES_SAMPLER=parentbased_traceidratio\\nexport OTEL_TRACES_SAMPLER_ARG=0.1\\n\\n# Metrics \\u914D\\u7F6E\\nexport OTEL_METRICS_EXPORTER=otlp\\nexport OTEL_METRIC_EXPORT_INTERVAL=60000\\n\")), mdx(\"h4\", {\n    \"id\": \"3-启动应用\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#3-%E5%90%AF%E5%8A%A8%E5%BA%94%E7%94%A8\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"3. \\u542F\\u52A8\\u5E94\\u7528\"), mdx(\"p\", null, \"\\u4F7F\\u7528 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"--require\"), \" \\u53C2\\u6570\\u76F4\\u63A5\\u52A0\\u8F7D\\u81EA\\u52A8\\u57CB\\u70B9\\u5E93\\uFF0C\", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"\\u65E0\\u9700\\u521B\\u5EFA\\u4EFB\\u4F55\\u6587\\u4EF6\"), \"\\uFF1A\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"node --require @opentelemetry/auto-instrumentations-node/register app.js\\n\")), mdx(\"p\", null, \"\\u5C31\\u8FD9\\u4E48\\u7B80\\u5355\\uFF01\\u60A8\\u7684\\u5E94\\u7528\\u73B0\\u5728\\u5DF2\\u7ECF\\u81EA\\u52A8\\u57CB\\u70B9\\u5E76\\u5F00\\u59CB\\u53D1\\u9001\\u9065\\u6D4B\\u6570\\u636E\\u4E86\\u3002\"), mdx(\"h3\", {\n    \"id\": \"其他启动方式\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E5%85%B6%E4%BB%96%E5%90%AF%E5%8A%A8%E6%96%B9%E5%BC%8F\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u5176\\u4ED6\\u542F\\u52A8\\u65B9\\u5F0F\"), mdx(\"h4\", {\n    \"id\": \"方式-1-使用-node_options-环境变量\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E6%96%B9%E5%BC%8F-1-%E4%BD%BF%E7%94%A8-node_options-%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u65B9\\u5F0F 1: \\u4F7F\\u7528 NODE_OPTIONS \\u73AF\\u5883\\u53D8\\u91CF\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"export NODE_OPTIONS=\\\"--require @opentelemetry/auto-instrumentations-node/register\\\"\\nnode app.js\\n\")), mdx(\"h4\", {\n    \"id\": \"方式-2-在-packagejson-中配置\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E6%96%B9%E5%BC%8F-2-%E5%9C%A8-packagejson-%E4%B8%AD%E9%85%8D%E7%BD%AE\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u65B9\\u5F0F 2: \\u5728 package.json \\u4E2D\\u914D\\u7F6E\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"{\\n  \\\"scripts\\\": {\\n    \\\"start\\\": \\\"node --require @opentelemetry/auto-instrumentations-node/register app.js\\\",\\n    \\\"dev\\\": \\\"node --require @opentelemetry/auto-instrumentations-node/register --watch app.js\\\"\\n  }\\n}\\n\")), mdx(\"h4\", {\n    \"id\": \"方式-3-使用-env-命令一行命令\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E6%96%B9%E5%BC%8F-3-%E4%BD%BF%E7%94%A8-env-%E5%91%BD%E4%BB%A4%E4%B8%80%E8%A1%8C%E5%91%BD%E4%BB%A4\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u65B9\\u5F0F 3: \\u4F7F\\u7528 env \\u547D\\u4EE4\\uFF08\\u4E00\\u884C\\u547D\\u4EE4\\uFF09\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"env OTEL_SERVICE_NAME=my-service \\\\\\n     OTEL_EXPORTER_OTLP_ENDPOINT=uptrace-grpc.yodao.cn:4317 \\\\\\n     OTEL_EXPORTER_OTLP_HEADERS=uptrace-dsn=http://token@uptrace-grpc.yodao.cn/project?grpc=4317 \\\\\\n     node --require @opentelemetry/auto-instrumentations-node/register app.js\\n\")), mdx(\"h3\", {\n    \"id\": \"资源检测器配置\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E8%B5%84%E6%BA%90%E6%A3%80%E6%B5%8B%E5%99%A8%E9%85%8D%E7%BD%AE\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u8D44\\u6E90\\u68C0\\u6D4B\\u5668\\u914D\\u7F6E\"), mdx(\"p\", null, \"\\u9ED8\\u8BA4\\u60C5\\u51B5\\u4E0B\\uFF0C\\u6240\\u6709 SDK \\u8D44\\u6E90\\u68C0\\u6D4B\\u5668\\u90FD\\u4F1A\\u88AB\\u4F7F\\u7528\\u3002\\u60A8\\u53EF\\u4EE5\\u901A\\u8FC7\\u73AF\\u5883\\u53D8\\u91CF\\u63A7\\u5236\\uFF1A\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"# \\u542F\\u7528\\u7279\\u5B9A\\u7684\\u8D44\\u6E90\\u68C0\\u6D4B\\u5668\\nexport OTEL_NODE_RESOURCE_DETECTORS=env,host,os\\n\\n# \\u7981\\u7528\\u6240\\u6709\\u8D44\\u6E90\\u68C0\\u6D4B\\u5668\\nexport OTEL_NODE_RESOURCE_DETECTORS=\\\"\\\"\\n\")), mdx(\"p\", null, \"\\u53EF\\u7528\\u7684\\u8D44\\u6E90\\u68C0\\u6D4B\\u5668\\uFF1A\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"env\"), \": \\u4ECE\\u73AF\\u5883\\u53D8\\u91CF\\u8BFB\\u53D6\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"host\"), \": \\u4E3B\\u673A\\u4FE1\\u606F\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"os\"), \": \\u64CD\\u4F5C\\u7CFB\\u7EDF\\u4FE1\\u606F\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"process\"), \": \\u8FDB\\u7A0B\\u4FE1\\u606F\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"service\"), \": \\u670D\\u52A1\\u4FE1\\u606F\")), mdx(\"h3\", {\n    \"id\": \"支持的自动埋点库\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E6%94%AF%E6%8C%81%E7%9A%84%E8%87%AA%E5%8A%A8%E5%9F%8B%E7%82%B9%E5%BA%93\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u652F\\u6301\\u7684\\u81EA\\u52A8\\u57CB\\u70B9\\u5E93\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"@opentelemetry/auto-instrumentations-node\"), \" \\u5305\\u542B\\u4EE5\\u4E0B\\u81EA\\u52A8\\u57CB\\u70B9\\u5E93:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"HTTP/HTTPS\"), \": \\u6807\\u51C6\\u5E93 http/https \\u6A21\\u5757\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Express\"), \": Express.js Web \\u6846\\u67B6\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Koa\"), \": Koa.js Web \\u6846\\u67B6\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Fastify\"), \": Fastify Web \\u6846\\u67B6\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"NestJS\"), \": NestJS \\u6846\\u67B6\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Hapi\"), \": Hapi.js \\u6846\\u67B6\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Restify\"), \": Restify \\u6846\\u67B6\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"gRPC\"), \": gRPC \\u5BA2\\u6237\\u7AEF\\u548C\\u670D\\u52A1\\u7AEF\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"MongoDB\"), \": MongoDB \\u9A71\\u52A8\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Redis\"), \": ioredis \\u548C node_redis\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"MySQL\"), \": mysql2 \\u548C mysql\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"PostgreSQL\"), \": pg\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Elasticsearch\"), \": @elastic/elasticsearch\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"AWS SDK\"), \": AWS SDK v2 \\u548C v3\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"GraphQL\"), \": graphql\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Winston\"), \": Winston \\u65E5\\u5FD7\\u5E93\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Pino\"), \": Pino \\u65E5\\u5FD7\\u5E93\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Bunyan\"), \": Bunyan \\u65E5\\u5FD7\\u5E93\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"DNS\"), \": dns \\u6A21\\u5757\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Net\"), \": net \\u6A21\\u5757\")), mdx(\"h3\", {\n    \"id\": \"选择性启用埋点库\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E9%80%89%E6%8B%A9%E6%80%A7%E5%90%AF%E7%94%A8%E5%9F%8B%E7%82%B9%E5%BA%93\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u9009\\u62E9\\u6027\\u542F\\u7528\\u57CB\\u70B9\\u5E93\"), mdx(\"p\", null, \"\\u5982\\u679C\\u4E0D\\u60F3\\u542F\\u7528\\u6240\\u6709\\u57CB\\u70B9\\u5E93\\uFF0C\\u53EF\\u4EE5\\u624B\\u52A8\\u9009\\u62E9:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { NodeSDK } = require('@opentelemetry/sdk-node');\\nconst { \\n  HttpInstrumentation,\\n  ExpressInstrumentation,\\n  FsInstrumentation,\\n} = require('@opentelemetry/instrumentation');\\n\\nconst sdk = new NodeSDK({\\n  instrumentations: [\\n    new HttpInstrumentation(),\\n    new ExpressInstrumentation(),\\n    new FsInstrumentation(),\\n  ],\\n});\\n\\nsdk.start();\\n\")), mdx(\"h3\", {\n    \"id\": \"验证零代码接入\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E9%AA%8C%E8%AF%81%E9%9B%B6%E4%BB%A3%E7%A0%81%E6%8E%A5%E5%85%A5\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u9A8C\\u8BC1\\u96F6\\u4EE3\\u7801\\u63A5\\u5165\"), mdx(\"p\", null, \"\\u542F\\u52A8\\u5E94\\u7528\\u540E\\uFF0C\\u8BBF\\u95EE\\u60A8\\u7684\\u670D\\u52A1\\u7AEF\\u70B9\\uFF0C\\u7136\\u540E\\u5728 APM \\u5E73\\u53F0\\u67E5\\u770B\\u6570\\u636E:\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Traces\"), \": \\u67E5\\u770B\\u8C03\\u7528\\u94FE\\u8DEF\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Metrics\"), \": \\u67E5\\u770B\\u8BF7\\u6C42\\u91CF\\u3001\\u5EF6\\u8FDF\\u7B49\\u6307\\u6807\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"Service Map\"), \": \\u67E5\\u770B\\u670D\\u52A1\\u62D3\\u6251\\u56FE\")), mdx(\"h4\", {\n    \"id\": \"快速验证\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E5%BF%AB%E9%80%9F%E9%AA%8C%E8%AF%81\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u5FEB\\u901F\\u9A8C\\u8BC1\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"# \\u542F\\u52A8\\u5E94\\u7528\\nnode --require @opentelemetry/auto-instrumentations-node/register app.js\\n\\n# \\u5728\\u53E6\\u4E00\\u4E2A\\u7EC8\\u7AEF\\u53D1\\u9001\\u6D4B\\u8BD5\\u8BF7\\u6C42\\ncurl http://localhost:3000/health\\n\\n# \\u7B49\\u5F85\\u51E0\\u79D2\\u540E\\uFF0C\\u5728 APM \\u5E73\\u53F0\\u67E5\\u770B\\u6570\\u636E\\n\")), mdx(\"h3\", {\n    \"id\": \"日志级别配置\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E6%97%A5%E5%BF%97%E7%BA%A7%E5%88%AB%E9%85%8D%E7%BD%AE\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u65E5\\u5FD7\\u7EA7\\u522B\\u914D\\u7F6E\"), mdx(\"p\", null, \"\\u53EF\\u4EE5\\u901A\\u8FC7\\u73AF\\u5883\\u53D8\\u91CF\\u8BBE\\u7F6E\\u65E5\\u5FD7\\u7EA7\\u522B\\u6765\\u8C03\\u8BD5\\u95EE\\u9898\\uFF1A\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"# \\u8BBE\\u7F6E\\u65E5\\u5FD7\\u7EA7\\u522B\\uFF08\\u4ECE\\u4F4E\\u5230\\u9AD8\\uFF09\\nexport OTEL_LOG_LEVEL=none      # \\u4E0D\\u8F93\\u51FA\\u65E5\\u5FD7\\nexport OTEL_LOG_LEVEL=error     # \\u4EC5\\u9519\\u8BEF\\nexport OTEL_LOG_LEVEL=warn      # \\u8B66\\u544A\\u53CA\\u4EE5\\u4E0A\\nexport OTEL_LOG_LEVEL=info      # \\u4FE1\\u606F\\u53CA\\u4EE5\\u4E0A\\uFF08\\u9ED8\\u8BA4\\uFF09\\nexport OTEL_LOG_LEVEL=debug      # \\u8C03\\u8BD5\\u4FE1\\u606F\\nexport OTEL_LOG_LEVEL=verbose   # \\u8BE6\\u7EC6\\u4FE1\\u606F\\nexport OTEL_LOG_LEVEL=all       # \\u6240\\u6709\\u65E5\\u5FD7\\n\")), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"\\u6CE8\\u610F\"), \"\\uFF1A\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"\\u751F\\u4EA7\\u73AF\\u5883\\u5EFA\\u8BAE\\u4F7F\\u7528 \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"info\"), \" \\u7EA7\\u522B\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"\\u65E5\\u5FD7\\u59CB\\u7EC8\\u8F93\\u51FA\\u5230 \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"console\"), \"\\uFF0C\\u4E0D\\u53D7\\u73AF\\u5883\\u6216\\u8C03\\u8BD5\\u7EA7\\u522B\\u5F71\\u54CD\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"\\u8C03\\u8BD5\\u65E5\\u5FD7\\u975E\\u5E38\\u8BE6\\u7EC6\\uFF0C\\u53EF\\u80FD\\u5F71\\u54CD\\u5E94\\u7528\\u6027\\u80FD\\uFF0C\\u4EC5\\u5728\\u9700\\u8981\\u65F6\\u542F\\u7528\")), mdx(\"hr\", null), mdx(\"h2\", {\n    \"id\": \"sdk-手动接入\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#sdk-%E6%89%8B%E5%8A%A8%E6%8E%A5%E5%85%A5\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"SDK \\u624B\\u52A8\\u63A5\\u5165\"), mdx(\"p\", null, \"SDK \\u624B\\u52A8\\u63A5\\u5165\\u63D0\\u4F9B\\u66F4\\u7CBE\\u7EC6\\u7684\\u63A7\\u5236\\u548C\\u81EA\\u5B9A\\u4E49\\u80FD\\u529B\\u3002\"), mdx(\"h3\", {\n    \"id\": \"安装依赖\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u5B89\\u88C5\\u4F9D\\u8D56\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"npm install --save @opentelemetry/api\\nnpm install --save @opentelemetry/sdk-node\\nnpm install --save @opentelemetry/exporter-trace-otlp-grpc\\nnpm install --save @opentelemetry/exporter-metrics-otlp-grpc\\nnpm install --save @opentelemetry/resources\\nnpm install --save @opentelemetry/semantic-conventions\\n\")), mdx(\"h3\", {\n    \"id\": \"基础初始化\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E5%9F%BA%E7%A1%80%E5%88%9D%E5%A7%8B%E5%8C%96\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u57FA\\u7840\\u521D\\u59CB\\u5316\"), mdx(\"h4\", {\n    \"id\": \"创建-opentelemetry-初始化文件\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E5%88%9B%E5%BB%BA-opentelemetry-%E5%88%9D%E5%A7%8B%E5%8C%96%E6%96%87%E4%BB%B6\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u521B\\u5EFA OpenTelemetry \\u521D\\u59CB\\u5316\\u6587\\u4EF6\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// otel.js\\nconst { NodeSDK } = require('@opentelemetry/sdk-node');\\nconst { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');\\nconst { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');\\nconst { Resource } = require('@opentelemetry/resources');\\nconst { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');\\nconst { BatchSpanProcessor } = require('@opentelemetry/sdk-trace-base');\\nconst { PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');\\n\\nfunction initOpenTelemetry() {\\n  const resource = new Resource({\\n    [SemanticResourceAttributes.SERVICE_NAME]: process.env.OTEL_SERVICE_NAME || 'my-service',\\n    [SemanticResourceAttributes.SERVICE_VERSION]: process.env.OTEL_SERVICE_VERSION || '1.0.0',\\n  });\\n\\n  const traceExporter = new OTLPTraceExporter({\\n    url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4317',\\n    headers: process.env.OTEL_EXPORTER_OTLP_HEADERS ? \\n      Object.fromEntries(\\n        process.env.OTEL_EXPORTER_OTLP_HEADERS.split(',').map(h => h.split('='))\\n      ) : {},\\n  });\\n\\n  const metricExporter = new OTLPMetricExporter({\\n    url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4317',\\n    headers: process.env.OTEL_EXPORTER_OTLP_HEADERS ? \\n      Object.fromEntries(\\n        process.env.OTEL_EXPORTER_OTLP_HEADERS.split(',').map(h => h.split('='))\\n      ) : {},\\n  });\\n\\n  const sdk = new NodeSDK({\\n    resource,\\n    traceExporter,\\n    spanProcessor: new BatchSpanProcessor(traceExporter, {\\n      maxExportBatchSize: 512,\\n      scheduledDelayMillis: 5000,\\n    }),\\n    metricReader: new PeriodicExportingMetricReader({\\n      exporter: metricExporter,\\n      exportIntervalMillis: 60000,\\n    }),\\n  });\\n\\n  sdk.start();\\n\\n  return {\\n    shutdown: async () => {\\n      await sdk.shutdown();\\n    },\\n  };\\n}\\n\\nmodule.exports = { initOpenTelemetry };\\n\")), mdx(\"h4\", {\n    \"id\": \"在应用中使用\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E5%9C%A8%E5%BA%94%E7%94%A8%E4%B8%AD%E4%BD%BF%E7%94%A8\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u5728\\u5E94\\u7528\\u4E2D\\u4F7F\\u7528\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// app.js\\nconst { initOpenTelemetry } = require('./otel');\\n\\n// \\u5728\\u5E94\\u7528\\u542F\\u52A8\\u524D\\u521D\\u59CB\\u5316\\nconst otel = initOpenTelemetry();\\n\\n// \\u5E94\\u7528\\u903B\\u8F91\\nconst express = require('express');\\nconst app = express();\\n\\napp.get('/health', (req, res) => {\\n  res.json({ status: 'ok' });\\n});\\n\\napp.listen(3000, () => {\\n  console.log('Server running on port 3000');\\n});\\n\\n// \\u4F18\\u96C5\\u5173\\u95ED\\nprocess.on('SIGTERM', async () => {\\n  await otel.shutdown();\\n  process.exit(0);\\n});\\n\")), mdx(\"h3\", {\n    \"id\": \"traces---手动埋点\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#traces---%E6%89%8B%E5%8A%A8%E5%9F%8B%E7%82%B9\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Traces - \\u624B\\u52A8\\u57CB\\u70B9\"), mdx(\"h4\", {\n    \"id\": \"创建和使用-span\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E5%88%9B%E5%BB%BA%E5%92%8C%E4%BD%BF%E7%94%A8-span\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u521B\\u5EFA\\u548C\\u4F7F\\u7528 Span\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { trace } = require('@opentelemetry/api');\\n\\nconst tracer = trace.getTracer('my-service');\\n\\nasync function processOrder(orderId) {\\n  const span = tracer.startSpan('process_order', {\\n    attributes: {\\n      'order.id': orderId,\\n      'operation': 'process',\\n    },\\n  });\\n\\n  try {\\n    span.addEvent('order_validation_started');\\n\\n    await validateOrder(orderId);\\n\\n    span.addEvent('order_validated');\\n\\n    await chargePayment(orderId);\\n\\n    span.addEvent('payment_processed');\\n\\n    span.setStatus({ code: 1 }); // OK\\n    span.setAttribute('order.success', true);\\n  } catch (error) {\\n    span.recordException(error);\\n    span.setStatus({ code: 2, message: error.message }); // ERROR\\n    throw error;\\n  } finally {\\n    span.end();\\n  }\\n}\\n\")), mdx(\"h4\", {\n    \"id\": \"context-传播\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#context-%E4%BC%A0%E6%92%AD\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Context \\u4F20\\u64AD\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { context, propagation } = require('@opentelemetry/api');\\nconst http = require('http');\\n\\n// HTTP \\u5BA2\\u6237\\u7AEF\\u4F20\\u64AD\\nasync function makeHttpRequest(url) {\\n  const span = tracer.startSpan('http_request', {\\n    attributes: {\\n      'http.url': url,\\n      'http.method': 'GET',\\n    },\\n  });\\n\\n  const activeContext = trace.setSpan(context.active(), span);\\n\\n  return new Promise((resolve, reject) => {\\n    const options = {\\n      url,\\n      headers: {},\\n    };\\n\\n    // \\u6CE8\\u5165 trace context \\u5230 HTTP headers\\n    propagation.inject(activeContext, options.headers);\\n\\n    http.get(options, (res) => {\\n      span.setAttribute('http.status_code', res.statusCode);\\n      span.end();\\n      resolve(res);\\n    }).on('error', (err) => {\\n      span.recordException(err);\\n      span.setStatus({ code: 2, message: err.message });\\n      span.end();\\n      reject(err);\\n    });\\n  });\\n}\\n\\n// HTTP \\u670D\\u52A1\\u7AEF\\u63D0\\u53D6\\nconst express = require('express');\\nconst app = express();\\n\\napp.use((req, res, next) => {\\n  const activeContext = propagation.extract(context.active(), req.headers);\\n  const span = tracer.startSpan('http_request', {\\n    kind: 1, // SERVER\\n    attributes: {\\n      'http.method': req.method,\\n      'http.url': req.url,\\n    },\\n  }, activeContext);\\n\\n  context.with(trace.setSpan(activeContext, span), () => {\\n    next();\\n  });\\n\\n  res.on('finish', () => {\\n    span.setAttribute('http.status_code', res.statusCode);\\n    span.end();\\n  });\\n});\\n\")), mdx(\"h3\", {\n    \"id\": \"metrics---指标采集\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#metrics---%E6%8C%87%E6%A0%87%E9%87%87%E9%9B%86\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Metrics - \\u6307\\u6807\\u91C7\\u96C6\"), mdx(\"h4\", {\n    \"id\": \"counter计数器\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#counter%E8%AE%A1%E6%95%B0%E5%99%A8\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Counter\\uFF08\\u8BA1\\u6570\\u5668\\uFF09\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { metrics } = require('@opentelemetry/api');\\n\\nconst meter = metrics.getMeter('my-service');\\n\\nconst requestCounter = meter.createCounter('http.server.requests', {\\n  description: 'Total number of HTTP requests',\\n});\\n\\nfunction handleRequest(method, route, statusCode) {\\n  requestCounter.add(1, {\\n    'http.method': method,\\n    'http.route': route,\\n    'http.status_code': statusCode,\\n  });\\n}\\n\")), mdx(\"h4\", {\n    \"id\": \"histogram直方图\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#histogram%E7%9B%B4%E6%96%B9%E5%9B%BE\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Histogram\\uFF08\\u76F4\\u65B9\\u56FE\\uFF09\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const requestDuration = meter.createHistogram('http.server.duration', {\\n  description: 'HTTP request duration',\\n  unit: 'ms',\\n});\\n\\nfunction recordDuration(duration, method, route) {\\n  requestDuration.record(duration, {\\n    'http.method': method,\\n    'http.route': route,\\n  });\\n}\\n\")), mdx(\"h4\", {\n    \"id\": \"updowncounter升降计数器\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#updowncounter%E5%8D%87%E9%99%8D%E8%AE%A1%E6%95%B0%E5%99%A8\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"UpDownCounter\\uFF08\\u5347\\u964D\\u8BA1\\u6570\\u5668\\uFF09\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const activeConnections = meter.createUpDownCounter('http.server.active_connections', {\\n  description: 'Number of active HTTP connections',\\n});\\n\\nfunction connectionOpened() {\\n  activeConnections.add(1);\\n}\\n\\nfunction connectionClosed() {\\n  activeConnections.add(-1);\\n}\\n\")), mdx(\"h4\", {\n    \"id\": \"observable-gauge可观察仪表\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#observable-gauge%E5%8F%AF%E8%A7%82%E5%AF%9F%E4%BB%AA%E8%A1%A8\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Observable Gauge\\uFF08\\u53EF\\u89C2\\u5BDF\\u4EEA\\u8868\\uFF09\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const memoryUsage = meter.createObservableGauge('runtime.memory.heap_used', {\\n  description: 'Heap memory used',\\n  unit: 'bytes',\\n});\\n\\n// \\u6CE8\\u518C\\u56DE\\u8C03\\u51FD\\u6570\\nmeter.addBatchObservableCallback((observableResult) => {\\n  const memUsage = process.memoryUsage();\\n  observableResult.observe(memoryUsage, {\\n    'memory.type': 'heap',\\n  }, memUsage.heapUsed);\\n}, [memoryUsage]);\\n\")), mdx(\"h3\", {\n    \"id\": \"logs---日志集成\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#logs---%E6%97%A5%E5%BF%97%E9%9B%86%E6%88%90\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Logs - \\u65E5\\u5FD7\\u96C6\\u6210\"), mdx(\"h4\", {\n    \"id\": \"集成-winston\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E9%9B%86%E6%88%90-winston\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u96C6\\u6210 Winston\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const winston = require('winston');\\nconst { trace } = require('@opentelemetry/api');\\n\\n// \\u521B\\u5EFA logger\\nconst logger = winston.createLogger({\\n  format: winston.format.combine(\\n    winston.format.timestamp(),\\n    winston.format.json()\\n  ),\\n  transports: [\\n    new winston.transports.Console(),\\n  ],\\n});\\n\\n// \\u6DFB\\u52A0 trace \\u4FE1\\u606F\\u5230\\u65E5\\u5FD7\\nlogger.add(new winston.transports.Console({\\n  format: winston.format.printf((info) => {\\n    const span = trace.getActiveSpan();\\n    if (span) {\\n      const spanContext = span.spanContext();\\n      info.trace_id = spanContext.traceId;\\n      info.span_id = spanContext.spanId;\\n    }\\n    return JSON.stringify(info);\\n  }),\\n}));\\n\\n// \\u4F7F\\u7528\\u793A\\u4F8B\\nfunction example() {\\n  const span = trace.getActiveSpan();\\n  logger.info('Processing request', {\\n    user_id: '12345',\\n    action: 'create',\\n  });\\n}\\n\")), mdx(\"h4\", {\n    \"id\": \"集成-pino\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E9%9B%86%E6%88%90-pino\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u96C6\\u6210 Pino\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const pino = require('pino');\\nconst { trace } = require('@opentelemetry/api');\\n\\n// \\u521B\\u5EFA logger\\nconst logger = pino({\\n  formatters: {\\n    log: (object) => {\\n      const span = trace.getActiveSpan();\\n      if (span) {\\n        const spanContext = span.spanContext();\\n        object.trace_id = spanContext.traceId;\\n        object.span_id = spanContext.spanId;\\n      }\\n      return object;\\n    },\\n  },\\n});\\n\\n// \\u4F7F\\u7528\\u793A\\u4F8B\\nfunction example() {\\n  logger.info({\\n    user_id: '12345',\\n    action: 'create',\\n  }, 'Processing request');\\n}\\n\")), mdx(\"hr\", null), mdx(\"h2\", {\n    \"id\": \"框架集成示例\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#%E6%A1%86%E6%9E%B6%E9%9B%86%E6%88%90%E7%A4%BA%E4%BE%8B\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u6846\\u67B6\\u96C6\\u6210\\u793A\\u4F8B\"), mdx(\"h3\", {\n    \"id\": \"express-framework\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#express-framework\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Express Framework\"), mdx(\"h4\", {\n    \"id\": \"基础集成\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E5%9F%BA%E7%A1%80%E9%9B%86%E6%88%90\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u57FA\\u7840\\u96C6\\u6210\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const express = require('express');\\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\\nconst { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');\\nconst { BatchSpanProcessor } = require('@opentelemetry/sdk-trace-base');\\nconst { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');\\nconst { ExpressInstrumentation } = require('@opentelemetry/instrumentation-express');\\n\\n// \\u521D\\u59CB\\u5316 OpenTelemetry\\nconst provider = new NodeTracerProvider({\\n  resource: new Resource({\\n    [SemanticResourceAttributes.SERVICE_NAME]: 'my-service',\\n  }),\\n});\\n\\nprovider.addSpanProcessor(\\n  new BatchSpanProcessor(\\n    new OTLPTraceExporter({\\n      url: 'uptrace-grpc.yodao.cn:4317',\\n      headers: {\\n        'uptrace-dsn': 'http://token@uptrace-grpc.yodao.cn/project',\\n      },\\n    })\\n  )\\n);\\n\\nprovider.register();\\n\\n// \\u521B\\u5EFA Express \\u5E94\\u7528\\nconst app = express();\\n\\n// \\u4F7F\\u7528\\u81EA\\u52A8\\u57CB\\u70B9\\napp.use(express.json());\\n\\napp.get('/users/:id', async (req, res) => {\\n  const { trace, context } = require('@opentelemetry/api');\\n  const tracer = trace.getTracer('my-service');\\n  \\n  const span = trace.getActiveSpan();\\n  span?.setAttributes({\\n    'user.id': req.params.id,\\n  });\\n\\n  // \\u4E1A\\u52A1\\u903B\\u8F91\\n  const user = await getUser(req.params.id);\\n  res.json(user);\\n});\\n\\napp.listen(3000, () => {\\n  console.log('Server running on port 3000');\\n});\\n\")), mdx(\"h4\", {\n    \"id\": \"使用自动埋点库\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E4%BD%BF%E7%94%A8%E8%87%AA%E5%8A%A8%E5%9F%8B%E7%82%B9%E5%BA%93\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u4F7F\\u7528\\u81EA\\u52A8\\u57CB\\u70B9\\u5E93\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// \\u4F7F\\u7528 @opentelemetry/auto-instrumentations-node\\nrequire('@opentelemetry/auto-instrumentations-node/register');\\n\\nconst express = require('express');\\nconst app = express();\\n\\napp.get('/users/:id', async (req, res) => {\\n  const user = await getUser(req.params.id);\\n  res.json(user);\\n});\\n\\napp.listen(3000);\\n\")), mdx(\"h3\", {\n    \"id\": \"koa-framework\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#koa-framework\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Koa Framework\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const Koa = require('koa');\\nconst Router = require('@koa/router');\\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\\nconst { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');\\nconst { KoaInstrumentation } = require('@opentelemetry/instrumentation-koa');\\n\\n// \\u521D\\u59CB\\u5316 OpenTelemetry\\nconst provider = new NodeTracerProvider();\\nprovider.addSpanProcessor(\\n  new BatchSpanProcessor(\\n    new OTLPTraceExporter({\\n      url: 'uptrace-grpc.yodao.cn:4317',\\n      headers: {\\n        'uptrace-dsn': 'http://token@uptrace-grpc.yodao.cn/project',\\n      },\\n    })\\n  )\\n);\\n\\nprovider.register();\\n\\n// \\u521B\\u5EFA Koa \\u5E94\\u7528\\nconst app = new Koa();\\nconst router = new Router();\\n\\nrouter.get('/users/:id', async (ctx) => {\\n  const { trace } = require('@opentelemetry/api');\\n  const span = trace.getActiveSpan();\\n  span?.setAttributes({\\n    'user.id': ctx.params.id,\\n  });\\n\\n  ctx.body = await getUser(ctx.params.id);\\n});\\n\\napp.use(router.routes());\\napp.listen(3000);\\n\")), mdx(\"h3\", {\n    \"id\": \"nestjs-framework\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#nestjs-framework\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"NestJS Framework\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-typescript\"\n  }, \"import { Module } from '@nestjs/common';\\nimport { Controller, Get, Param } from '@nestjs/common';\\nimport { TraceService } from '@opentelemetry/api';\\n\\n@Controller('users')\\nexport class UsersController {\\n  constructor(private readonly traceService: TraceService) {}\\n\\n  @Get(':id')\\n  async getUser(@Param('id') id: string) {\\n    const tracer = this.traceService.getTracer('my-service');\\n    const span = tracer.startSpan('get_user');\\n    \\n    try {\\n      span.setAttributes({ 'user.id': id });\\n      const user = await this.userService.findOne(id);\\n      span.setStatus({ code: SpanStatusCode.OK });\\n      return user;\\n    } catch (error) {\\n      span.recordException(error);\\n      span.setStatus({ code: SpanStatusCode.ERROR });\\n      throw error;\\n    } finally {\\n      span.end();\\n    }\\n  }\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"nextjs-framework\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#nextjs-framework\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Next.js Framework\"), mdx(\"h4\", {\n    \"id\": \"app-router-nextjs-13\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#app-router-nextjs-13\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"App Router (Next.js 13+)\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// app/layout.js\\nimport { OpenTelemetryProvider } from './otel-provider';\\n\\nexport default function RootLayout({ children }) {\\n  return (\\n    <html>\\n      <body>\\n        <OpenTelemetryProvider>\\n          {children}\\n        </OpenTelemetryProvider>\\n      </body>\\n    </html>\\n  );\\n}\\n\")), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// app/otel-provider.js\\n'use client';\\n\\nimport { useEffect } from 'react';\\nimport { init } from '@opentelemetry/sdk-web';\\n\\nexport function OpenTelemetryProvider({ children }) {\\n  useEffect(() => {\\n    init({\\n      serviceName: 'my-nextjs-app',\\n      exporterUrl: 'https://api.uptrace.dev:4318/v1/traces',\\n      headers: {\\n        'uptrace-dsn': 'http://token@uptrace-grpc.yodao.cn/project',\\n      },\\n    });\\n  }, []);\\n\\n  return <>{children}</>;\\n}\\n\")), mdx(\"h4\", {\n    \"id\": \"pages-router\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#pages-router\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Pages Router\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// pages/_app.js\\nimport { useEffect } from 'react';\\nimport { init } from '@opentelemetry/sdk-web';\\n\\nfunction MyApp({ Component, pageProps }) {\\n  useEffect(() => {\\n    init({\\n      serviceName: 'my-nextjs-app',\\n      exporterUrl: 'https://api.uptrace.dev:4318/v1/traces',\\n      headers: {\\n        'uptrace-dsn': 'http://token@uptrace-grpc.yodao.cn/project',\\n      },\\n    });\\n  }, []);\\n\\n  return <Component {...pageProps} />;\\n}\\n\\nexport default MyApp;\\n\")), mdx(\"h3\", {\n    \"id\": \"grpc-server\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#grpc-server\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"gRPC Server\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const grpc = require('@grpc/grpc-js');\\nconst protoLoader = require('@grpc/proto-loader');\\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\\nconst { GrpcInstrumentation } = require('@opentelemetry/instrumentation-grpc');\\n\\n// \\u521D\\u59CB\\u5316 OpenTelemetry\\nconst provider = new NodeTracerProvider();\\nprovider.register();\\n\\n// \\u52A0\\u8F7D proto \\u6587\\u4EF6\\nconst packageDefinition = protoLoader.loadSync('user.proto');\\nconst userProto = grpc.loadPackageDefinition(packageDefinition).user;\\n\\n// \\u5B9E\\u73B0\\u670D\\u52A1\\nfunction getUser(call, callback) {\\n  const { trace } = require('@opentelemetry/api');\\n  const tracer = trace.getTracer('my-service');\\n  const span = tracer.startSpan('get_user');\\n  \\n  span.setAttributes({\\n    'user.id': call.request.id,\\n  });\\n\\n  // \\u4E1A\\u52A1\\u903B\\u8F91\\n  const user = { id: call.request.id, name: 'John Doe' };\\n  \\n  span.setStatus({ code: 1 }); // OK\\n  span.end();\\n  callback(null, user);\\n}\\n\\n// \\u521B\\u5EFA\\u670D\\u52A1\\u5668\\nconst server = new grpc.Server();\\nserver.addService(userProto.UserService.service, { getUser });\\nserver.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {\\n  server.start();\\n});\\n\")), mdx(\"h3\", {\n    \"id\": \"database---postgresql-pg\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#database---postgresql-pg\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Database - PostgreSQL (pg)\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { Pool } = require('pg');\\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\\nconst { PgInstrumentation } = require('@opentelemetry/instrumentation-pg');\\n\\n// \\u521D\\u59CB\\u5316 OpenTelemetry\\nconst provider = new NodeTracerProvider();\\nprovider.register();\\n\\n// \\u521B\\u5EFA\\u6570\\u636E\\u5E93\\u8FDE\\u63A5\\u6C60\\nconst pool = new Pool({\\n  host: 'localhost',\\n  port: 5432,\\n  database: 'mydb',\\n  user: 'user',\\n  password: 'password',\\n});\\n\\n// \\u67E5\\u8BE2\\u793A\\u4F8B\\nasync function getUser(id) {\\n  const { trace } = require('@opentelemetry/api');\\n  const tracer = trace.getTracer('my-service');\\n  const span = tracer.startSpan('database.query');\\n  \\n  try {\\n    const result = await pool.query('SELECT * FROM users WHERE id = $1', [id]);\\n    span.setAttributes({\\n      'db.system': 'postgresql',\\n      'db.statement': 'SELECT * FROM users WHERE id = $1',\\n    });\\n    return result.rows[0];\\n  } catch (error) {\\n    span.recordException(error);\\n    span.setStatus({ code: 2 }); // ERROR\\n    throw error;\\n  } finally {\\n    span.end();\\n  }\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"database---mongodb\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#database---mongodb\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Database - MongoDB\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { MongoClient } = require('mongodb');\\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\\nconst { MongoDBInstrumentation } = require('@opentelemetry/instrumentation-mongodb');\\n\\n// \\u521D\\u59CB\\u5316 OpenTelemetry\\nconst provider = new NodeTracerProvider();\\nprovider.register();\\n\\n// \\u8FDE\\u63A5 MongoDB\\nconst client = new MongoClient('mongodb://localhost:27017');\\n\\nasync function getUser(id) {\\n  const { trace } = require('@opentelemetry/api');\\n  const tracer = trace.getTracer('my-service');\\n  const span = tracer.startSpan('mongodb.query');\\n  \\n  try {\\n    await client.connect();\\n    const db = client.db('mydb');\\n    const user = await db.collection('users').findOne({ _id: id });\\n    \\n    span.setAttributes({\\n      'db.system': 'mongodb',\\n      'db.name': 'mydb',\\n      'db.collection': 'users',\\n    });\\n    \\n    return user;\\n  } catch (error) {\\n    span.recordException(error);\\n    throw error;\\n  } finally {\\n    span.end();\\n  }\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"redis\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#redis\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Redis\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const redis = require('redis');\\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\\nconst { RedisInstrumentation } = require('@opentelemetry/instrumentation-redis');\\n\\n// \\u521D\\u59CB\\u5316 OpenTelemetry\\nconst provider = new NodeTracerProvider();\\nprovider.register();\\n\\n// \\u521B\\u5EFA Redis \\u5BA2\\u6237\\u7AEF\\nconst client = redis.createClient({\\n  url: 'redis://localhost:6379',\\n});\\n\\nasync function getCache(key) {\\n  const { trace } = require('@opentelemetry/api');\\n  const tracer = trace.getTracer('my-service');\\n  const span = tracer.startSpan('redis.get');\\n  \\n  try {\\n    await client.connect();\\n    const value = await client.get(key);\\n    \\n    span.setAttributes({\\n      'db.system': 'redis',\\n      'db.operation': 'GET',\\n      'db.redis.key': key,\\n    });\\n    \\n    return value;\\n  } catch (error) {\\n    span.recordException(error);\\n    throw error;\\n  } finally {\\n    span.end();\\n  }\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"kafka\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#kafka\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Kafka\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { Kafka } = require('kafkajs');\\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\\nconst { KafkaJsInstrumentation } = require('@opentelemetry/instrumentation-kafkajs');\\n\\n// \\u521D\\u59CB\\u5316 OpenTelemetry\\nconst provider = new NodeTracerProvider();\\nprovider.register();\\n\\n// \\u521B\\u5EFA Kafka \\u5BA2\\u6237\\u7AEF\\nconst kafka = new Kafka({\\n  clientId: 'my-app',\\n  brokers: ['localhost:9092'],\\n});\\n\\nconst producer = kafka.producer();\\n\\nasync function sendMessage(topic, message) {\\n  const { trace } = require('@opentelemetry/api');\\n  const tracer = trace.getTracer('my-service');\\n  const span = tracer.startSpan('kafka.produce');\\n  \\n  try {\\n    await producer.connect();\\n    await producer.send({\\n      topic,\\n      messages: [{ value: JSON.stringify(message) }],\\n    });\\n    \\n    span.setAttributes({\\n      'messaging.system': 'kafka',\\n      'messaging.destination': topic,\\n      'messaging.operation': 'publish',\\n    });\\n  } catch (error) {\\n    span.recordException(error);\\n    throw error;\\n  } finally {\\n    span.end();\\n  }\\n}\\n\")), mdx(\"hr\", null), mdx(\"h2\", {\n    \"id\": \"高级配置\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#%E9%AB%98%E7%BA%A7%E9%85%8D%E7%BD%AE\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u9AD8\\u7EA7\\u914D\\u7F6E\"), mdx(\"h3\", {\n    \"id\": \"自定义采样策略\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E8%87%AA%E5%AE%9A%E4%B9%89%E9%87%87%E6%A0%B7%E7%AD%96%E7%95%A5\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u81EA\\u5B9A\\u4E49\\u91C7\\u6837\\u7B56\\u7565\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { TraceIdRatioBasedSampler, ParentBasedSampler } = require('@opentelemetry/sdk-trace-base');\\n\\n// \\u57FA\\u4E8E Span \\u540D\\u79F0\\u7684\\u81EA\\u5B9A\\u4E49\\u91C7\\u6837\\u5668\\nclass CustomSampler {\\n  constructor(defaultRate = 0.1) {\\n    this.defaultSampler = new ParentBasedSampler({\\n      root: new TraceIdRatioBasedSampler(defaultRate),\\n    });\\n    this.alwaysSample = ['/checkout', '/payment'];\\n    this.neverSample = ['/health', '/metrics'];\\n  }\\n\\n  shouldSample(context, traceId, spanName) {\\n    // \\u603B\\u662F\\u91C7\\u6837\\n    if (this.alwaysSample.some(name => spanName.includes(name))) {\\n      return { decision: SamplingDecision.RECORD_AND_SAMPLE };\\n    }\\n\\n    // \\u4ECE\\u4E0D\\u91C7\\u6837\\n    if (this.neverSample.some(name => spanName.includes(name))) {\\n      return { decision: SamplingDecision.NOT_RECORD };\\n    }\\n\\n    // \\u4F7F\\u7528\\u9ED8\\u8BA4\\u91C7\\u6837\\u7B56\\u7565\\n    return this.defaultSampler.shouldSample(context, traceId, spanName);\\n  }\\n}\\n\\n// \\u4F7F\\u7528\\u81EA\\u5B9A\\u4E49\\u91C7\\u6837\\u5668\\nconst provider = new NodeTracerProvider({\\n  sampler: new CustomSampler(0.1),\\n});\\n\")), mdx(\"h3\", {\n    \"id\": \"多-exporter-配置\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E5%A4%9A-exporter-%E9%85%8D%E7%BD%AE\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u591A Exporter \\u914D\\u7F6E\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');\\nconst { JaegerExporter } = require('@opentelemetry/exporter-jaeger');\\nconst { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');\\n\\n// \\u521B\\u5EFA\\u591A\\u4E2A exporter\\nconst otlpExporter = new OTLPTraceExporter({\\n  url: 'uptrace-grpc.yodao.cn:4317',\\n  headers: {\\n    'uptrace-dsn': 'http://token@uptrace-grpc.yodao.cn/project',\\n  },\\n});\\n\\nconst jaegerExporter = new JaegerExporter({\\n  endpoint: 'http://localhost:14268/api/traces',\\n});\\n\\nconst consoleExporter = new ConsoleSpanExporter();\\n\\n// \\u6DFB\\u52A0\\u591A\\u4E2A\\u5904\\u7406\\u5668\\nprovider.addSpanProcessor(new BatchSpanProcessor(otlpExporter));\\nprovider.addSpanProcessor(new BatchSpanProcessor(jaegerExporter));\\nprovider.addSpanProcessor(new BatchSpanProcessor(consoleExporter));\\n\")), mdx(\"h3\", {\n    \"id\": \"性能优化配置\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E9%85%8D%E7%BD%AE\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u6027\\u80FD\\u4F18\\u5316\\u914D\\u7F6E\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const provider = new NodeTracerProvider({\\n  resource: new Resource({\\n    [SemanticResourceAttributes.SERVICE_NAME]: 'my-service',\\n  }),\\n});\\n\\nprovider.addSpanProcessor(\\n  new BatchSpanProcessor(\\n    new OTLPTraceExporter({\\n      url: 'uptrace-grpc.yodao.cn:4317',\\n      headers: {\\n        'uptrace-dsn': 'http://token@uptrace-grpc.yodao.cn/project',\\n      },\\n      // \\u542F\\u7528\\u538B\\u7F29\\n      compression: 'gzip',\\n      // \\u8D85\\u65F6\\u65F6\\u95F4\\n      timeoutMillis: 10000,\\n    }),\\n    {\\n      // \\u6279\\u91CF\\u5927\\u5C0F\\n      maxExportBatchSize: 512,\\n      // \\u6279\\u91CF\\u8D85\\u65F6\\n      scheduledDelayMillis: 5000,\\n      // \\u961F\\u5217\\u5927\\u5C0F\\n      maxQueueSize: 2048,\\n      // \\u5BFC\\u51FA\\u8D85\\u65F6\\n      exportTimeoutMillis: 30000,\\n    }\\n  )\\n);\\n\")), mdx(\"hr\", null), mdx(\"h2\", {\n    \"id\": \"最佳实践\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u6700\\u4F73\\u5B9E\\u8DF5\"), mdx(\"h3\", {\n    \"id\": \"1-context-传递\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#1-context-%E4%BC%A0%E9%80%92\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"1. Context \\u4F20\\u9012\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// \\u2705 \\u6B63\\u786E\\uFF1A\\u4F20\\u9012 context\\nasync function processOrder(context, orderId) {\\n  const tracer = trace.getTracer('my-service');\\n  const span = tracer.startSpan('process_order', undefined, context);\\n  \\n  // \\u4F20\\u9012 context \\u7ED9\\u4E0B\\u6E38\\u51FD\\u6570\\n  await validateOrder(context, orderId);\\n  await chargePayment(context, orderId);\\n  \\n  span.end();\\n}\\n\\n// \\u274C \\u9519\\u8BEF\\uFF1A\\u521B\\u5EFA\\u65B0\\u7684 context\\nasync function processOrder(context, orderId) {\\n  const tracer = trace.getTracer('my-service');\\n  const span = tracer.startSpan('process_order');\\n  \\n  // \\u4E0D\\u8981\\u521B\\u5EFA\\u65B0\\u7684 context\\n  await validateOrder(context.active(), orderId);\\n  \\n  span.end();\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"2-异步操作\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#2-%E5%BC%82%E6%AD%A5%E6%93%8D%E4%BD%9C\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"2. \\u5F02\\u6B65\\u64CD\\u4F5C\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// \\u2705 \\u6B63\\u786E\\uFF1A\\u4F7F\\u7528 async/await\\nasync function getUser(id) {\\n  const span = tracer.startSpan('get_user');\\n  try {\\n    const user = await db.query('SELECT * FROM users WHERE id = ?', [id]);\\n    span.setStatus({ code: SpanStatusCode.OK });\\n    return user;\\n  } catch (error) {\\n    span.recordException(error);\\n    span.setStatus({ code: SpanStatusCode.ERROR });\\n    throw error;\\n  } finally {\\n    span.end();\\n  }\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"3-错误处理\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#3-%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"3. \\u9519\\u8BEF\\u5904\\u7406\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// \\u2705 \\u6B63\\u786E\\uFF1A\\u8BB0\\u5F55\\u9519\\u8BEF\\u5E76\\u8BBE\\u7F6E\\u72B6\\u6001\\ntry {\\n  await processOrder(orderId);\\n  span.setStatus({ code: SpanStatusCode.OK });\\n} catch (error) {\\n  span.recordException(error);\\n  span.setStatus({ \\n    code: SpanStatusCode.ERROR,\\n    message: error.message,\\n  });\\n  throw error;\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"4-资源管理\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#4-%E8%B5%84%E6%BA%90%E7%AE%A1%E7%90%86\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"4. \\u8D44\\u6E90\\u7BA1\\u7406\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// \\u2705 \\u6B63\\u786E\\uFF1A\\u4F7F\\u7528 try-finally \\u786E\\u4FDD span \\u7ED3\\u675F\\nfunction operation() {\\n  const span = tracer.startSpan('operation');\\n  try {\\n    // \\u4E1A\\u52A1\\u903B\\u8F91\\n  } finally {\\n    span.end();\\n  }\\n}\\n\")), mdx(\"hr\", null), mdx(\"h2\", {\n    \"id\": \"故障排查\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#%E6%95%85%E9%9A%9C%E6%8E%92%E6%9F%A5\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u6545\\u969C\\u6392\\u67E5\"), mdx(\"h3\", {\n    \"id\": \"常见问题\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u5E38\\u89C1\\u95EE\\u9898\"), mdx(\"h4\", {\n    \"id\": \"1-数据未发送到后端\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#1-%E6%95%B0%E6%8D%AE%E6%9C%AA%E5%8F%91%E9%80%81%E5%88%B0%E5%90%8E%E7%AB%AF\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"1. \\u6570\\u636E\\u672A\\u53D1\\u9001\\u5230\\u540E\\u7AEF\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"\\u6392\\u67E5\\u6B65\\u9AA4\"), \":\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"\\u68C0\\u67E5\\u73AF\\u5883\\u53D8\\u91CF:\")), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"echo $OTEL_SERVICE_NAME\\necho $OTEL_EXPORTER_OTLP_ENDPOINT\\n\")), mdx(\"ol\", {\n    \"start\": 2\n  }, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"\\u542F\\u7528\\u8C03\\u8BD5\\u65E5\\u5FD7:\")), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');\\n\\ndiag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);\\n\")), mdx(\"ol\", {\n    \"start\": 3\n  }, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"\\u4F7F\\u7528 Console Exporter \\u9A8C\\u8BC1:\")), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');\\n\\nprovider.addSpanProcessor(new BatchSpanProcessor(new ConsoleSpanExporter()));\\n\")), mdx(\"h4\", {\n    \"id\": \"2-span-未关联\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#2-span-%E6%9C%AA%E5%85%B3%E8%81%94\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"2. Span \\u672A\\u5173\\u8054\"), mdx(\"p\", null, \"\\u786E\\u4FDD\\u6B63\\u786E\\u4F20\\u9012 context:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// \\u4F7F\\u7528 context.with() \\u4F20\\u9012\\nconst newContext = context.with(trace.setSpan(context.active(), span));\\nawait downstreamFunction(newContext);\\n\")), mdx(\"h4\", {\n    \"id\": \"3-内存泄漏\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#3-%E5%86%85%E5%AD%98%E6%B3%84%E6%BC%8F\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"3. \\u5185\\u5B58\\u6CC4\\u6F0F\"), mdx(\"p\", null, \"\\u68C0\\u67E5\\u662F\\u5426\\u6709\\u672A\\u7ED3\\u675F\\u7684 span:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// \\u4F7F\\u7528 try-finally \\u786E\\u4FDD span \\u7ED3\\u675F\\nconst span = tracer.startSpan('operation');\\ntry {\\n  // \\u4E1A\\u52A1\\u903B\\u8F91\\n} finally {\\n  span.end();\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"调试技巧\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#%E8%B0%83%E8%AF%95%E6%8A%80%E5%B7%A7\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u8C03\\u8BD5\\u6280\\u5DE7\"), mdx(\"h4\", {\n    \"id\": \"启用详细日志\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E5%90%AF%E7%94%A8%E8%AF%A6%E7%BB%86%E6%97%A5%E5%BF%97\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u542F\\u7528\\u8BE6\\u7EC6\\u65E5\\u5FD7\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');\\n\\ndiag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);\\n\")), mdx(\"h4\", {\n    \"id\": \"使用-console-exporter\"\n  }, mdx(\"a\", {\n    parentName: \"h4\",\n    \"href\": \"#%E4%BD%BF%E7%94%A8-console-exporter\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u4F7F\\u7528 Console Exporter\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');\\n\\nprovider.addSpanProcessor(\\n  new BatchSpanProcessor(new ConsoleSpanExporter())\\n);\\n\")), mdx(\"hr\", null), mdx(\"h2\", {\n    \"id\": \"下一步\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#%E4%B8%8B%E4%B8%80%E6%AD%A5\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u4E0B\\u4E00\\u6B65\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"/docs/getting-started/environment-variables/\"\n  }, \"\\u73AF\\u5883\\u53D8\\u91CF\\u914D\\u7F6E\"), \" - \\u4E86\\u89E3\\u6240\\u6709\\u914D\\u7F6E\\u9009\\u9879\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"/docs/advanced/sampling/\"\n  }, \"\\u9AD8\\u7EA7\\u914D\\u7F6E\"), \" - \\u6DF1\\u5165\\u4E86\\u89E3\\u91C7\\u6837\\u548C\\u6027\\u80FD\\u4F18\\u5316\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"#%E6%B5%8F%E8%A7%88%E5%99%A8%E7%AB%AF%E6%8E%A5%E5%85%A5\"\n  }, \"\\u6D4F\\u89C8\\u5668\\u7AEF\\u63A5\\u5165\"), \" - \\u524D\\u7AEF\\u5E94\\u7528\\u63A5\\u5165\\u6307\\u5357\")), mdx(\"h2\", {\n    \"id\": \"参考资源\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#%E5%8F%82%E8%80%83%E8%B5%84%E6%BA%90\",\n    \"aria-hidden\": true,\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    \"aria-hidden\": \"true\",\n    height: \"16\",\n    version: \"1.1\",\n    viewBox: \"0 0 16 16\",\n    width: \"16\"\n  }, mdx(\"path\", {\n    fillRule: \"evenodd\",\n    d: \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"\\u53C2\\u8003\\u8D44\\u6E90\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://opentelemetry.io/docs/languages/js/\"\n  }, \"OpenTelemetry JavaScript Documentation\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://github.com/open-telemetry/opentelemetry-js\"\n  }, \"OpenTelemetry JS SDK\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://github.com/open-telemetry/opentelemetry-js-contrib\"\n  }, \"OpenTelemetry JS Contrib\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://opentelemetry.io/docs/specs/semconv/\"\n  }, \"Node.js Semantic Conventions\"))));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#javascriptnodejs-opentelemetry-接入指南","title":"JavaScript/Node.js OpenTelemetry 接入指南","items":[{"url":"#目录","title":"目录"},{"url":"#概述","title":"概述","items":[{"url":"#javascriptnodejs-特性","title":"JavaScript/Node.js 特性"},{"url":"#版本要求","title":"版本要求"},{"url":"#支持的信号","title":"支持的信号"},{"url":"#适用场景","title":"适用场景"}]},{"url":"#零代码接入推荐","title":"零代码接入（推荐）","items":[{"url":"#快速开始","title":"快速开始","items":[{"url":"#1-安装依赖","title":"1. 安装依赖"},{"url":"#2-配置环境变量","title":"2. 配置环境变量"},{"url":"#3-启动应用","title":"3. 启动应用"}]},{"url":"#其他启动方式","title":"其他启动方式","items":[{"url":"#方式-1-使用-node_options-环境变量","title":"方式 1: 使用 NODE_OPTIONS 环境变量"},{"url":"#方式-2-在-packagejson-中配置","title":"方式 2: 在 package.json 中配置"},{"url":"#方式-3-使用-env-命令一行命令","title":"方式 3: 使用 env 命令（一行命令）"}]},{"url":"#资源检测器配置","title":"资源检测器配置"},{"url":"#支持的自动埋点库","title":"支持的自动埋点库"},{"url":"#选择性启用埋点库","title":"选择性启用埋点库"},{"url":"#验证零代码接入","title":"验证零代码接入","items":[{"url":"#快速验证","title":"快速验证"}]},{"url":"#日志级别配置","title":"日志级别配置"}]},{"url":"#sdk-手动接入","title":"SDK 手动接入","items":[{"url":"#安装依赖","title":"安装依赖"},{"url":"#基础初始化","title":"基础初始化","items":[{"url":"#创建-opentelemetry-初始化文件","title":"创建 OpenTelemetry 初始化文件"},{"url":"#在应用中使用","title":"在应用中使用"}]},{"url":"#traces---手动埋点","title":"Traces - 手动埋点","items":[{"url":"#创建和使用-span","title":"创建和使用 Span"},{"url":"#context-传播","title":"Context 传播"}]},{"url":"#metrics---指标采集","title":"Metrics - 指标采集","items":[{"url":"#counter计数器","title":"Counter（计数器）"},{"url":"#histogram直方图","title":"Histogram（直方图）"},{"url":"#updowncounter升降计数器","title":"UpDownCounter（升降计数器）"},{"url":"#observable-gauge可观察仪表","title":"Observable Gauge（可观察仪表）"}]},{"url":"#logs---日志集成","title":"Logs - 日志集成","items":[{"url":"#集成-winston","title":"集成 Winston"},{"url":"#集成-pino","title":"集成 Pino"}]}]},{"url":"#框架集成示例","title":"框架集成示例","items":[{"url":"#express-framework","title":"Express Framework","items":[{"url":"#基础集成","title":"基础集成"},{"url":"#使用自动埋点库","title":"使用自动埋点库"}]},{"url":"#koa-framework","title":"Koa Framework"},{"url":"#nestjs-framework","title":"NestJS Framework"},{"url":"#nextjs-framework","title":"Next.js Framework","items":[{"url":"#app-router-nextjs-13","title":"App Router (Next.js 13+)"},{"url":"#pages-router","title":"Pages Router"}]},{"url":"#grpc-server","title":"gRPC Server"},{"url":"#database---postgresql-pg","title":"Database - PostgreSQL (pg)"},{"url":"#database---mongodb","title":"Database - MongoDB"},{"url":"#redis","title":"Redis"},{"url":"#kafka","title":"Kafka"}]},{"url":"#高级配置","title":"高级配置","items":[{"url":"#自定义采样策略","title":"自定义采样策略"},{"url":"#多-exporter-配置","title":"多 Exporter 配置"},{"url":"#性能优化配置","title":"性能优化配置"}]},{"url":"#最佳实践","title":"最佳实践","items":[{"url":"#1-context-传递","title":"1. Context 传递"},{"url":"#2-异步操作","title":"2. 异步操作"},{"url":"#3-错误处理","title":"3. 错误处理"},{"url":"#4-资源管理","title":"4. 资源管理"}]},{"url":"#故障排查","title":"故障排查","items":[{"url":"#常见问题","title":"常见问题","items":[{"url":"#1-数据未发送到后端","title":"1. 数据未发送到后端"},{"url":"#2-span-未关联","title":"2. Span 未关联"},{"url":"#3-内存泄漏","title":"3. 内存泄漏"}]},{"url":"#调试技巧","title":"调试技巧","items":[{"url":"#启用详细日志","title":"启用详细日志"},{"url":"#使用-console-exporter","title":"使用 Console Exporter"}]}]},{"url":"#下一步","title":"下一步"},{"url":"#参考资源","title":"参考资源"}]}]}}},"pageContext":{"id":"a325a1cb-3d1b-52e0-a978-ad8929861326"}},
    "staticQueryHashes": ["1122327541","1339625561","148928582","2007862104","2140385554","3442269102","4275725850"]}