Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeJS: trackDependency does not store "data" field #1355

Open
philippreissing opened this issue Jul 2, 2024 · 2 comments
Open

NodeJS: trackDependency does not store "data" field #1355

philippreissing opened this issue Jul 2, 2024 · 2 comments

Comments

@philippreissing
Copy link

I'm trying to use the method trackDependency() to track custom dependencies in a NodeJS backend.
I create a custom object and save it like this:

    const message = {
      name: 'query',
      resultCode: error ? error.response.sqlState ?? 'error' : 0,
      data: 'test', //sql.toString().trim(),
      dependencyTypeName: 'Databricks',
      duration: duration,
      success: !error,
    };
    console.log(message);
    appInsights.defaultClient.trackDependency(message); 

Here's how the message looks like (data is hardcoded for testing):

{
  name: 'query',
  resultCode: 0,
  data: 'test',
  dependencyTypeName: 'Databricks',
  duration: 1455.913166999817,
  success: true
}

The event gets saved in log analytics, but the data field always stays empty.
image

I'm using Node JS 18.15.0 with applicationinsights 3.1.0

@philippreissing
Copy link
Author

Ok, I found the problem. The library checks if the depency is of SQL type and only then stores the data field.

dependencyType.indexOf("SQL") > -1 ||

That feels a bit limiting - why should I not be able to also use the data field in other dependencies?

Anyway, I could solve this by renaming my dependency type to Databricks SQL instead.

@JacksonWeber
Copy link
Contributor

@philippreissing The logic here is to check for the dependency type being a database call in which case we would collect the data field in an auto-collection scenario as well. Is there a requirement on your side to specifically collect the data field here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants