You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found that it's possible to accidentally call putMetric with a string value, and this value is saved and outputted to cloudwatch as a quoted string, which of course doesn't work as a metric.
The typescript code has type checking that putMetric is called with a number, but this doesn't help if you're writing Javascript, and of course doesn't help at runtime.
It can be subtle and hard to spot what is going on, as if you accidentally push a numeric metric that is typed as a string, then it just ends up quoted in the generated JSON, which is hard to spot until it doesn't work, e.g. putMetric('someKey', '200').
The library should explicitly convert all values it's sent to Number() so that if someone accidentally sends string values then they'll be dealt with correctly if they can be easily converted to numeric.
The text was updated successfully, but these errors were encountered:
bobtfish
added a commit
to bobtfish/aws-embedded-metrics-node
that referenced
this issue
Dec 14, 2021
I've found that it's possible to accidentally call
putMetric
with a string value, and this value is saved and outputted to cloudwatch as a quoted string, which of course doesn't work as a metric.The typescript code has type checking that
putMetric
is called with a number, but this doesn't help if you're writing Javascript, and of course doesn't help at runtime.It can be subtle and hard to spot what is going on, as if you accidentally push a numeric metric that is typed as a string, then it just ends up quoted in the generated JSON, which is hard to spot until it doesn't work, e.g.
putMetric('someKey', '200')
.The library should explicitly convert all values it's sent to
Number()
so that if someone accidentally sends string values then they'll be dealt with correctly if they can be easily converted to numeric.The text was updated successfully, but these errors were encountered: