Elastic APM - Creating Transaction / Span using traceparent / trace_id in C# Agent Libraries - elasticsearch

I'm trying out the .Net agent in Elastic APM and I'm using a C# application which is created using a framework called ASP.net Boilerplate. I've added the core libraries as mentioned in the documentation and added the settings in appsettings.json. This enables the default instrumentation and I got traces in the APM visualized through Kibana.
Currently I've got a node.js application running and I publish a message to a RabbitMQ queue with the traceparent in the message payload. The C# app reads the published message. I need to create a transaction or span using this traceparent / trace id so that Kibana would show the trace among the distributed systems.
I want to know if there is a way to create a transaction (or span) using a traceparent that is being sent from another system not using a HTTP protocol. I've checked the Elastic APM agent documentation -> Public API for information but couldnt find any information on this. Is there a way? Thanks.

I want to know if there is a way to create a transaction (or span) using a traceparent that is being sent from another system not using a HTTP protocol.
Yes, this is possible and there is an API for it. This part of the documentation explains it.
So you'll need to do this when you start your transaction - I imagine in your scenario this will be when you read a message from RabbitMQ.
When you start the transaction there is an optional parameter called distributedTracingData - if you pass it, then the transaction will reuse the traceid which you passed through RabbitMQ, and this way the new transaction will be part of the whole trace. If you don't pass this parameter, a new traceid will be generated and a new trace will be started.
Another comment that may help: you pass the trace id into the method where you start the transaction and each span will inherit this trace id within a transaction - so you control this on the transaction level and accordingly you don't pass it into a span.
Here is a small code snippet on how this would look:
serializedDistributedTracingData = //read this from the message which you get RabbitMq
var transaction2 = Agent.Tracer.StartTransaction("RadFromQueue", "RabbitMQRead",
DistributedTracingData.TryDeserializeFromString(serializedDistributedTracingData));

#gregkalapos, again thank you for the information. I checked how to acquire the neccessary trace information as in node.js agent documentation and when I debugged noticed that it was the trace id. Next in the C# consumer end I placed a code snippet as mentioned in the .Net agent and gave it a run. Kibana displayed the transactions from two different services in a single trace as I hoped it would.

Related

Performing load test on Tibco JMS endpoint with JMeter

I want to perform load test on a Tibco JMS endpoint using JMeter. The endpoint is a JMS Queue Receiver that will reply to the JMS Message to end the sessions. I have done a lot of googling regarding what parameters to fill in each field of the JMS Point-to-Point sampler with no success. Attached is a screen shot of the Jmeter window. I am not sure whether this is the right sampler to use or if I should use Publisher. Either way, I do not know what to fill in each of these fields. I am currently stuck at the JNDI name Request queue field. When I put my queue name for the JMS on Tibco, I get an error that that name is not found. Leaving the field blank is also problematic. What should I fill in this field to make the request work?
We don't know your topic/queue names so we cannot help, you can ask around, see the application you're trying to simulate configuration or use Graphical Administration Tool for TIBCO® EMS to explore the endpoint and identify the proper queues for messages sending/receiving. For sending the messages you might need to set JMS_TIBCO_SENDER JNDI property
You might also be interested in Building a JMS Testing Plan - Apache JMeter article

How to send entire logs to jaeger span

Is there any way to put the std logs provided by the application and the errors to a span?
I know that I can send some logs with span.LogKV() or span.LogFields() but it makes code look bad while there are same logs with both application logger and span logger.
I'm looking for an automated way to put all logs to the corresponding span.
If you are using spring boot with auto configuration, the logs printed using log4j will be instrumented and sent automatically in the span.
In Go this is not very straightforward, and largely depends on the logging library you use and the interface it provides. One example is implemented in the HotROD demo in the Jaeger repository and it is described in the blog post accompanying the demo. It uses go.uber.org/zap logging library underneath and allows to write log statements accepting the Context argument:
logger.For(ctx).Info(
"Searching for nearby drivers",
zap.String("location", location),
)
Behind the scenes logger.For(ctx) captures the current tracing spans and adds all log statements to that span, in addition to sending then to stdout as usual.
To my knowledge, go.uber.org/zap does not yet support this mode of logging natively, and therefore requires a wrapper.
If you use another logging library, than on the high level this is what needs to happen:
there must be a way to pass the Context to the logging methods, which could be captured internally by the logging framework in the log message data structure
the "appender" (or whatever it's called, I am using log4j terminology) that's responsible for taking log messages and writing them to some output stream can be extended to retrieve the Span from the Context and write the log message to the Span using span.LogKV() or similar API.

Retrieving data from database using spring integration JDBC without poll

Currently learning spring integration, I want to retrieve information from a MySQL database to use inside an int:service-activator, or an int:splitter .
Unfortunately, it would seem that most examples and documentation is based around the idea of using an int-jdbc:inbound-channel-adapter, which in itself requires a poller. I don't want to poll a database, but rather retrieve specific data based on the payload of an existing message originating from an int:gateway. This data would then be used to further modify the payload, or assist in how the message is split.
I tried using int-jdbc:outbound-gateway, as the description states:
... jdbc.JdbcOutboundGateway' for updating a database in response to a message on the request channel, and/or for retrieving data from the database ...
This implies that it can be used for retrieval of data only and not just updates, but as I implement it, there's a complaint that at least one update statement is required:
And so I'm currently sitting with a faulty prototype that initially looks like so:
The circled piece being the non-functioning int-jdbc:outbound-gateway.
My end goal is to, based on the payload coming from the incomingGateway (in the picture above), retrieve some information from a MySQL database, and use that data to split the message in the analyzerSplitter, or to perhaps modify the payload using an int:service-activator. This should then all be linked up to a int-jdbc:message-store which I believe could assist with performance. I do not wish to poll the database on a regular basis, and I do not wish to update anything in the database.
By testing using the polling int-jdbc:inbound-channel-adapter, I am confident that my datasource bean is set up correctly and the query can execute.
How would I go about correctly setting up such behaviour in spring integration?
If you want to proceed with the flow after updating the database, you can simply use a JdbcTemplate in a method invoked by a service activator, or, if it's the end of the flow, use an outbound channel adapter.
The outbound channel adapter is the inverse of the inbound: its role is to handle a message and use it to execute a SQL query. By default, the message payload and headers are available as input parameters to the query, as the following example shows:
...

JMeter JMS Point to Point not returning correct response

JMeter Version: 2.10 .
ActiveMQ 5.9
I have a point to point JMeter script that successfully places a message on a queue. This messaged is then consumed, transformed and placed on a different queue. When I test just a request method (from jmeter), the message is successfully submitted, transformed and returned to the out queue, however when I configure JMeter to consume the response on the out queue, it shows the original request message payload as the response.
Here is my JMeter script details:
JMS Resources
QueueuConnectionFactory: ConnectionFactory
JNDI Name Request Queue: Q.REQ
JNDI Name Reply Queue: Q.RPL
Message Properties
Communication Style: Request Response
Use alternate fields for message correlation: Use Request Message ID (ticked)
Content: (XML Payload)
JNDI Properties
InitialContextFactory: org.apache.activemq.jndi.ActiveMQInitialContextFactory
queue.Q.REQ: message.in
queue.Q.RPL: message.out
java.naming.security.principal: admin
java.naming.security.credentials: admin
Properties
Provider URL: tcp://localhost:61616
I've also tried a few different combinations such as removing the reply queue and specifying a JMSReplyTo as well as manually specifying a JMSCorrelationID. If someone could point me in the right direction or even provide a working jmeter proj example, it would be much appreciated. I also used this guide: http://jmeter.apache.org/usermanual/build-jms-point-to-point-test-plan.html to help build my test.
It looks like that you're missing Q.REQ and Q.RPL definition in JNDI Properties section. They should go along with InitialContextFactory bit.
See Building a JMS Testing Plan - Apache JMeter guide for more details.
Having spoke to a few people, this is a known issue and I haven't found a suitable workaround for this issue right now.
Currently I have had to use the JMeter JMS Pub/Sub Samplers to get this to work properly. If I hear back from the user group I will update this answer accordingly.

WSO2 Workflow execution trace for debugging purposes

We are currently evaluating the latest WSO2 BPS 3.0 as an open source replacement for Oracle BPEL. So far I was able to create and deploy a workflow on the BPS server. I was also able to test it and everything seem to work fine.
The problem however is looking at the EXECUTION TRACE like we can on the Oracle BPEL console.
I succesfuuly enabled SOAP TRACING only to see SOAP messages incoming and outgoing from the BPEL process. I however would like to see the output at each interim step of the workflow. Oracle does a wonderful job wherein I can just click on individual steps in the execution trace and view the output after each step. This is a very very important functionality and am surprised is not enabled OUT OF THE BOX.
I also tried the steps at BPEL Designer for Eclipse: how to debug a BPEL process but still cannot get it to work.
Can somebody list the exact steps so I can visualize the output of every step in the workflow.
You can find the input and output messages corresponding to each activity from the instance view. From the management console, go-to instance view and click on a given process instance id. Then you would get to the instance view.
Also by enabling soap tracer from the management console, you can view the incoming and outgoing soap messages.
Additionally, you can enabling message tracing at log level to log all messages coming in and going out.

Resources