fix an infinite loop which happens when autometrics is initialized in a node service without a git repository #149
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
after instrumenting my node / ts server with autometrics, things seemed to be working just fine locally.
unfortunately when i deployed to my dev environment (kubernetes cluster) i saw my service spike in cpu utilization and the event loop would hang causing all requests to time out.
this made it difficult to debug since i was unable to reproduce locally initially. i found that i could reproduce this behavior if i built the docker image and ran the container locally. from there i was able to run node with profiling flags to get the v8 log output. this pointed me to the
readFileSync
call inside thereadClosest
function and the issue became clear. there is an unhandled case on the node platform that will result in an infinite while loop if no git repository is initialized (as is the case in a container).this fixes that, but i'm uncertain if the other differences found between the node and deno platforms should be ported as well.
additionally, i had a troublesome time getting the
just build-all
command to work when trying to prepare this for a proper release/pr. please let me know how to proceed with getting this merged in. it is currently blocking my adoption of autometrics which otherwise looks to be of great benefit to me.node profile ouput (sample)
just build-all
error