From e603b458af6a036bc248cbe53f30a12c262ba1e8 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Mon, 30 Sep 2019 16:00:15 +0400 Subject: [PATCH] Ignore file-upload meteor-method by ostrio:files The package ostrio:files registers meteor-method calls starting by "_FilesCollectionWrite_" followed by the name of the file-collection. These method-calls are used to upload files to the server. Monitoring these methods (which come in rapidly as we want to upload the file fastest possible) would result in sending the full file in a EJSON encoded way also to the monitoring system. --- instrumenting/session.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instrumenting/session.js b/instrumenting/session.js index 6881d13..9d2aba6 100644 --- a/instrumenting/session.js +++ b/instrumenting/session.js @@ -12,7 +12,8 @@ function start(agent, Session) { agent.setCustomContext(msg.params || {}); agent.setUserContext({ id: this.userId || 'Not authorized' }); - if (transaction) { + // _FilesCollectionWrite_ is a prefix for meteor-methods used by meteor/ostrio:files. It sends files via DDP to the server. Monitoring it would send the file - byte-serialized - on to the monitoring system. + if (transaction && (!msg.method || !msg.method.startsWith('_FilesCollectionWrite_'))) { transaction.addLabels({ params: JSON.stringify(msg.params) });