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

Clarify use of 'FCM' in app type and refactor to use 'FCM' #251

Closed
wants to merge 12 commits into from

Conversation

H-Shay
Copy link
Contributor

@H-Shay H-Shay commented Aug 20, 2021

Addresses issue #230. This PR allows for both gcm and fcm to be used as app types, warns that the app type gcm will soon be depreciated, and refactors sygnal to clarify that we are using Firebase Cloud Messaging exclusively.

@H-Shay
Copy link
Contributor Author

H-Shay commented Aug 20, 2021

Totally baffled as to why the changelog check is failing.

@clokep clokep requested a review from a team August 23, 2021 12:13
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

Totally baffled as to why the changelog check is failing.

Looks like the CI is finding the changelog at <checkout dir>/sygnal/changelog.d/251.misc, rather than <checkout dir>/changelog.d/251.misc, which its expecting.

The changelog CI code was just recently updated, and the changelog location in your PR looks correct. I might suggest trying to merge in the main branch and see if that works.

README.rst Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
changelog.d/251.misc Outdated Show resolved Hide resolved
sygnal.yaml.sample Outdated Show resolved Hide resolved
sygnal.yaml.sample Outdated Show resolved Hide resolved
sygnal.yaml.sample Outdated Show resolved Hide resolved
Comment on lines -40 to 58
"sygnal_gcm_queue_time", "Time taken waiting for a connection to GCM"
"sygnal_fcm_queue_time", "Time taken waiting for a connection to FCM"
)

SEND_TIME_HISTOGRAM = Histogram(
"sygnal_gcm_request_time", "Time taken to send HTTP request to GCM"
"sygnal_fcm_request_time", "Time taken to send HTTP request to FCM"
)

PENDING_REQUESTS_GAUGE = Gauge(
"sygnal_pending_gcm_requests", "Number of GCM requests waiting for a connection"
"sygnal_pending_fcm_requests", "Number of FCM requests waiting for a connection"
)

ACTIVE_REQUESTS_GAUGE = Gauge(
"sygnal_active_gcm_requests", "Number of GCM requests in flight"
"sygnal_active_fcm_requests", "Number of FCM requests in flight"
)

RESPONSE_STATUS_CODES_COUNTER = Counter(
"sygnal_gcm_status_codes",
"Number of HTTP response status codes received from GCM",
"sygnal_fcm_status_codes",
"Number of HTTP response status codes received from FCM",
labelnames=["pushkin", "code"],
Copy link
Member

Choose a reason for hiding this comment

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

Note that modifying these will likely break existing metrics dashboards. Thus this (as well as the span tag name changes below) will need to be detailed in the changelog as well so sysadmins aren't caught off guard 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So afaict my main branch is up to date with the latest sygnal changes, and this fork as well-attempting to merge from main just gives an "Already up to date" message, yet the changelog check is still failing. I can't tell if I am missing something simple here!

Copy link
Member

Choose a reason for hiding this comment

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

Looks like it's passing now! (Thanks @reivilibre!)

@reivilibre
Copy link
Contributor

the changelog issue is odd. It was shown to work in the PR that added it :|. I can't see what's wrong with it or why it would act differently in either case.

@reivilibre
Copy link
Contributor

reivilibre commented Aug 23, 2021

it seems like there's an issue with the newsfile checker when used with a fork rather than a branch, as I found out by experimenting with #253 (and #252).
I'll look into this, sorry for the hassle (edit: #254 should address this)

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

Looks good to me other than the minor bits below!

Comment on lines -40 to 58
"sygnal_gcm_queue_time", "Time taken waiting for a connection to GCM"
"sygnal_fcm_queue_time", "Time taken waiting for a connection to FCM"
)

SEND_TIME_HISTOGRAM = Histogram(
"sygnal_gcm_request_time", "Time taken to send HTTP request to GCM"
"sygnal_fcm_request_time", "Time taken to send HTTP request to FCM"
)

PENDING_REQUESTS_GAUGE = Gauge(
"sygnal_pending_gcm_requests", "Number of GCM requests waiting for a connection"
"sygnal_pending_fcm_requests", "Number of FCM requests waiting for a connection"
)

ACTIVE_REQUESTS_GAUGE = Gauge(
"sygnal_active_gcm_requests", "Number of GCM requests in flight"
"sygnal_active_fcm_requests", "Number of FCM requests in flight"
)

RESPONSE_STATUS_CODES_COUNTER = Counter(
"sygnal_gcm_status_codes",
"Number of HTTP response status codes received from GCM",
"sygnal_fcm_status_codes",
"Number of HTTP response status codes received from FCM",
labelnames=["pushkin", "code"],
Copy link
Member

Choose a reason for hiding this comment

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

Looks like it's passing now! (Thanks @reivilibre!)

@@ -0,0 +1,15 @@
Addresses #230, refactors sygnal to use fcm as app type rather than gcm, and warns in documents about the future deprcation of gcm as an app type. Due to these changes, some prometheus metrics names were updated to refer to Firebase Cloud Messaging (fcm) instead of the legacy Google Cloud Messaging (GCM) services. You can find a list of the changed metric names below:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Addresses #230, refactors sygnal to use fcm as app type rather than gcm, and warns in documents about the future deprcation of gcm as an app type. Due to these changes, some prometheus metrics names were updated to refer to Firebase Cloud Messaging (fcm) instead of the legacy Google Cloud Messaging (GCM) services. You can find a list of the changed metric names below:
Addresses #230, refactors sygnal to use fcm as app type rather than gcm, and warns in documents about the future deprecation of gcm as an app type. Due to these changes, some prometheus metrics names were updated to refer to Firebase Cloud Messaging (fcm) instead of the legacy Google Cloud Messaging (GCM) services. You can find a list of the changed metric names below:

Additionally, there's still a few places which say "will deprecate" rather than "is deprecated" which should be updated 🙂

gcm_num_devices -> fcm_num_devices
gcm_num_failed -> fcm_num_failed

If you make use of either Prometheus (and thus Grafana, etc) metrics or use OpenTracing with Sygnal, please ensure your queries are up to date.
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for including this information! Note that newsfragments (this file) should just be one line that gives a brief summary. For the call out of the deprecation, that should just be placed at the top of the CHANGELOG.md file as part of this PR (rather than the newsfragment).

Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

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

some little tweaks I've spotted. I think anoa will be in charge of giving this the tick though still?

CHANGELOG.md Outdated
@@ -1,3 +1,19 @@
This release deprecates the use of gcm as an app type and refactors Sygnal to use fcm as an app type exclusively. Due to these changes, some prometheus metrics names were updated to refer to Firebase Cloud Messaging (fcm) instead of the legacy Google Cloud Messaging (GCM) services. You can find a list of the changed metric names below:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This release deprecates the use of gcm as an app type and refactors Sygnal to use fcm as an app type exclusively. Due to these changes, some prometheus metrics names were updated to refer to Firebase Cloud Messaging (fcm) instead of the legacy Google Cloud Messaging (GCM) services. You can find a list of the changed metric names below:
This release deprecates the use of `gcm` as an app type and refactors Sygnal to use `fcm` as an app type exclusively. Due to these changes, some Prometheus metrics' names were updated to refer to Firebase Cloud Messaging (FCM) instead of the legacy Google Cloud Messaging (GCM) services. You can find a list of the changed metric names below:

@@ -0,0 +1 @@
Addresses #230, refactors sygnal to use fcm as app type rather than gcm, and warns in documents about the deprecation of gcm as an app type.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Addresses #230, refactors sygnal to use fcm as app type rather than gcm, and warns in documents about the deprecation of gcm as an app type.
Rename the `gcm` app type to `fcm` to reduce confusion (Google Cloud Messaging changed name to Firebase Cloud Messaging in 2016). The app type `gcm` is deprecated and will be removed in a future release.

#
#com.example.myapp.android:
# type: gcm
# api_key: your_api_key_for_gcm
# type: fcm or gcm
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# type: fcm or gcm
# type: fcm

no point suggesting something that's deprecated, I'd say (also it should be directly uncommentable so that it works)

Comment on lines 201 to 204
# This is an example FCM/GCM push configuration. Note that the gcm type is a legacy
# setting as we now use Firebase Cloud Messaging (fcm) exclusively. Setting gcm as the
# app type is still accepted but understand that under the hood we are using fcm.
# The gcm app type is deprecated.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# This is an example FCM/GCM push configuration. Note that the gcm type is a legacy
# setting as we now use Firebase Cloud Messaging (fcm) exclusively. Setting gcm as the
# app type is still accepted but understand that under the hood we are using fcm.
# The gcm app type is deprecated.
# This is an example FCM push configuration.
# FCM was formerly known as GCM.
# The deprecated app type `gcm` is equivalent but will be removed from a future Sygnal release.

Comment on lines 70 to 73
# We include NotRegistered here too for good measure, even
# though gcm-client 'helpfully' extracts these into a separate
# though fcm-client 'helpfully' extracts these into a separate
# list.
BAD_PUSHKEY_FAILURE_CODES = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# We include NotRegistered here too for good measure, even
# though gcm-client 'helpfully' extracts these into a separate
# though fcm-client 'helpfully' extracts these into a separate
# list.
BAD_PUSHKEY_FAILURE_CODES = [
BAD_PUSHKEY_FAILURE_CODES = [

gcm-client was a library for using GCM, so renaming the reference to fcm-client doesn't make sense anymore.

However, gcm-client isn't even in use, so this comment is probably very crufty — hence I think it should just be removed altogether.

Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

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

maybe anoa will have opinions about ' vs `.

CHANGELOG.md Show resolved Hide resolved
changelog.d/251.misc Show resolved Hide resolved
@callahad
Copy link
Contributor

Without looking at this too closely, do we have opinions about referring to this as "FCM" versus something more specific to the FCM API we implement?

Namely, Sygnal supports the "legacy HTTP" API, not the newer "HTTP v1" API (cite: Migrate from legacy HTTP to HTTP v1)

Concretely this would probably mean using fcm_legacy or similar instead of just fcm so that we have room for fcm_v1 later.

@reivilibre
Copy link
Contributor

Without looking at this too closely, do we have opinions about referring to this as "FCM" versus something more specific to the FCM API we implement?

Namely, Sygnal supports the "legacy HTTP" API, not the newer "HTTP v1" API (cite: Migrate from legacy HTTP to HTTP v1)

Concretely this would probably mean using fcm_legacy or similar instead of just fcm so that we have room for fcm_v1 later.

On one hand, I don't see much advantage, unless we intend to support both separately? They may be two different APIs, but they are both APIs onto the same service. We never had an app type change when we moved over from the old, binary-protocol APNS to the HTTP/2 APNS, for example. Renaming it to something with 'legacy' in the name is kind of unfortunate when it's the 'gcm' option that's the legacy option.

On the other hand, perhaps we will migrate to the v1 API one day (if there's a use case for it). I can't tell if admins will need to make any config changes then or not (it seems like the format of access tokens might have changed, so perhaps?). If that's the case, I can feel someone wanting to say that we should honour both options (:P) for some time whilst admins migrate (although I suppose nobody is forcing them to upgrade Sygnal until they're ready to amend the configuration).

@anoadragon453
Copy link
Member

Having fcm_legacy without a fcm sounds a bit confusing. I'd suggest we either just do fcm_v1 when the time comes, or simply add an additional option under the pushkin config to choose the API, while still keeping an app type of fcm.

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

I have no more suggestions other than to resolve the open discussions above 🙂

@rltas
Copy link

rltas commented Feb 16, 2023

What about supporting both type: gcm and type: fcm and introducing a new parameter server_key for the latter?
Then for a transition period, existing configs keep working with the legacy API without config changes:
type: gcm
api_key: your_api_key_for_gcm
But if you're going with fcm, it would have to be:
type: fcm
server_key: your_server_key_for_gcm
This would be more proper (less confusing) naming anyway.
Then when #313 is ready, issue deprecation warnings on startup for a transition period when server_key is used, before finally removing the old code altogether, because Google will remove the legacy API at some point.
This would be a good process for those who have to maintain Sygnal (admins), because they're usually not the ones doing the Google/app stuff.
Because this change has been delayed for quite some time, while Matrix gained quite a bit of popularity, many new setups unfortunately now use type: gcm and have to be given some head notice.
When using the ansible playbook to setup a Matrix stack, this can be elegantly mitigated anyway.

@H-Shay H-Shay closed this Jul 26, 2024
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.

5 participants