Kibana version:
7.5.2
Elasticsearch version:
7.5.2
APM Server version:
7.5.2
Kibana 7.5.2
APM Agent language and version:
elastic-apm-node : 3.6.1
How do we capture the socket events?
I am using TypeScript version (3.9.6) for writing this functionality.
I tried to work around using custom Transaction to this way.
apm.startTransaction("Socket Unknown", "request", "socket.io");
This call is always throwing me error
TypeError: apm.startTransaction is not a function
at /Users/sreedhar/projects/ABC/Example/build/index.js:71:9
at Layer.handle [as handle_request] (/Users/sreedhar/projects/ABC/Example/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/sreedhar/projects/ABC/Example/node_modules/express/lib/router/
my sample code for health check:
import * as apm from 'elastic-apm-node/start'
const app = new ExampleServer().getApp(); // express app
app.use(bodyParser.json());
app.get("/health", (request , response) => {
apm.startTransaction("Health Test");
response.statusCode = 200;
response.statusMessage = "OK";
response.send(
{
"Health" : "OK",
"ServiceName" : "VideoCallService"
}
)
});
"dependencies": {
"@sentry/integrations": "5.19.1",
"@sentry/node": "5.19.1",
"@types/node": "^14.0.23",
"@types/socket.io": "^2.1.8",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"elastic-apm-node": "^3.6.1",
"express": "^4.17.1",
"nodemon": "^2.0.4",
"rimraf": "^3.0.2",
"socket.io": "^2.3.0"
},
"devDependencies": {
"@danmasta/mocha-sonar": "0.0.6",
"@types/cors": "^2.8.6",
"codecov": "^3.7.0",
"cypress-multi-reporters": "^1.4.0",
"mocha": "^8.0.1",
"mocha-junit-reporter": "^2.0.0",
"nyc": "^15.1.0",
"tslib": "^2.0.0",
"typescript": "^3.9.6",
"ts-node": "^8.10.2",
"supertest": "latest"
}
}
All the settings are loaded with environment variables.