APM missing custom spans and incorrect name

Kibana version: 6.8.0

APM Server version:

APM Agent language and version: PHP 1.8.3

Browser version: Google Chrome 114

Original install method (e.g. download page, yum, deb, from source, etc.) and version: Install from source

Fresh install or upgraded from other version? Fresh install

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant): Using Docker locally and in AWS, I'm seeing 2 different behaviors when using Elastic APM. My code starts out making sure the transaction exists:

		$this->transaction = ElasticApm::getCurrentTransaction();
		if (!$this->transaction) {
			$this->transaction = ElasticApm::beginTransaction('other', $type);

		$this->transactionId = $this->transaction->getId();

When running stepthrough debugger, beginTransaction is never hit. Not exactly how the documentation says to do it, but when I do run start, I get an error message stating that the transaction already exists. Ok, not exactly how the document says to do it, but I can deal with that.

Next up, we figure out the page parts for the request, then set the transaction name:

    $parts = [
        // name, filter, default
	$request->getQuery('page', null, 'cli'),
	$request->getQuery('content', null, 'default'),

    Di::getElastic()->setName(implode('/', $parts));

The set name function runs this:

		$name = preg_replace('#(?=.*?\d)(?=.*?[a-zA-Z])[a-zA-Z\d]{12}#i', ':e_id', $name);
		$type = Di::getRequest()->getMethod();
		$this->transaction->setName($type . ' ' . $name);

Great! Locally, this is showing up in APM as:
GET appdetail/show

In AWS, I'm seeing this:
GET appdetail/show/a4dm3v0tqsvt/1

So why is it not changing the name of the transaction from the default?

Next problem:
I created span logging for AWS services. These are showing up beautifully when running locally. When running in AWS, only the default span services (e.g. MySQL) are shown.

Screenshot of the name change issue:

Screenshot of the span issue in comments.

Screenshot of missing spans:

Turns out this was because the environment variables in apache were removed on the server. I removed them locally and starting seeing the same behavior, where it wasn't setting the name or getting all of the spans. Put the environment variables back into apache on the server and all was good. Case closed!
It still bothers me that the spreadsheet shows that S3, DynamoDB, Redis, and other services are supported, but there is no icon or prefix for those. Only database as far as I can tell.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.