Skip to main content
Skip table of contents

Node.js Network Monitoring

Incoming HTTP Monitoring

By default Germain UX monitors incoming http traffic. You can disable this monitoring through GermainAPMConfiguration:

JS
const config = GermainAPM.getDefaultConfiguration('http://GERMAIN_APM_SERVER/');
config.monitoring.httpIncoming.enabled = false;

Session extraction

In addition you can provide a session extractor function to extract session ids from the incoming http traffic. By default, no session extractor is provided. 

Example below shows how you can extract an existing session id from incoming http requests' headers and pass it on to the Germain UX monitoring :

JS
const config = GermainAPM.getDefaultConfiguration('http://GERMAIN_APM_SERVER/');
config.monitoring.httpIncoming.sessionExtractor = function(incomingMessage) { // you receive an instance of the <http.incomingMessage>
  return incomingMessage.headers.sessionId;
};

Germain UX with Incoming HTTP

Germain UX allows you to tag UX monitoring data and correlate it with incoming http traffic in Node.js. To allow this correlation make sure UX is configured to tag data and Node.js is configured to allow custom http headers.

Germain UX configuration (taggingEnabled flag must be set to true):

JS
const settings = germainApm.getDefaultSettings(loaderArgs, agentConfig);
settings.plugins.network.trackingEnabled = true;

Node.js configuration to allow germain-apm-sequence custom http header:

JS
app.use(function(req, res, next) {
  	res.header("Access-Control-Allow-Origin", "*");
  	res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, germain-apm-sequence");
  	next();
});

Outgoing HTTP Monitoring

By default Germain UX monitors outgoing http traffic. You can disable this monitoring through GermainAPMConfiguration:

JS
const config = GermainAPM.getDefaultConfiguration('http://GERMAIN_APM_SERVER/');
config.monitoring.httpOutgoing.enabled = false;

Session extraction

In addition you can provide a session extractor function to extract session ids from the outgoing http traffic. By default, no session extractor is provided. 

Example below shows how you can extract an existing session id from outgoing http requests' headers and pass it on to the Germain UX monitoring :

JS
const config = GermainAPM.getDefaultConfiguration('http://GERMAIN_APM_SERVER/');
config.monitoring.httpOutgoing.sessionExtractor = function(clientRequest) { // you receive an instance of the <http.clientRequest>
  return clientRequest.getHeader('sessionId');
};

Component: Code Profiler

Feature Availability: 8.6.0 or later

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.