クライアントエラーのログ収集(プロトタイプ) - #393
Draft
Sachiaki-Kasuya wants to merge 4 commits into
Draft
Conversation
グローバルエラーハンドラと /api/client-errors の受信経路を整備し、 操作ログ・位置情報状態・重複送信抑止を含む報告基盤を実装する。 Made-with: Cursor
fetch層と主要画面の catch ブロックから reportError を呼び出し、 未捕捉エラーだけでなく処理済みエラーも調査ログとして収集する。 Made-with: Cursor
タイルフォールバック発火時に reportError を実行し、 OSM タイル障害をクライアントエラー収集経路で追跡可能にする。 Made-with: Cursor
Sachiaki-Kasuya
commented
Mar 27, 2026
| parseFloat(process.env.NEXT_PUBLIC_MAP_DEFAULT_LONGITUDE!) || 139.7413637 | ||
|
|
||
| // geolocation が http に対応していないため固定値を返却 | ||
| if (location.protocol === 'http:') { |
Collaborator
Author
There was a problem hiding this comment.
申し訳ありません、今回実装分の setGeolocationStatus('not_supported') が漏れていました
後ほど修正コミットプッシュいたします
(追記):修正コミットプッシュ済み
oasismap/frontend/src/libs/geolocation.ts
Line 16 in f00f183
Sachiaki-Kasuya
force-pushed
the
tmp/test-output-log
branch
from
March 27, 2026 06:59
93f9d7c to
5f56776
Compare
Contributor
|
エラー収集ツールであるSentryでは、届いたエラーレポートを種類毎に集約するIssuesという機能がありました。 当PRの実装にも、エラー種別を表す情報がログ出力されるような機能追加を検討してはいかがでしょうか。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
ブラウザ上でエラーが発生した時にコンソールログとfrontendコンテナにログ出力するように対応
ログ収集対象者として、ログインしているユーザと管理者を想定
/client-errorとしてPOSTし、成功時は204を返すペイロードの概要
以下の3項目を出力
actionLog: 操作ログ(ヘッダーやラベルのクリック、ルーティングを過去20件分記録)apiCall、click、mapInteraction(地図関連の操作)、routeChange(画面遷移)をactionLog.entries[x].typeに設定enviroment: 使用デバイスやブラウザを表示error: 発生したエラーの詳細実行例
actionLog.entriesのリスト内容は左のデータ(先頭)が古く、右(最後尾)が最新の情報です直後に記載の
errorに至るまでのユーザー操作を表しており、原因を調査する補助情報として想定しています確認したエラーパターン
位置情報をOFFにして以下の動作でエラーが出ることを確認
try-catch外で発生したエラーの検知について
ブラウザで
error / unhandledrejectionとして通知するものはキャッチ可能frontend/src/components/client-error-reporter.tsxhttps://github.com/c-3lab/oasismap/pull/393/changes#diff-8a4eff86f584ef8bf08f0dad00a85554fe9e7bfe6e35528fe1d8fbaa1cca86b7R49-R50
上記の handleErrorとhandleUnhandledRejection でキャッチできていることを確認
各呼び出しでログ出力を設定し、開発者ツールのコンソールで動作確認