question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transaction name is `${method} unknown route` in Koa

See original GitHub issue

Describe the bug Kibana APM UI shows all transaction name as ${method} unknown route. I think it should be ${method} ${path}. How should I fix?

To Reproduce Steps to reproduce the behavior: No configuration. Imported on the top of main script file.

Expected behavior I think it should be ${method} ${path}.

Environment (please complete the following information)

  • OS: Ubuntu 16.04 LTS
  • Node.js version: 10.15.0
  • APM Server version: 6.5.4
  • Agent version: 2.1.0

How are you starting the agent? (please tick one of the boxes)

  • Calling agent.start() directly (e.g. require('elastic-apm-node').start(...))
  • Requiring elastic-apm-node/start from within the source code
  • Starting node with -r elastic-apm-node/start

Additional context Add any other context about the problem here.

  • Agent config options

    Click to expand
    replace this line with your agent config options
    
  • package.json dependencies:

    Click to expand
    replace this line with your dependencies section from package.json
    

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
watsoncommented, Apr 13, 2021

@sibelius the require-in-the-middle module uses the debug module for outputting debug info. So if you use the environment variable DEBUG you can get it to output debug information:

DEBUG=require-in-the-middle
1reaction
watsoncommented, Jan 17, 2019

Ah, I figured it out! I’m now able to recreate this locally.

In a temp directory, you can recreated it by doing the following:

mkdir node_modules
npm install koa-router watson/apm-agent-nodejs#debug2
cp -r node_modules tmp-node_modules
mv tmp-node_modules node_modules/node_modules
DEBUG=* node test.js

Where test.js contains the following:

require('elastic-apm-node').start({serviceName: 'test'})
require('koa-router')

This will nest the node_modules folder inside it self which will trip up our algorithm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

APM and Koa unknown route - APM - Discuss the Elastic Stack
This error message indicates a problem with setting the default name for a transaction. When my version of your program had apm.
Read more >
First steps with Koa.js - LogRocket Blog
The first param asks for a canonical name for your endpoint, and the second requires the path string that maps to this endpoint....
Read more >
Koa-router route urls that don't exist - node.js - Stack Overflow
I've implemented routing with @koa/router and I have the routes in a separate file. Anyway, I've simply added the above function right before...
Read more >
qWJ - River Thames Conditions
Chasis oh 1830, Mysha name origin, Jerkbait fishing uk, Precious metals ... Stock options trading, Medley brazil sanofi, 867 kitchawan road ossining ny!...
Read more >
Top 5 koa-router Code Examples - Snyk
customTransactionName ; } else { // newrelic has frontend display logic, which will format the transaction name if it's under express // (method,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found