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
fix(metrics): Support multiple addMetric() call with the same metric name (#390)
* fix(metrics): Support multiple addMetric() call with the same metric name
* docs(metrics): Add section about adding the same metric name multiple time
* docs(metrics): Rearrange excerpt example to be the same as others
* docs(metrics) Change to more appropriate term
Co-authored-by: Heitor Lessa <lessa@amazon.co.uk>
* fix(metrics): Fix typos + grammar in a comment
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
* fix(metrics): change an error message to suggest a potential solution
Co-authored-by: Heitor Lessa <lessa@amazon.co.uk>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
// Inconsistent units indicates a bug or typos and we want to flag this to users early
397
+
if(this.storedMetrics[name].unit!==unit){
398
+
constcurrentUnit=this.storedMetrics[name].unit;
399
+
thrownewError(`Metric "${name}" has already been added with unit "${currentUnit}", but we received unit "${unit}". Did you mean to use metric unit "${currentUnit}"?`);
expect((<Error>e).message).toBe('Metric "test_name" has already been added with unit "Count", but we received unit "Seconds". Did you mean to use metric unit "Count"?');
469
+
}
470
+
});
471
+
472
+
test('Should contain multiple metric values if added with multiple names',()=>{
0 commit comments