Creating new transactions

When to use: Plumbr Agent fails to automatically discover transactions in a given application.

How: In this case, the transaction should be created manually by first calling eu.plumbr.api.Plumbr.newSpan(), then configuring the service name and application of the span and calling eu.plumbr.api.Span.start() to start it and eu.plumbr.api.Span.finish() to end it.

Example:

Plumbr
  .newSpan()
  .setServiceName("My Service")
  .setUserId("user@domain.com")
  .start();

try {
  // do work
} catch (Exception e) {
  Plumbr.getCurrentSpan().fail(e);
} finally {
  Plumbr.getCurrentSpan().finish();
}

NB! service name is mandatory for manually created root spans. If not set, transaction will be discarded.