Skip to content

Java API to allow setting external start and end timestamps on spans and transactions #236

@michaelhyatt

Description

@michaelhyatt

In my case, I am using asynchronous notifications with callbacks that can be processed at a later time than the original event occurred. In my case, I am able to retrieve the event timestamp from the notification parameter passed into the callback. I would like to be able to specify my own timestamp at start of transaction or a span, as well at an end of transaction or a span.

My callback code example:

public class TraceMessageProcessorNotificationListener
		implements MessageProcessorNotificationListener<MessageProcessorNotification> {

	@Override
	public void onNotification(MessageProcessorNotification notification) {

		switch (notification.getAction()) {
		case MessageProcessorNotification.MESSAGE_PROCESSOR_PRE_INVOKE:
			spanUtils.startSpan(notification); // <-- Set start span time explicitly here
			break;

		case MessageProcessorNotification.MESSAGE_PROCESSOR_POST_INVOKE:
			spanUtils.endSpan(notification); // <-- Set end span time explicitly here
			break;
		}
	}
}

Metadata

Metadata

Assignees

Labels

apiPublic APIenhancementEnhancement of an existing feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions