While evaluating APM and Elastic, we came across some possible issues:
- Our current solutions pipes container logs to Elasticsearch, limiting outbound calls, and persisiting 100% of all logs created.
- We would like to utilize APM metrics with serverless technologies, where functions are created and destroyed before an APM server connection can be made.
Both of these problems seem to have the same solution: continue to pipe container logs to ES, via firehose-style means.
Which leads me to my question:
Can I configure the APM agents to write apm messages to the console (or a logger, in general)? If so, can I also configure the APM agent to not make requests to the APM server?
Yes, this is possible, but it'll require some work.
When the agent is constructed, one component it initializes is a payloadsender. It implements this IPayloadSender interface. As you can see on the interface, the agent will put every event into this PayloadSender - you could have an implementation which just prints the events to the console - or into a logger.
Here is how you can initialize the agent with your own payloadsender:
class MyPayloadSender : IPayloadSender
public void QueueTransaction(ITransaction transaction)
// Serialize and write to console
public void QueueError(IError error) => throw new NotImplementedException();
public void QueueMetrics(IMetricSet metrics) => throw new NotImplementedException();
public void QueueSpan(ISpan span) => throw new NotImplementedException();
internal class Program
private static void Main(string args)
var myPayloadSender = new MyPayloadSender();
Agent.Setup(new AgentComponents(payloadSender: new MyPayloadSender()));
Once you replaced the original payloadsender, the agent won't try to send any data to the APM Server.
Downside is that you'll also loose the default serialization and queuing feature of the agent, so if you need those, you'll need to re-implement that part.
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.