michaelhyatt / elastic-apm-mule3-agent

Elastic APM agent for Mule 3.x
Apache License 2.0
19 stars 7 forks source link

Not working in cloudhub #11

Closed epaulferrer closed 5 years ago

epaulferrer commented 5 years ago

On my local machine, it successfully able to send data in apm server, but when I deployed it in cloudhub it does not send data to the apm server. Also in my local logs I got 2019-04-16 14:38:23.008 [Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.4.0 as d-bs-policy-service on Java 1.8.0_191 (Oracle Corporation) Windows 10 10.0 2019-04-16 14:38:23.010 [Attach Listener] WARN co.elastic.apm.agent.configuration.StartupInfo - To enable all features and to increase startup times, please configure application_packages this logs doesn't appear in cloudhub.. please kindly help

michaelhyatt commented 5 years ago

I know that CloudHub interferes with log4j logging, so sometimes log entries don't show in CloudHub. Let me try and test it myself to get both components to run in CloudHub.

michaelhyatt commented 5 years ago

As I suspected, all the relevant initialisation debug has been swallowed by CloudHub, as it is quite poor with handling the logging emitted by Mule. I was able to get the CloudHub deployment to work with APM server in Elastic Cloud. BTW, make sure you update your version of the agent to 1.6.0 that I just released. Main fix was making property files work in a more explicit manner. I will wait for you to confirm the agent working in CloudHub before closing it.

epaulferrer commented 5 years ago

Hi Michael,

I have updated the agent but still I can't make it work it the cloudhub deployment. I also tried downloading the jar and installing it on local maven repo then got this error in the cloudhub

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_muleNotificationManager' defined in URL [jar:file:/opt/mule/mule-3.9.0/lib/mule/mule-module-spring-config-3.9.0.jar!/minimal-mule-config.xml]: Cannot create inner bean '(inner bean)#28d36920' of type [org.mule.context.notification.ListenerSubscriptionPair] while setting bean property 'allListenerSubscriptionPairs' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#28d36920': Cannot resolve reference to bean 'traceMessageProcessorNotificationListener' while setting bean property 'listener'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'traceMessageProcessorNotificationListener': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private co.elastic.apm.mule.utils.SpanUtils co.elastic.apm.mule.listeners.TraceMessageProcessorNotificationListener.spanUtils; nested exception is java.lang.NoClassDefFoundError: co/elastic/apm/api/Span Related cause: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name '_defaultUserObjectStore': Requested bean is currently in creation: Is there an unresolvable circular reference?

michaelhyatt commented 5 years ago

ch_test.zip apm-mule3-agent-1.6.2.jar

I tested it again with the attached sample project and v1.6.2 jar. I also used the following properties in CH to configure the chtest app to communicate to the APM server deployed into Elastic Cloud:

elastic.apm.mule.capture_output_properties=true
elastic.apm.secret_token=<token>
elastic.apm.active=true
elastic.apm.server_urls=https://xxxxxxxx.apm.ap-northeast-1.aws.cloud.es.io:443
elastic.apm.log_level=INFO
elastic.apm.mule.capture_input_properties=true
elastic.apm.mule.capture_output_properties_regex=(.*)
elastic.apm.service_version=v1.0.0
elastic.apm.instrument=false
elastic.apm.stack_trace_limit=3
elastic.apm.service_name=component1
elastic.apm.span_frames_min_duration=0ms
elastic.apm.mule.capture_input_properties_regex=http_(.*)

These three things should definitely work together. In the properties, you will need to update the apm server url and secret token.

michaelhyatt commented 5 years ago

@epaulferrer

michaelhyatt commented 5 years ago

@epaulferrer closing it for now, as it should be working for you with the examples provided.

michaelhyatt commented 5 years ago

Please reopen if it is still an issue