Skip to content

Commit

Permalink
fix: avoid logging healthcheck events to posthog
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitdalal committed Apr 22, 2024
1 parent 1192651 commit 9fc66e5
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,18 @@ app.use(Sentry.Handlers.requestHandler());
app.use(Sentry.Handlers.tracingHandler());

app.use((req, _, next) => {
posthogClient.capture({
distinctId: req.ip,
event: "pageview",
properties: {
path: req.path,
url: req.originalUrl,
method: req.method,
headers: req.headers,
},
});
if (req.url !== "/healthcheck") {
posthogClient.capture({
distinctId: req.ip,
event: "pageview",
properties: {
path: req.path,
url: req.originalUrl,
method: req.method,
headers: req.headers,
},
});
}

next();
});
Expand Down

0 comments on commit 9fc66e5

Please sign in to comment.