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.

Our app does some periodic polling, which is started by a setInterval and not an external call to our app. This call is missing a trace id. Would it be possible for us to manually set an ID before kicking of the async calls?

Or code is essentially this

export async function setupBroadcastPolling(client: SomeClient) {
  async function loadMessages() {
    try {
      const data = await loadBroadcastMessages(client);

      if (data) {
        broadcastMessages = data.messages;
      }
    } catch (error) {
      logger.error({ error }, 'Unable to poll broadcast messages');
    }
  }

  // reload every minute
  setInterval(loadMessages, 60 * 1000).unref();

  await loadMessages();
}

It would be great if we could have an ID in our logs in this case as well. In this case I’d love to somehow set an ID if it’s missing within the loadMessages function. Our client does a bunch of logging as it works, which are all missing the request ID

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
SimenBcommented, Jun 19, 2020

12.18.0 in prod, 12.18.1 locally. It works consistently locally with both 12.17.0 and 12.18.1. Hoping it’s not something weird with the load balancers in GCP or something…

1reaction
SimenBcommented, Jun 19, 2020

Thanks! I’m having troubles reproducing this locally, it seems to only happen when deployed, for some reason… Will keep on trying to get a reproduction locally

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set autogenerated Id manually? - java - Stack Overflow
Using @GeneratedValue(strategy = GenerationType.IDENTITY).
Read more >
Manually set id attribute - Laracasts
Use PHP's array_merge with Input::all() to set the ID manually before calling MyModel::create(...) . ... // Put the array with ID last to...
Read more >
Set ID By Yourself : Primary Key « JPA « Java Tutorial
Set ID By Yourself : Primary Key « JPA « Java Tutorial.
Read more >
How-to: Setting auto-generated Ids manually in Hibernate
Use auto-generated values and let Hibernate or the underlying database engine generate those identifiers for you, or · Generate all ids yourself ...
Read more >
Chapter 35. Adjusting ID ranges manually
By creating and assigning different ID ranges to replicas, it also ensures that they never generate the same ID numbers. By default, this...
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