Skip to content

Commit

Permalink
[Hotfix] Fix wrong context on hook handlers (#23)
Browse files Browse the repository at this point in the history
Hooks handlers were bound to the PrometheusPlugin instance instead of the PrometheusController instance
  • Loading branch information
Aschen authored Jul 7, 2021
1 parent 73fb676 commit b49c547
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions lib/PrometheusPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ export class PrometheusPlugin extends Plugin {
};

this.hooks = {
'connection:new': this.prometheusController.recordConnections.bind(this),
'connection:remove': this.prometheusController.recordConnections.bind(this),
'core:hotelClerk:addSubscription': this.prometheusController.recordRooms.bind(this),
'core:hotelClerk:removeRoomForCustomer': this.prometheusController.recordRooms.bind(this),
'request:onSuccess': this.prometheusController.recordRequests.bind(this),
'request:onError': this.prometheusController.recordRequests.bind(this)
'connection:new': this.prometheusController.recordConnections.bind(this.prometheusController),
'connection:remove': this.prometheusController.recordConnections.bind(this.prometheusController),
'core:hotelClerk:addSubscription': this.prometheusController.recordRooms.bind(this.prometheusController),
'core:hotelClerk:removeRoomForCustomer': this.prometheusController.recordRooms.bind(this.prometheusController),
'request:onSuccess': this.prometheusController.recordRequests.bind(this.prometheusController),
'request:onError': this.prometheusController.recordRequests.bind(this.prometheusController)
};
}
}
4 changes: 2 additions & 2 deletions lib/controllers/PrometheusController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export class PrometheusController {

/**
* PrometheusController constructor
* @param config
* @param context
* @param config
* @param context
*/
constructor (config: JSONObject, context: PluginContext) {
this.config = config;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kuzzle-plugin-prometheus",
"version": "3.0.2",
"version": "3.0.3",
"description": "Kuzzle plugin: monitoring Kuzzle using Prometheus",
"author": {
"name": "The Kuzzle Team <[email protected]>"
Expand Down

0 comments on commit b49c547

Please sign in to comment.