Skip to content

Commit

Permalink
feat: Hook up datadog logger (#25)
Browse files Browse the repository at this point in the history
* feat: Hook up datadog logger

* Few fixes to get DatadogLogger working.

Co-authored-by: Aaron Boodman <aaron@aaronboodman.com>
  • Loading branch information
arv and aboodman authored Feb 17, 2022
1 parent 4f1feba commit 8a64086
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ yarn-error.log*
$ CloudFlare worker
.mf/
tsconfig.tsbuildinfo
.env

12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"replicache": "^9.0.0-beta.0",
"replicache-react": "^2.5.0",
"reps-client": "file:reps-client-0.0.1.tgz",
"reps-do": "file:reps-do-0.0.1.tgz",
"reps-do": "file:reps-do-0.1.0.tgz",
"typescript": "^4.5.5",
"zod": "^3.11.6"
}
Expand Down
Binary file removed reps-do-0.0.1.tgz
Binary file not shown.
Binary file added reps-do-0.1.0.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion src/pages/d/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Home() {

const workerHost =
process.env.NEXT_PUBLIC_WORKER_HOST ??
"wss://reps.replicache.workers.dev";
"wss://replidraw.replicache.workers.dev";
const workerURL = `${workerHost}/connect`;
console.info(`Connecting to worker at ${workerURL}`);
new Client(r, roomID, workerURL);
Expand Down
15 changes: 12 additions & 3 deletions worker/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import { Server as BaseServer } from "reps-do";
import { DatadogLogger, Server as BaseServer } from "reps-do";
export { worker as default } from "reps-do";
import { mutators, type M } from "../src/datamodel/mutators.js";

export class Server extends BaseServer<M> {
constructor(state: DurableObjectState) {
super(mutators, state);
constructor(state: DurableObjectState, env: Record<string, string>) {
const logger = new DatadogLogger({
apiKey: env.DATADOG_API_KEY,
service: "replidraw",
});

super({
mutators,
state,
logger,
});
}
}
5 changes: 4 additions & 1 deletion wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "replidraw-do"
name = "replidraw"
type = "javascript"

account_id = ""
Expand Down Expand Up @@ -28,3 +28,6 @@ main = "./index.mjs"

[miniflare]
durable_objects_persist = true

#[secrets]
#DATADOG_API_KEY

1 comment on commit 8a64086

@vercel
Copy link

@vercel vercel bot commented on 8a64086 Feb 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.