Skip to content

Commit 8a64086

Browse files
arvaboodman
andauthored
feat: Hook up datadog logger (#25)
* feat: Hook up datadog logger * Few fixes to get DatadogLogger working. Co-authored-by: Aaron Boodman <[email protected]>
1 parent 4f1feba commit 8a64086

File tree

8 files changed

+26
-12
lines changed

8 files changed

+26
-12
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ yarn-error.log*
3636
$ CloudFlare worker
3737
.mf/
3838
tsconfig.tsbuildinfo
39+
.env
40+

package-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"replicache": "^9.0.0-beta.0",
3131
"replicache-react": "^2.5.0",
3232
"reps-client": "file:reps-client-0.0.1.tgz",
33-
"reps-do": "file:reps-do-0.0.1.tgz",
33+
"reps-do": "file:reps-do-0.1.0.tgz",
3434
"typescript": "^4.5.5",
3535
"zod": "^3.11.6"
3636
}

reps-do-0.0.1.tgz

-102 KB
Binary file not shown.

reps-do-0.1.0.tgz

161 KB
Binary file not shown.

src/pages/d/[id].tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function Home() {
3333

3434
const workerHost =
3535
process.env.NEXT_PUBLIC_WORKER_HOST ??
36-
"wss://reps.replicache.workers.dev";
36+
"wss://replidraw.replicache.workers.dev";
3737
const workerURL = `${workerHost}/connect`;
3838
console.info(`Connecting to worker at ${workerURL}`);
3939
new Client(r, roomID, workerURL);

worker/index.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import { Server as BaseServer } from "reps-do";
1+
import { DatadogLogger, Server as BaseServer } from "reps-do";
22
export { worker as default } from "reps-do";
33
import { mutators, type M } from "../src/datamodel/mutators.js";
44

55
export class Server extends BaseServer<M> {
6-
constructor(state: DurableObjectState) {
7-
super(mutators, state);
6+
constructor(state: DurableObjectState, env: Record<string, string>) {
7+
const logger = new DatadogLogger({
8+
apiKey: env.DATADOG_API_KEY,
9+
service: "replidraw",
10+
});
11+
12+
super({
13+
mutators,
14+
state,
15+
logger,
16+
});
817
}
918
}

wrangler.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = "replidraw-do"
1+
name = "replidraw"
22
type = "javascript"
33

44
account_id = ""
@@ -28,3 +28,6 @@ main = "./index.mjs"
2828

2929
[miniflare]
3030
durable_objects_persist = true
31+
32+
#[secrets]
33+
#DATADOG_API_KEY

0 commit comments

Comments
 (0)