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.