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 metric to show participants by origin servername #65

Merged
merged 4 commits into from
Oct 22, 2020

Conversation

NerdyProjects
Copy link
Contributor

Greenlight sets a metadata field called bbb-origin-server-name with the server name of the greenlight instance.

I administrate a BBB server which has two greenlights and a custom application as users. I would like to see an approximate distribution of where clients are coming from.

This adds this metric as bbb_meetings_participant_origin_servername with the servername in the origin field. Meetings with participants without the metadata field set get added to a _no_metadata group:

bbb_meetings_participant_origin_servername{origin="_no_metadata"}

@greenstatic greenstatic self-assigned this Oct 21, 2020
@greenstatic greenstatic added the enhancement New feature or request label Oct 21, 2020
@greenstatic
Copy link
Owner

This looks interesting. I see that on my BBB server (with Greenlight) I also get the metadata:

<bbb-origin>Greenlight</bbb-origin>

Is this in your case with 2 Greenlight's the same for both?

if participants == 0:
continue
if not meeting.get("metadata") or not meeting['metadata'].get(metadata_key):
p_by_m['_no_metadata'] += participants
Copy link
Owner

Choose a reason for hiding this comment

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

Add to the empty key instead of the magic key _no_metadata:

p_by_m[''] += participants

This way the Prometheus library should generate an empty label, which is more semantically correct than a hardcoded magic string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I thought about that and decided against; I am happy with you voting for it and changed it accordingly :)

@NerdyProjects
Copy link
Contributor Author


Is this in your case with 2 Greenlight's the same for both?

https://github.com/bigbluebutton/greenlight/blob/9cb09b49d1a49bcada3b32095ff146593a453b8f/app/controllers/concerns/bbb_server.rb#L71

Yep, only the origin is set. I only went for this metadata key because greenlight is already doing it. I wonder, if this metric is useful for the general public, as I don't know how many people are using a bigbluebutton instance with more than just 1 greenlight... From the semantics at least, origin seems the right name to use to see where a participant is coming from.

@greenstatic
Copy link
Owner

I just checked another BBB server where we are using the Moodle plugin to integrate BBB into subjects. There are a couple more metdata fields, but the two we're interested in bbb-origin-server-name and bbb-origin are also present.

<bbb-origin>Moodle</bbb-origin>

Let's make this a bit more generic and add the two metadata fields into a single metric.

I propose something like this:

bbb_meetings_participant_origin(server=<bbb-origin-server-name>, name=<bbb-origin>) -

@NerdyProjects
Copy link
Contributor Author

NerdyProjects commented Oct 22, 2020

Screenshot from 2020-10-22 14-54-47
I went with your proposal, screenshot from prometheus UI after using two greenlights + the custom application (that doesn't set any metadata).

@NerdyProjects
Copy link
Contributor Author

Should it not be participants in plural?

@greenstatic
Copy link
Owner

Screenshot from 2020-10-22 14-54-47
I went with your proposal, screenshot from prometheus UI after using two greenlights + the custom application (that doesn't set any metadata).

Perfect, this is the expected behavior: https://prometheus.io/docs/concepts/data_model/

A label with an empty label value is considered equivalent to a label that does not exist.


Should it not be participants in plural?

You are probably right. Let's do the plural version.

@NerdyProjects
Copy link
Contributor Author

Okay, so be it. Any more wishes? I tested the latest commit as well in my setup, works :-)
(Not having tests feels a bit weird to me, but then it would be a lot of effort to add some...)

@greenstatic greenstatic changed the base branch from master to release-0.6 October 22, 2020 15:40
@greenstatic
Copy link
Owner

Looks great, thanks! Creating tests would be great, but the time it would take to mock BBB's API was never justified with my schedule :P

I'll merge this in the v0.6 release branch and also add a couple of panels to the Grafana dashboard. Once it's ready and running a couple of days in my BBB environment I'll make a new release.

@greenstatic greenstatic merged commit 609a8fa into greenstatic:release-0.6 Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants