Repository navigation
feat(server): write analytics to the storage event sink - #316
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slice T3 of P1 (F-03 task 5), on top of
BufferedEventSinkandstatsFromSinkfrom #314 (#246).analytics: trueand astoragethat hasevents, every event also goes through aBufferedEventSinkon the store's sink. The in-processAnalyticsCollectorkeeps counting as before.[chatcops] analytics write failed: ...) and the chat still answers.analyticsStats(range?)on the handler: counts from the sink when it hasquery(so it covers every instance), flushing first, for the last 30 days by default. It falls back to the process collector for a sink that can only be written to.getAnalytics()is unchanged and describes this process.chatcopsAnalyticsHandler(Express) uses it, with?from=and?to=in milliseconds. A range that isn't a number gets400 invalid_range, a sink that can't be read gets500with a log line, and the bearer check is unchanged. The handler is now async, so the existing tests await it.app.use.Checks: build, typecheck,
pnpm test:coverage(1123 passed; 8 new inserver/tests/analytics-sink.test.ts, including two handlers sharing one store the way two serverless instances would), lint at the dev baseline, website build.