check-alerts worker: 13 error spans (mongodb.create, NamespaceExists) every minute because mongoose autoCreate is still on
まだ誰も着手していません。
- #3546 @CG-5228 による — マージされずにクローズ
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- mongodb, typescript
- 領域
- backend, observability
調査の方向性
まず、check-alerts worker の DefaultAlertProvider.init() と asyncDispose() を読み、次に connectDB が Mongoose オプションをどのように渡すかを確認してください。PR #2887 は autoIndex に関する参考情報です。autoCreate: false がその worker の接続に適用されていることを確認してから、worker または関連するテストを実行し、繰り返し実行しても mongodb.create のエラースパンが13個出力されなくなったことを確認してください。
索引モデルが issue の本文から書いたものです。
説明
What happened?
Our self-hosted HyperDX sends its own telemetry to a collector, so we see what the check-alerts worker does. Every minute its trace contains 13 failed spans named mongodb.create with the status message "Collection already exists", one per model: hyperdx.alerts, alerthistories, connections, dashboards, favorites, pinnedfilters, presetdashboardfilters, savedsearches, sources, teams, teaminvites, users and webhooks. On an idle instance that adds up to roughly 19 000 error spans a day, and the Service Dashboard shows a 55 % client error rate for the hyperdx service. Nothing is actually broken, alerts still run.
The cause, as far as I can tell from the code: DefaultAlertProvider.init() opens a new connection on every run (connectDB with autoIndex false) and asyncDispose() closes it again. Mongoose still has autoCreate on, so on every fresh connection Model.init() calls createCollection for each model. The collections exist, MongoDB answers NamespaceExists (code 48), Mongoose ignores that error, but the OpenTelemetry mongodb instrumentation has already recorded a failed command.
PR #2887 turned autoIndex off in that worker for the same reason (the API service owns the schema). Passing autoCreate: false alongside it should remove the 13 commands per run. Happy to open that PR if you want it.
Steps to reproduce
- Run the hyperdx image with HYPERDX_API_KEY and OTEL_EXPORTER_OTLP_ENDPOINT pointing at a collector.
- Wait a minute for the check-alerts cron.
- Search traces for
StatusCode:Error– 13 mongodb.create spans per minute.
How are you running HyperDX?
Self-hosted, image hyperdx/hyperdx:2.40.0 with mongo:5.0.32 as rootless Podman containers; own ClickHouse 26.8 and OpenTelemetry Collector 0.162.0 on separate hosts.
Where does it show up?
In the traces of the hyperdx service itself (Search with source Traces, Service Dashboard). Not a UI bug.
Debug info
N/A (worker process, not the UI)
Logs
SpanName: mongodb.create (Client)
StatusCode: Error
StatusMessage: Collection already exists. NS: hyperdx.teams
ScopeName: @opentelemetry/instrumentation-mongodb 0.52.0
service.version: 2.40.0
- 主要言語
- TypeScript
- スター
- 10k
- フォーク
- 508
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hyperdxio/hyperdx のほかの issue
-
Metric chart with aggFn increase and a multi-column group-by fails: toString() gets several arguments対応中かも @CG-5228 が 11 日前に担当しました。 オープンexternal
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
Slack notifications for inline alerts fail when the chart-explorer link passes Slack's 3000-character block limit対応中かも @Tyagiquamar が 13 日前に担当しました。 オープンalerting bug external
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
Replace `as any` mock fixtures in three app test files with shoehorn対応中かも @k4its1t が 76 日前に担当しました。 オープンgood first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
Trace source: document spanLinksValueExpression in the v2 sources external API (OpenAPI parity)オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
hyperdxio/hyperdx の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
documentation easy good first issue help wanted
難易度 1/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
Billion-context documentation addendum: nudge is independent of window occupancy. | billion-context 文档补充:nudge 与窗口占用无关対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
ranxianglei/billion-context#5893 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
microsoft/monaco-editor#5575 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100