@ah-monica/cloudflare 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/client.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -49,6 +49,33 @@ handlerで送信完了を処理結果に含めたい場合は、直接`await`し
|
|
|
49
49
|
await monica.captureException(error, { tags: { trigger: "scheduled" } });
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
## 送信が拒否されたとき
|
|
53
|
+
|
|
54
|
+
`422`(envelope schema 不正)のとき、既定で`console.warn`へ1行出す(Workersのログに出る)。
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
monica: ingest rejected the envelope with 422 (invalid_envelope): 1 issue(s); $.items[0].request.method: Invalid type: Expected string
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
出力先を変える場合は`onDiagnostic`を渡す。`null`を渡すと何も出さない。
|
|
61
|
+
`flush()`の戻り値の`status` / `issues` / `error`からも取得できる。
|
|
62
|
+
|
|
63
|
+
`401`(鍵の失効・種別違い)を受けると、そのclientからは以後1回もPOSTしない。
|
|
64
|
+
`flush()`の戻り値の`stopped: true`と次の1行で分かる。
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
monica: ingest rejected the envelope with 401 (invalid_key); no further envelopes will be sent
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`413`(body上限超過)を受けると`items`を半分に割って送り直す。SDKは契約(gzip後
|
|
71
|
+
1 MiB)を下回るサイズしか送らないので、返るのは経路上のproxyやgatewayが契約より
|
|
72
|
+
低い上限を持っているとき。分割して受理されても`flush()`の戻り値の`status`は`413`に
|
|
73
|
+
なり、次の1行をtransportにつき1回だけ出す。
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
monica: ingest rejected the envelope with 413 (unknown); splitting and resending. A size limit on the path may be below the 1 MiB (gzip) contract
|
|
77
|
+
```
|
|
78
|
+
|
|
52
79
|
## PII方針
|
|
53
80
|
|
|
54
81
|
SDKは、例外message、stack、request、contextがPIIかどうかを推測せず、自動除去も
|
package/dist/client.js
CHANGED
|
@@ -17,6 +17,7 @@ export function createCloudflareClient(options) {
|
|
|
17
17
|
fetch: options.fetch,
|
|
18
18
|
maxRetries: options.maxRetries ?? 0,
|
|
19
19
|
requestTimeoutMs: options.requestTimeoutMs,
|
|
20
|
+
onDiagnostic: options.onDiagnostic,
|
|
20
21
|
}),
|
|
21
22
|
environment: options.environment,
|
|
22
23
|
release: options.release,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createCloudflareClient } from "./client.js";
|
|
2
2
|
export type { CloudflareCaptureContext, CloudflareClientOptions, MonicaCloudflareClient, WaitUntilContext, } from "./types.js";
|
|
3
|
-
export type { BeforeSend, FlushResult, MonicaBreadcrumb, MonicaErrorItem, MonicaItem, MonicaLevel, MonicaRequest, MonicaUser, } from "@ah-monica/core";
|
|
3
|
+
export type { BeforeSend, FlushResult, MonicaBreadcrumb, MonicaErrorItem, MonicaItem, MonicaLevel, MonicaRequest, MonicaUser, TransportDiagnostic, TransportDiagnosticHandler, } from "@ah-monica/core";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BeforeSend, FetchLike, FlushResult, MonicaBreadcrumb, MonicaLevel, MonicaRequest, MonicaUser } from "@ah-monica/core";
|
|
1
|
+
import type { BeforeSend, FetchLike, FlushResult, MonicaBreadcrumb, MonicaLevel, MonicaRequest, MonicaUser, TransportDiagnosticHandler } from "@ah-monica/core";
|
|
2
2
|
export interface CloudflareClientOptions {
|
|
3
3
|
dsn: string;
|
|
4
4
|
environment: string;
|
|
@@ -9,6 +9,11 @@ export interface CloudflareClientOptions {
|
|
|
9
9
|
maxRetries?: number;
|
|
10
10
|
maxCauseDepth?: number;
|
|
11
11
|
maxStackFrames?: number;
|
|
12
|
+
/**
|
|
13
|
+
* ingest が envelope を拒否したときの診断の受け取り先。既定は `console.warn` に
|
|
14
|
+
* 1 行出す(422 の `issues` の path を含む)。`null` を渡すと何も出さない。
|
|
15
|
+
*/
|
|
16
|
+
onDiagnostic?: TransportDiagnosticHandler | null;
|
|
12
17
|
/**
|
|
13
18
|
* The application owns PII removal. MONICA does not infer which values are PII.
|
|
14
19
|
* Return null to discard an event or return a sanitized event to send it.
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** package.json の version と同じ値。bun run version X.Y.Z が書き換える */
|
|
2
|
-
export declare const SDK_VERSION = "0.1
|
|
2
|
+
export declare const SDK_VERSION = "0.2.1";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** package.json の version と同じ値。bun run version X.Y.Z が書き換える */
|
|
2
|
-
export const SDK_VERSION = "0.1
|
|
2
|
+
export const SDK_VERSION = "0.2.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ah-monica/cloudflare",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Cloudflare Workers adapter for sending application errors to MONICA",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"directory": "cloudflare"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@ah-monica/core": "0.1
|
|
33
|
+
"@ah-monica/core": "0.2.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/bun": "^1.2.21",
|