Skip to content

Commit

Permalink
fix: Rename version metadata attribute to match binding name (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
jahands authored Apr 7, 2024
1 parent ef8f686 commit dc8e389
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-wolves-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@microlabs/otel-cf-workers": patch
---

fix: Rename version metadata attribute to match binding name
6 changes: 3 additions & 3 deletions src/instrumentation/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export function versionAttributes(env: unknown): Record<string, string | undefin
if (typeof env === 'object' && env !== null) {
for (const [binding, data] of Object.entries(env)) {
if (isVersionMetadata(data)) {
attributes['cf.script_version.binding'] = binding
attributes['cf.script_version.id'] = data.id
attributes['cf.script_version.tag'] = data.tag
attributes['cf.workers_version_metadata.binding'] = binding
attributes['cf.workers_version_metadata.id'] = data.id
attributes['cf.workers_version_metadata.tag'] = data.tag
// Version metadata bindings are identical, so we can stop after the first one found
break
}
Expand Down

0 comments on commit dc8e389

Please sign in to comment.