serverless-plugin-tracing icon indicating copy to clipboard operation
serverless-plugin-tracing copied to clipboard

Enabling on specific stages only

Open kbariotis opened this issue 7 years ago • 3 comments

It would be handy if we could pass a stage variable into this plugin to be enabled only at that stage. Currently, I have to reference an external file in order to check the current stage and return true/false for the tracing property.

kbariotis avatar Feb 06 '18 11:02 kbariotis

Hi @kbariotis

Could you point me to any examples of how this is done in other plugins? If I get a chance to implement this, wondering what good practice are.

alex-murashkin avatar Feb 16 '18 05:02 alex-murashkin

Hmm no not really, I don't have any concrete examples but I have implement such a feature on a plugin we use internally in my current company. You are passing an array of strings and the plugin is being enabled only if the current stage is inside that array. So for example, I want to enable tracing only on DEVELOPMENT and STAGING environments

kbariotis avatar Feb 16 '18 13:02 kbariotis

@alex-murashkin serverless-plugin-warmup has a nice pattern for this.

murtyjones avatar Mar 27 '18 15:03 murtyjones