-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Turning on Instrumentation using ember-cli-dotenv #7429
Description
I'd like to enable the ember-cli instrumentation using the .env file from ember-cli-dotenv but it appears doing it that way sets the environment variable too late in the process. The init is set up here
Lines 6 to 14 in a473454
| let initInstrumentation; | |
| if (instrumentation.instrumentationEnabled()) { | |
| const heimdall = require('heimdalljs'); | |
| let initInstrumentationToken = heimdall.start('init'); | |
| initInstrumentation = { | |
| token: initInstrumentationToken, | |
| node: heimdall.current, | |
| }; | |
| } |
ember server I get the following error
➜ instrumentation-dotenv git:(master) ember server
No such instrumentation "init"
Error: No such instrumentation "init"
at Instrumentation._instrumentationFor (/Users/patocallaghan/src/me/instrumentation-dotenv/node_modules/ember-cli/lib/models/instrumentation.js:171:13)
at Instrumentation.stopAndReport (/Users/patocallaghan/src/me/instrumentation-dotenv/node_modules/ember-cli/lib/models/instrumentation.js:227:22)
at Promise.resolve.then (/Users/patocallaghan/src/me/instrumentation-dotenv/node_modules/ember-cli/lib/cli/cli.js:153:25)
at tryCatch (/Users/patocallaghan/src/me/instrumentation-dotenv/node_modules/rsvp/dist/rsvp.js:525:12)
at invokeCallback (/Users/patocallaghan/src/me/instrumentation-dotenv/node_modules/rsvp/dist/rsvp.js:538:13)
at /Users/patocallaghan/src/me/instrumentation-dotenv/node_modules/rsvp/dist/rsvp.js:606:14
at flush (/Users/patocallaghan/src/me/instrumentation-dotenv/node_modules/rsvp/dist/rsvp.js:2415:5)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
My use case is I'd like to collect metrics, i.e. initial and rebuild times, from my team but would rather they didn't have to:
- set the
EMBER_CLI_INSTRUMENTATIONvar themselves - provide a script which they'd use instead of
ember serverwhich sets the var and callsember server.
I'd rather it configured by default i.e. turned on by some sort of config file.
I have a replication repo of the issue here https://github.com/patocallaghan/instrumentation-dotenv
I'm not tied to ember-cli-dotenv so if you have any suggestions how to achieve what I'm trying to do I'd appreciate it, or if you directions on how to fix the issue I'd be happy to put the PR together myself.
Output from ember version --verbose && npm --version && yarn --version:
ember-cli: 2.16.2
http_parser: 2.7.0
node: 7.10.1
v8: 5.5.372.43
uv: 1.11.0
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 51
openssl: 1.0.2k
icu: 58.2
unicode: 9.0
cldr: 30.0.3
tz: 2016j
os: darwin x64
4.2.0
1.2.1