Skip to content
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

Merged
merged 14 commits into from
Sep 21, 2021
Merged

Add active user tracking #350

merged 14 commits into from
Sep 21, 2021

Conversation

tadzik
Copy link
Contributor

@tadzik tadzik commented Sep 1, 2021

No description provided.

@tadzik tadzik marked this pull request as draft September 1, 2021 15:48
src/bridge.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@Half-Shot Half-Shot left a 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!

@@ -0,0 +1 @@
Add optional UserActivityTracker and BridgeBlocker
Copy link
Contributor

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.

Copy link
Contributor Author

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)"?

Copy link
Contributor

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!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 8d97470

spec/unit/userActivity.spec.js Outdated Show resolved Hide resolved
spec/unit/userActivity.spec.js Outdated Show resolved Hide resolved
src/bridge.ts Show resolved Hide resolved
src/bridge.ts Show resolved Hide resolved
src/components/bridge-blocker.ts Outdated Show resolved Hide resolved
src/components/bridge-blocker.ts Show resolved Hide resolved
src/components/intent.ts Show resolved Hide resolved
src/components/userActivity.ts Outdated Show resolved Hide resolved
import * as logging from "./logging";
const log = logging.get("BridgeBlocker");

export class BridgeBlocker {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They might.

IRC uses it as-is

Slack extends it to disable its connection handlers as a blocking mechanism.

Copy link
Contributor

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?

Copy link
Contributor Author

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 :)

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now done in IRC and Slack

Copy link
Contributor

@Half-Shot Half-Shot left a 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

@@ -0,0 +1 @@
Add optional UserActivityTracker and BridgeBlocker
Copy link
Contributor

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";
Copy link
Contributor

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";
Copy link
Contributor

Choose a reason for hiding this comment

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

ping pong?

src/bridge.ts Show resolved Hide resolved
import * as logging from "./logging";
const log = logging.get("BridgeBlocker");

export class BridgeBlocker {
Copy link
Contributor

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?

src/components/intent.ts Show resolved Hide resolved
@tadzik tadzik merged commit 0b680bb into develop Sep 21, 2021
@Half-Shot Half-Shot deleted the tadzik/active-user-tracking branch May 2, 2023 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants