Skip to content

Commit 372ae53

Browse files
committed
feat: metics persistence disabled by default
1 parent 3f25010 commit 372ae53

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

packages/cloudflare_worker_host/src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class CfwWasiCompat implements WasiContext {
251251
}
252252
class CfwPersistence implements Persistence {
253253
private readonly token: string | undefined;
254-
private readonly insightsUrl: string;
254+
private readonly insightsUrl: string | false;
255255
private readonly userAgent: string | undefined;
256256

257257
constructor(
@@ -264,14 +264,18 @@ class CfwPersistence implements Persistence {
264264
if (superfaceApiUrl !== undefined) {
265265
this.insightsUrl = `${superfaceApiUrl}/insights/sdk_event`;
266266
} else {
267-
this.insightsUrl = "https://superface.ai/insights/sdk_event";
267+
this.insightsUrl = false;
268268
}
269269
}
270270

271271
// TODO: investigate other ways of persisting metrics:
272272
// 1. Tail Workers https://developers.cloudflare.com/workers/platform/tail-workers/
273273
// 2. Logpush https://developers.cloudflare.com/workers/platform/logpush
274274
async persistMetrics(events: string[]): Promise<void> {
275+
if (this.insightsUrl === false) {
276+
return;
277+
}
278+
275279
const headers: Record<string, string> = {
276280
"content-type": "application/json",
277281
};

packages/nodejs_host/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,10 @@ class NodePersistence implements Persistence {
180180
) {
181181
this.token = token;
182182
this.userAgent = userAgent;
183-
if (superfaceApiUrl === false) {
184-
this.insightsUrl = false;
185-
} else if (superfaceApiUrl === undefined) {
183+
if (superfaceApiUrl === undefined) {
186184
this.insightsUrl = "https://superface.ai/insights/sdk_event";
187185
} else {
188-
this.insightsUrl = `${superfaceApiUrl}/insights/sdk_event`;
186+
this.insightsUrl = false;
189187
}
190188
}
191189

packages/python_host/src/one_sdk/platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def __init__(self, token: Optional[str] = None, superface_api_url: Union[None, s
189189
elif superface_api_url is not None:
190190
self._insights_url = f"{superface_api_url}/insights/sdk_event"
191191
else:
192-
self._insights_url = "https://superface.ai/insights/sdk_event"
192+
self._insights_url = None
193193

194194
self._network = PythonNetwork()
195195

0 commit comments

Comments
 (0)