rayberra
rayberra
CDCloudflare Developers
Created by ArmoredCavalry on 8/7/2024 in #workers-help
'Global' Worker for Logging (alternative for logflare App)
hmmm.. you're right. Tested worker to worker (without service bindings) and got like ~10ms median latency.
41 replies
CDCloudflare Developers
Created by ArmoredCavalry on 8/7/2024 in #workers-help
'Global' Worker for Logging (alternative for logflare App)
That's kinda why I'm suggesting that you might need both a snippet and a worker. (I.e. the snippet does a fetch to a dedicated worker instead of logflare. The worker can use ctx.waitUntil.)
41 replies
CDCloudflare Developers
Created by ArmoredCavalry on 8/7/2024 in #workers-help
'Global' Worker for Logging (alternative for logflare App)
Wouldn't it be possible to split the logflare code into two parts? The snippet would only do something like
async fetch(request) {
const t1 = Date.now();
const response = await fetch(request);
const originTimeMs = Date.now() - t1;
const logflareEventBody = { /* ... */ };
await fetch(/* send the stats to a dedicated worker that does the rest of the processing and uses waitUntil */);
return response;
}
async fetch(request) {
const t1 = Date.now();
const response = await fetch(request);
const originTimeMs = Date.now() - t1;
const logflareEventBody = { /* ... */ };
await fetch(/* send the stats to a dedicated worker that does the rest of the processing and uses waitUntil */);
return response;
}
41 replies
CDCloudflare Developers
Created by ArmoredCavalry on 8/7/2024 in #workers-help
'Global' Worker for Logging (alternative for logflare App)
I was thinking that it might be possible to let the snippet to do the bare minimum to collect the stats and put the rest of the code inside a worker.
41 replies
CDCloudflare Developers
Created by ArmoredCavalry on 8/7/2024 in #workers-help
'Global' Worker for Logging (alternative for logflare App)
Perhaps Snippets + a worker? Haven't tried it, just took a look at the logflare source and the snippets docs out of curiosity. Snippets sounds a lot like " a "global" [limited] Worker that ran before any other worker in your zone". Something similar to https://developers.cloudflare.com/rules/snippets/examples/debugging-logs/.
41 replies
CDCloudflare Developers
Created by Mitya on 7/21/2024 in #workers-help
With function calls, are system messages or description properties preferable to instruct AI?
The tool definitions will end up in the system prompt regardless of approach, but you should use the syntax you show in version 2.
4 replies