Support passing license_key into newrelic.agent.initialize
See original GitHub issueIs your feature request related to a problem? Please describe.
I’d like to have the option to pass the license key directly into the agent initialization function. I don’t want to include it in the newrelic.ini file, since the key is a secret and is only available to the application during deployment.
Feature Description
if my_app.config["environment"] in ("stage", "live"):
newrelic.agent.initialize(
config_file="newrelic.ini",
environment=my_app.config["environment"],
log_level=my_app.config["loglevel"],
license_key=my_app.config["new_relic_license_key"], # <-- this is what would it look like
)
newrelic.agent.register_application()
Describe Alternatives
I could also have newrelic read the license key from the env, but our app doesn’t use the env for configuration as of yet. And splitting configuration options over multiple avenues would be a bad design, so we’d rather not do it.
As a workaround, we currently manipulate os.environ
before importing any newrelic modules.
Additional Context
I tried to write a PR myself, but the config parsing for newrelic is wild, and I couldn’t get it to work by myself.
Priority
[Nice to Have]
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Python agent configuration | New Relic Documentation
The only required Python agent configuration setting is the license key. The license key identifies the account where the agent reports application data....
Read more >Python agent admin script: Advanced usage
Type 'newrelic-admin help <command>' for help on any of the commands ... agent configuration file is generated, only the license key option in...
Read more >initialize (Python agent API) - New Relic Documentation
This is called to initialize the Python agent with a specified configuration file when the agent is being manually integrated with a Python...
Read more >Invalid license key, the agent is no longer reporting information
Getting invalid license when launching my application. Tried all the solutions from newrelic discussions page. Still getting the same error.
Read more >Java agent configuration: Config file | New Relic Documentation
New Relic's Java agent config settings for APM, including transaction tracer, errors, custom instrumentation, distributed tracing, system properties, etc.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OH! You’re in the EU! Ha!! OK. You’ll also need to set the host!
Yeah thanks for bringing this up! We should probably consider API usage when using an EU license key. This is something we’ll chat about on the team!