> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 用于 ClickStack 的 Deno SDK - ClickHouse 可观测性栈

# Deno

本指南涵盖以下集成：

* **日志**

<Note>
  当前仅支持 OpenTelemetry 日志。如需链路追踪支持，[请参阅以下指南](https://dev.to/grunet/leveraging-opentelemetry-in-deno-45bj#a-minimal-interesting-example)。
</Note>

<div id="logging">
  ## 日志
</div>

可通过为 `std/log` 模块导出自定义日志记录器来启用日志功能。

**示例用法：**

```typescript theme={null}
import * as log from 'https://deno.land/std@0.203.0/log/mod.ts';
import { OpenTelemetryHandler } from 'npm:@hyperdx/deno';

log.setup({
  handlers: {
    otel: new OpenTelemetryHandler('DEBUG'),
  },

  loggers: {
    'my-otel-logger': {
      level: 'DEBUG',
      handlers: ['otel'],
    },
  },
});

log.getLogger('my-otel-logger').info('Hello from Deno!');
```

<div id="run-the-application">
  ### 运行应用程序
</div>

<Tabs>
  <Tab title="托管 ClickStack">
    ```shell theme={null}
    OTEL_EXPORTER_OTLP_ENDPOINT=http://your-otel-collector:4318 \
    OTEL_SERVICE_NAME="<NAME_OF_YOUR_APP_OR_SERVICE>" \
    deno run --allow-net --allow-env --allow-read --allow-sys --allow-run app.ts
    ```
  </Tab>

  <Tab title="ClickStack 开源版">
    ```shell theme={null}
    OTEL_EXPORTER_OTLP_HEADERS="authorization=<YOUR_INGESTION_API_KEY>" \
    OTEL_EXPORTER_OTLP_ENDPOINT=http://your-otel-collector:4318 \
    OTEL_SERVICE_NAME="<NAME_OF_YOUR_APP_OR_SERVICE>" \
    deno run --allow-net --allow-env --allow-read --allow-sys --allow-run app.ts
    ```
  </Tab>
</Tabs>
