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

Fractional millisecond values are not sanitized or serialized properly on trackDependency #270

Closed
itilitymaarten opened this issue Jun 9, 2017 · 2 comments
Labels
Milestone

Comments

@itilitymaarten
Copy link

itilitymaarten commented Jun 9, 2017

context.log(`Dependency tracked: ${dependencyName} ${prop} ${duration[0] * 1000 + duration[1] / (1000 * 1000)} false`);
insightsClient.trackDependency(dependencyName, prop, duration[0] * 1000 + duration[1] / (1000 * 1000), false);

I use the code above to log a dependency call. The duration array is a result from process.hrtime() (the first element contains seconds, the second element contains nanoseconds which couldn't fit into seconds precision). I know the function is called, because the context.log above it is logged (with proper arguments). However, the dependency call isn't showing up in Application insights, while the tracing and everything else I'm logging through the SDK is.

Any suggestions on how to debug this problem or what might be causing it?

@OsvaldoRosado
Copy link
Member

I can reproduce this problem. The following error is returned from the backend:
Field 'duration' on type 'RemoteDependencyData' is not a valid duration string. Expected: dd.hh:mm:ss.fffffff format not exceeding 1000 days, Actual: 21.17:03:44.372.2452609539032

You can workaround this issue by not giving non-integer millisecond values to trackDependency. For example, the following works:

var duration = process.hrtime();
client.trackDependency('testDep', 'prop', Math.round(duration[0] * 1000 + duration[1] / (1000 * 1000)), false);

@OsvaldoRosado OsvaldoRosado added this to the 0.21.0 milestone Jun 9, 2017
@OsvaldoRosado OsvaldoRosado changed the title Dependency calls not showing up in insights Fractional millisecond values are not sanitized or serialized properly on trackDependency Jun 9, 2017
@OsvaldoRosado
Copy link
Member

Fixed with #274

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

No branches or pull requests

2 participants