newrelic / newrelic-salesforce-exporter

New Relic integration for Salesforce logs.
Apache License 2.0
10 stars 14 forks source link

run_as_service set to True causes error #26

Closed Sunnova-TaylorSammons closed 3 months ago

Sunnova-TaylorSammons commented 4 months ago

Description

When trying to run the the integration with run_as_service = true in config I am now getting this error after the most recent update.

2024-04-26 14:47:33,244 (13772/MainThread) newrelic.core.agent INFO - New Relic Python Agent (9.7.0) 2024-04-26 14:47:34,930 (13772/NR-Activate-Session/New Relic Salesforce Exporter) newrelic.core.agent_protocol ERROR - Data collector is indicating that an incorrect license key has been supplied by the agent. Please correct any problem with the license key or report this problem to New Relic support. {"message": "Integration start. Using program arguments []", "timestamp": 1714160863287, "level": "info"} Traceback (most recent call last): File "c:\Users\taylor.sammons\Documents\Projects\newrelic-salesforce-exporter2\newrelic-salesforce-exporter\src\__main__.py", line 247, in <module> main() File "C:\Users\taylor.sammons\Documents\Projects\newrelic-salesforce-exporter2\newrelic-salesforce-exporter\.venv\Lib\site-packages\newrelic\packages\wrapt\wrappers.py", line 598, in __call__ return self._self_wrapper(self.__wrapped__, self._self_instance, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\taylor.sammons\Documents\Projects\newrelic-salesforce-exporter2\newrelic-salesforce-exporter\.venv\Lib\site-packages\newrelic\api\background_task.py", line 111, in wrapper return wrapped(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\taylor.sammons\Documents\Projects\newrelic-salesforce-exporter2\newrelic-salesforce-exporter\src\__main__.py", line 241, in main run(config, event_type_fields_mapping, numeric_fields_list) File "c:\Users\taylor.sammons\Documents\Projects\newrelic-salesforce-exporter2\newrelic-salesforce-exporter\src\__main__.py", line 205, in run run_as_service(config, event_type_fields_mapping, numeric_fields_list) File "c:\Users\taylor.sammons\Documents\Projects\newrelic-salesforce-exporter2\newrelic-salesforce-exporter\src\__main__.py", line 174, in run_as_service Integration( File "c:\Users\taylor.sammons\Documents\Projects\newrelic-salesforce-exporter2\newrelic-salesforce-exporter\src\newrelic_logging\integration.py", line 105, in __init__ self.new_relic = newrelic_factory.new(config) ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'dict' object has no attribute 'new' 2024-04-26 14:47:43,330 (13772/MainThread) newrelic.core.agent INFO - New Relic Python Agent Shutdown

Also, receiving license key problem... but am using valid ingest license. When run_as_service set to false it runs as expected but still see the license key issue: "(13772/NR-Activate-Session/New Relic Salesforce Exporter) newrelic.core.agent_protocol ERROR - Data collector is indicating that an incorrect license key has been supplied by the agent. Please correct any problem with the license key or report this problem to New Relic support."

Steps to Reproduce

  1. Clone repo
  2. Create venv
  3. Set in config run_as_service = true
  4. run main.py

Expected Behavior

No exception error

Relevant Logs / Console output

Your Environment

OS: Windows V: 10.0.19045

Additional context

sdewitt-newrelic commented 4 months ago

@Sunnova-TaylorSammons this should be fixed in the latest release. Please confirm.

kanwaljit-mq commented 3 months ago

My issue is this But when I give hour values explicitly, I do get the error reported in this issue.

integration_name: com.newrelic.labs.sfdc.eventlogfiles
run_as_service: True
cron_interval_minutes: 60
service_schedule:
  hour: "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23"
  minute: "0,5,10,15,2,25,30,35,40,45,50,55"

ERROR (1/NR-Activate-Session/New Relic Salesforce Exporter) newrelic.core.agent_protocol ERROR - Data collector is indicating that an incorrect license key has been supplied by the agent. Please correct any problem with the license key or report this problem to New Relic support

I am on latest release at this

Ashutosh2547 commented 3 months ago

Hellos, There are a couple of issues here.

  1. The first one has been highlighted by @kanwaljit-mq that we need to specify hour in quotes instead of plain text. It is expecting hours to be entered something like "" not ,
  2. The second issue is related to missing information in the Readme.md file. Readme file doesn't mention that we also need to put your New Relic license key in "newrelic.ini" file too. Please supply the license ky in this file and it should work fine.
sdewitt-newrelic commented 3 months ago

@Ashutosh2547 @kanwaljit-mq the README.md does mention the requirement of adding the license key to the newrelic.ini. Please see here. I would recommend you use the NEW_RELIC_LICENSE_KEY rather than adding it to the newrelic.ini, but either should work fine.

kanwaljit-mq commented 3 months ago

@Ashutosh2547 @sdewitt-newrelic I have seeing that when you set set it to run as service, you will need to specify new relic license key in newrelic.ini file only, otherwise you will get below error. HTH ERROR - Data collector is indicating that an incorrect license key has been supplied by the agent With key in this file, it works fine for me.

Ashutosh2547 commented 3 months ago

On my bench when I tried last time I was getting the Data Collector error even with set as service false. @sdewitt-newrelic I did update the NEW_RELIC_LICENSE_KEY but updating it alone didn't work. In the source code too I saw the newrelic.ini is being used to load the new relic configuration I had to update the newrelic.ini file

Sunnova-TaylorSammons commented 3 months ago

Latest release fixed issue.