humanmade / aws-xray

HM Platform AWS X-Ray Integration
23 stars 4 forks source link

Special trace for cron / cavalcade jobs #8

Open joehoyle opened 6 years ago

joehoyle commented 6 years ago

When a cavalcade job is running, we probably want to track it as a new service "$site_name-cavalcade" so metrics are not shared with web requests. We'd also want to change a lot of the metadata to be about the job being run. I can't find a way to actually hook before / after a cavalcade job is run though. Unless there's a special before / after WP CLI command hook - Cavalcade plugin doesn't provide any hooks for this.

This would possibly work at the Cavalcade-Runner level too, which is how we capture the data for CloudWatch, but this wouldn't let us get a xhprof trace of the job, or many other in-process data that we get for web requests.

@rmccue am I missing a way to be able to hook before a Cavalcade job is run? Aside from hook all and check defined( 'CAVALCADE_JOB_ID' ); perhaps.

roborourke commented 4 years ago

@joehoyle what about WP CLI's command hooks? Could you add some to the command the runner runs? Similar to how we run the ElasticPress indexing after WP is installed.

joehoyle commented 4 years ago

@roborourke mm yeha that would probably work actually!