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.

Custom data question

See original GitHub issue

Hi,

I’m hoping for a little help here. I’ve got an hapijs api running and i’m trying to track each key value pair from the querystring, and add them as custom data. I just can’t figure out how to do this. I’m currently trying traceTrace but nothing appears to show. I can see the common property showing up.

Second quick question: if i use client in this way do I need to use trackNodeHttpRequest?

appInsights.setup(this.config.insights.key);
appInsights.start();
appInsights.defaultClient.commonProperties = {
    environment: process.env.NODE_ENV || 'development'
};

let client = appInsights.defaultClient;

server.ext('onPreResponse', (request, h) => {
    client.trackTrace( request.query );
    client.trackNodeHttpRequest({ request: request.raw.req, response: request.raw.res });
});

I want to show up here.

alt text

Thanks in advance.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
leemmcommented, Nov 29, 2018

@OsvaldoRosado I can confirm this has worked. Thanks for all your help.

1reaction
OsvaldoRosadocommented, Nov 19, 2018

@leemm To put POST parameters from the body into custom dimensions instead of from the querystring you can just slightly modify the example telemetry processor to read the proper fields from the context['http.ServerRequest'] object.

This is slightly tricky since you’ll have to re-parse the request body inside the telemetry processor. To avoid duplicating the work hapi does for you, you can export the field during your hapi request handler. Eg:

server.route({
    method: 'POST',
    path: '/',
    handler: (req)=> {
        req.raw.req.payload = req.payload;
        return 'Hello world!';
    }
});

If you do this, the payload parameters will be in your telemetry processor at context['http.ServerRequest'].payload

Read more comments on GitHub >

github_iconTop Results From Across the Web

custom questions - Metabase
No information is available for this page.
Read more >
Fine-Tune Transformer Models For Question Answering On ...
A tutorial on fine-tuning the Hugging Face RoBERTa QA Model on custom data and obtaining significant performance boosts. Extractive Question ...
Read more >
Fine-tuning with custom datasets - Hugging Face
This involves fine-tuning a model which predicts a start position and an end position in the passage. We will use the Stanford Question...
Read more >
How to build a custom data set for Question Answering #2207
Hi community, I have two questions regarding building a custom data set for the "Question Answering" task.
Read more >
Collecting Data With Custom Questions - Galaxy Digital
Your site manager panel includes several options for asking custom questions of your users. These options are available in the following ...
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