feat(metrics-api): use common attributes definitions#3038
feat(metrics-api): use common attributes definitions#3038legendecas merged 7 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3038 +/- ##
==========================================
- Coverage 93.08% 93.08% -0.01%
==========================================
Files 188 188
Lines 6246 6243 -3
Branches 1313 1313
==========================================
- Hits 5814 5811 -3
Misses 432 432
|
c97d58a to
a9c9eb9
Compare
dyladan
left a comment
There was a problem hiding this comment.
LGTM I just want to make sure I und
| return keys.reduce((result, key) => { | ||
| if (result.length > 2) { | ||
| result += ','; | ||
| result += '|#'; |
There was a problem hiding this comment.
Are you sure it is safe to use this as a separator if we're allowing string values? I think it is possible to collide hashes, but do we think it is sufficiently unlikely?
There was a problem hiding this comment.
For string values, it is always possible to collide before or after this change, like:
key1=value1, andkey2=value2, results in|#key1:value1,key2:value2,key1=value1,key2=value2, also results in|#key1:value1,key2:value2.
The change here is mainly to circumvent the string value of an array of strings, like ["value1", "value2"].toString() is value1,value2 in which values are separated with ",".
There was a problem hiding this comment.
Do we want to consider trying to make it impossible to collide? Or is this good enough?
There was a problem hiding this comment.
For what is in my mind now, it can be costly to do so. This hashing is very common across the operations in metrics SDK. I would be open to any improvements to this function but I'd be hesitant to make it a relatively costly one.
There was a problem hiding this comment.
@dyladan I've updated the hash function to support arbitrary attribute values with JSON.stringify. PTAL :)
|
Done. |
a9c9eb9 to
c4a10c0
Compare
c4a10c0 to
0545596
Compare
# Conflicts: # experimental/packages/otlp-transformer/test/metrics.test.ts
# Conflicts: # experimental/CHANGELOG.md
d1116a9 to
ab01df7
Compare
|
@dyladan I noticed that you removed this PR from the metrics GA milestone. Is there any specific reason to exclude this from metrics GA? |
I excluded all PRs from the milestone since they already have issues. It was distorting the %completion number |
|
Thank you for the explanation. Make sense to me. |
pichlermarc
left a comment
There was a problem hiding this comment.
Looks good 🙂
Thanks for working on this!
dyladan
left a comment
There was a problem hiding this comment.
Thanks. I prefer the more robust hash even if it is slightly more costly.
|
Fixed tests introduced on the main branch which need to be updated accordingly in this PR. |
Which problem is this PR solving?
Use common attributes definitions.
Fixes #2585
Fixes #2587
Fixes #1482
Short description of the changes
Type of change
How Has This Been Tested?
hashAttributesPrometheusSerializerChecklist: