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.

Add app.environment to payload sent to APM Server

See original GitHub issue

To run Elastic APM on multiple environments of the same service, you’d previously normally add a post-fix to the serviceName, e.g: my-service-staging or my-service-prod.

In Elastic APM 6.2 we’ll introduce a new environment property tailored specifically for this. This means that users should use the same serviceName (my-service), and instead specify the environment via a separate property whos value should be sent up to the APM Server using service.environment in the payload.

We need to settle on the name of the config option, but we’ll probably name it either env or environment.

Example usage:

require('elastic-apm-node').start({
  serviceName: 'my-service',
  env: 'production'
})

The associated environment variable would then be either ELASTIC_APM_ENV or ELASTIC_APM_ENVIRONMENT depending on what name we end up choosing.

Related APM Server PR: elastic/apm-server#366

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
geoffreybergdollcommented, May 29, 2019

Hi everyone,

I found a lot of discussions/threads/issues redirecting to here (maybe the only related issue still open…) so I guess the discussion is happening here.

IMO, the UI discussion is not the right debate. As the General APM fields include the service.environment field (see here), any agent should implement it, regardless of how (& how good) it is used within the UI.

BTW, do you know that every other agent (except .Net) implements it? python, ruby, RUM, go and java Troll: Do we really want NodeJs to be compared to .Net ? ;D

As a conclusion, I kindly request to have a second look at PR like #150 and to implement this field soon (if not now) in order to match the APM Server expectations and to be future-proof on this matter, regardless of how & when the UI will evolve.

Many thanks in advance to you, who read until here and who will upvote this long (sorry) comment.

1reaction
watsoncommented, Jun 3, 2019

It was an unfortunate mistake that the environment variable was made public in the other APM agents before it was fully supported by Elastic APM. When we discovered this mistake we updated the docs to include a warning not to use it.

So it’s on purpose we haven’t released support for it in Node.js. If we could do so, we’d have removed the support in the other agents. Unfortunately, this would have been a breaking change, so we just kept the warning.

However, we’ve been hard at work implementing support for environment throughout Elastic APM since and we’re now ready to release it in the next version of the stack (v7.2). We’ll release support for this field at the same time in this agent.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration options | APM Node.js Agent Reference [3.x]
During startup the Node.js agent queries the local environment to determine whether the application is running in a cloud environment, and provides the...
Read more >
APM Troubleshooting - Datadog Docs
Troubleshooting pipeline. The following components are involved in sending APM data to Datadog: · Confirm APM setup and Agent status · Connection errors...
Read more >
Golang Application Performance Monitoring with Elastic APM
Monitoring your application performance is an important subject that must be put in mind when we have our application running in Production.
Read more >
How can you correlate logs with APM? - Stack Overflow
If you're using Serilog to send logs to Elasticsearch, and also using Elastic APM .NET agent in your application to capture traces, you...
Read more >
elastic-apm-http-client - npm
payloadLogFile - Specify a file path to which a copy of all data sent to the APM Server should be written. The data...
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