-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add active user tracking #350
Conversation
4b8bec1
to
1f54d08
Compare
4e21904
to
ad36297
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking mostly good. I think for the public classes / functions we need some more docstring for the API docs. I am quite excited that this looks generic for all bridges though!
changelog.d/350.feature
Outdated
@@ -0,0 +1 @@ | |||
Add optional UserActivityTracker and BridgeBlocker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's elaborate what these do, so the layman can tell if they want to upgrade or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about something like "Add optional UserActivityTracker for tracking & reporting monthly active users, and BridgeBlocker allowing for locking down the bridge communications (intended to be used together)"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems fine to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 8d97470
import * as logging from "./logging"; | ||
const log = logging.get("BridgeBlocker"); | ||
|
||
export class BridgeBlocker { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, what's the expected usage pattern here? Do bridges use this class directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They might.
Slack extends it to disable its connection handlers as a blocking mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another dumb question, does this spit out a integer to Prometheus yet telling us if the bridge is blocked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. No. Will fix that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...actually, we can't easily do that without introducing an (optional) dependency on BridgeBlocker – currently we merely provide it for implementations but we don't force them to use it, or even assume that they might. Adding a Bridge
opts/controller attribute just for the metric seems silly, so it may be better to just leave that up to the implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests that we're properly exporting them (and is tidier). Co-authored-by: Will Hunt <will@half-shot.uk>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the home stretch now, a couple of Qs but then I think we can shippit
changelog.d/350.feature
Outdated
@@ -0,0 +1 @@ | |||
Add optional UserActivityTracker and BridgeBlocker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems fine to me!
src/bridge.ts
Outdated
@@ -39,6 +40,7 @@ import { RoomLinkValidator, RoomLinkValidatorStatus, Rules } from "./components/ | |||
import { RoomUpgradeHandler, RoomUpgradeHandlerOpts } from "./components/room-upgrade-handler"; | |||
import { EventQueue } from "./components/event-queue"; | |||
import * as logging from "./components/logging"; | |||
import { UserActivityTracker } from "./components/userActivity"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still the case ?
src/bridge.ts
Outdated
@@ -62,6 +64,7 @@ const INTENT_CULL_EVICT_AFTER_MS = 1000 * 60 * 15; // 15 minutes | |||
|
|||
export const BRIDGE_PING_EVENT_TYPE = "org.matrix.bridge.ping"; | |||
export const BRIDGE_PING_TIMEOUT_MS = 60000; | |||
export const BRIDGE_USER_ACTIVITY_STORAGE_KEY = "org.matrix.bridge.user_activity"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping pong?
import * as logging from "./logging"; | ||
const log = logging.get("BridgeBlocker"); | ||
|
||
export class BridgeBlocker { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another dumb question, does this spit out a integer to Prometheus yet telling us if the bridge is blocked?
No description provided.