question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

isStarted() returns true even if agent is not active

See original GitHub issue

Describe the bug isStarted() returns true even if agent is not active

To Reproduce Steps to reproduce the behavior:

	const apm = require('elastic-apm-node').start({ active: false, ...});
	if (apm.isStarted()) { 
		apm.captureError(new Error(), err => console.error(err));
	}

Error logged: Error: cannot capture error before agent is started

Expected behavior Expect to use isStarted() as a guard to run captureError method

Environment (please complete the following information)

  • OS: mac-os
  • Node.js version: v8.11.2
  • Agent version: lastic-apm-node@2.11.5

How are you starting the agent? (please tick one of the boxes)

  • Calling agent.start() directly (e.g. require('elastic-apm-node').start(...))
  • Requiring elastic-apm-node/start from within the source code
  • Starting node with -r elastic-apm-node/start

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
isitinmecommented, Jun 3, 2019

Could you please expose something like

isActive() {
    return this._conf.active;
}

to legitimize the usage to that config flag

1reaction
watsoncommented, Jun 3, 2019

@sometimesalready Ah yes good point - I didn’t think of that. We need to ensure it doesn’t return an error in this case. Maybe we should also consider only having isStarted() return true if the agent is actually active - but that’s another issue. If not we should at least update the docs to better specify what to expect

Read more comments on GitHub >

github_iconTop Results From Across the Web

Agent API | APM Node.js Agent Reference [master] - Elastic
Use isStarted() to check if the agent has already started. Returns true if the agent has started, otherwise returns false .
Read more >
Event | AnyLogic Help
Timeout triggered event functions ; boolean isActive(), Returns true, if the event is currently scheduled, false otherwise. ; void reset(), Cancels the currently ......
Read more >
[Java] Agent doesn't send data to the New Relic APM service ...
I am not able to see any data in NewRelic APM Screen. ... Default is true. enabled: true # Threshold in seconds for...
Read more >
Troubleshoot pipeline runs - Azure DevOps - Microsoft Learn
If your pipeline queues but never gets an agent, check the following items. Parallel job limits - no available agents or you have...
Read more >
List of Configuration Variables for the Operations Monitoring ...
Variable Description Restart Req... OPC_AGTMSI_ENABLE Allows an MSI instance to access OM data streams. YES ECA_ANNO_NODE To add ECS annotate nodes on OM managed nodes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found