Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace uses unsafe with atomic with the generic atomic.Pointer #4226

Merged
merged 2 commits into from
Jun 20, 2023

Conversation

Jorropo
Copy link
Contributor

@Jorropo Jorropo commented Jun 17, 2023

Replaced all occurences of:

git grep -E "atomic\.[a-zA-Z]+Pointer\("

with atomic.Pointer.

Line numbers debug symbols aside this code will produce the exact same machine code. It removes a non needed use of unsafe and replace it with compile time type checked generics.
Will help keep code cleaner in case any of this ever gets refactored in the future.

Line numbers debug symbols aside this code will produce the exact same machine code.
It removes a non needed use of unsafe and replace it with compile time type checked
generics.
Will help keep code cleaner in case any of this ever gets refactored in the future.
@dmathieu dmathieu added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jun 17, 2023
@codecov
Copy link

codecov bot commented Jun 17, 2023

Codecov Report

Merging #4226 (cfc1bf1) into main (e3f547f) will increase coverage by 0.0%.
The diff coverage is 100.0%.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #4226   +/-   ##
=====================================
  Coverage   83.4%   83.4%           
=====================================
  Files        181     181           
  Lines      14116   14116           
=====================================
+ Hits       11780   11786    +6     
+ Misses      2109    2103    -6     
  Partials     227     227           
Impacted Files Coverage Δ
internal/global/handler.go 100.0% <100.0%> (ø)
internal/global/internal_logging.go 100.0% <100.0%> (ø)

... and 2 files with indirect coverage changes

@dmathieu
Copy link
Member

dmathieu commented Jun 17, 2023

Thank you, this definitely makes sense. More out of curiosity though, could you run benchstat with the benchmark tests on both main and your branch to ensure there's no regression?

@Jorropo
Copy link
Contributor Author

Jorropo commented Jun 17, 2023

A benchmark would be noisy here are instructions diffs instead, I can bench if you want but I don't think it would tell you anything even if it did indeed changes:

0000000000768c60 <go.opentelemetry.io/otel/internal/global.de	0000000000768c60 <go.opentelemetry.io/otel/internal/global.de
  cmp    rsp,QWORD PTR [r14+0x10]				  cmp    rsp,QWORD PTR [r14+0x10]
  jbe    768d94 <go.opentelemetry.io/otel/internal/global.def	  jbe    768d94 <go.opentelemetry.io/otel/internal/global.def
  sub    rsp,0x40						  sub    rsp,0x40
  mov    QWORD PTR [rsp+0x38],rbp				  mov    QWORD PTR [rsp+0x38],rbp
  lea    rbp,[rsp+0x38]						  lea    rbp,[rsp+0x38]
  lea    rax,[rip+0x7d6e1]        # 7e6360 <type:*+0x56360>   |	  lea    rax,[rip+0x7d9e1]        # 7e6660 <type:*+0x56660>
  nop								  nop
  call   40f900 <runtime.newobject>				  call   40f900 <runtime.newobject>
  mov    QWORD PTR [rsp+0x20],rax				  mov    QWORD PTR [rsp+0x20],rax
  lea    rax,[rip+0x740cf]        # 7dcd60 <type:*+0x4cd60>   |	  lea    rax,[rip+0x743cf]        # 7dd060 <type:*+0x4d060>
  call   40f900 <runtime.newobject>				  call   40f900 <runtime.newobject>
  mov    QWORD PTR [rsp+0x30],rax				  mov    QWORD PTR [rsp+0x30],rax
  mov    rcx,QWORD PTR [rip+0x3bcf46]        # b25be8 <os.Std	  mov    rcx,QWORD PTR [rip+0x3bcf46]        # b25be8 <os.Std
  mov    QWORD PTR [rsp+0x28],rcx				  mov    QWORD PTR [rsp+0x28],rcx
  lea    rax,[rip+0xab3b2]        # 814060 <type:*+0x84060>   |	  lea    rax,[rip+0xab812]        # 8144c0 <type:*+0x844c0>
  call   40f900 <runtime.newobject>				  call   40f900 <runtime.newobject>
  lea    rcx,[rip+0x15e466]        # 8c7120 <go:itab.*os.File |	  lea    rcx,[rip+0x15ea66]        # 8c7720 <go:itab.*os.File
  mov    QWORD PTR [rax+0x20],rcx				  mov    QWORD PTR [rax+0x20],rcx
  cmp    DWORD PTR [rip+0x3edb9b],0x0        # b56860 <runtim	  cmp    DWORD PTR [rip+0x3edb9b],0x0        # b56860 <runtim
  jne    768cd2 <go.opentelemetry.io/otel/internal/global.def	  jne    768cd2 <go.opentelemetry.io/otel/internal/global.def
  mov    rbx,QWORD PTR [rsp+0x28]				  mov    rbx,QWORD PTR [rsp+0x28]
  mov    QWORD PTR [rax+0x28],rbx				  mov    QWORD PTR [rax+0x28],rbx
  jmp    768ce5 <go.opentelemetry.io/otel/internal/global.def	  jmp    768ce5 <go.opentelemetry.io/otel/internal/global.def
  lea    rdi,[rax+0x28]						  lea    rdi,[rax+0x28]
  mov    rbx,QWORD PTR [rsp+0x28]				  mov    rbx,QWORD PTR [rsp+0x28]
  nop    DWORD PTR [rax+rax*1+0x0]				  nop    DWORD PTR [rax+rax*1+0x0]
  call   46e340 <runtime.gcWriteBarrierBX>			  call   46e340 <runtime.gcWriteBarrierBX>
  mov    QWORD PTR [rsp+0x18],rax				  mov    QWORD PTR [rsp+0x18],rax
  movups XMMWORD PTR [rax+0x8],xmm15				  movups XMMWORD PTR [rax+0x8],xmm15
  mov    QWORD PTR [rax+0x18],0x3				  mov    QWORD PTR [rax+0x18],0x3
							      |	  
  mov    rdx,QWORD PTR [rip+0x3b0aba]        # b197b8 <io.Dis	  mov    rdx,QWORD PTR [rip+0x3b0aba]        # b197b8 <io.Dis
  xchg   ax,ax							  xchg   ax,ax
  cmp    QWORD PTR [rip+0x3b0aa9],rcx        # b197b0 <io.Dis	  cmp    QWORD PTR [rip+0x3b0aa9],rcx        # b197b0 <io.Dis
  jne    768d26 <go.opentelemetry.io/otel/internal/global.def	  jne    768d26 <go.opentelemetry.io/otel/internal/global.def
  mov    rax,rcx						  mov    rax,rcx
  mov    rcx,rdx						  mov    rcx,rdx
  call   405100 <runtime.ifaceeq>				  call   405100 <runtime.ifaceeq>
  test   al,al							  test   al,al
  je     768d26 <go.opentelemetry.io/otel/internal/global.def	  je     768d26 <go.opentelemetry.io/otel/internal/global.def
  nop								  nop
  mov    ecx,0x1						  mov    ecx,0x1
  mov    rdx,QWORD PTR [rsp+0x18]				  mov    rdx,QWORD PTR [rsp+0x18]
  xchg   DWORD PTR [rdx+0x48],ecx				  xchg   DWORD PTR [rdx+0x48],ecx
  lea    rax,[rip+0x7d6b3]        # 7e63e0 <type:*+0x563e0>   |	  lea    rax,[rip+0x7d9b3]        # 7e66e0 <type:*+0x566e0>
  call   40f900 <runtime.newobject>				  call   40f900 <runtime.newobject>
  cmp    DWORD PTR [rip+0x3edb27],0x0        # b56860 <runtim	  cmp    DWORD PTR [rip+0x3edb27],0x0        # b56860 <runtim
  jne    768d45 <go.opentelemetry.io/otel/internal/global.def	  jne    768d45 <go.opentelemetry.io/otel/internal/global.def
  mov    rcx,QWORD PTR [rsp+0x18]				  mov    rcx,QWORD PTR [rsp+0x18]
  mov    QWORD PTR [rax],rcx					  mov    QWORD PTR [rax],rcx
  jmp    768d52 <go.opentelemetry.io/otel/internal/global.def	  jmp    768d52 <go.opentelemetry.io/otel/internal/global.def
  mov    rdi,rax						  mov    rdi,rax
  mov    rcx,QWORD PTR [rsp+0x18]				  mov    rcx,QWORD PTR [rsp+0x18]
  call   46e300 <runtime.gcWriteBarrierCX>			  call   46e300 <runtime.gcWriteBarrierCX>
  lea    rcx,[rip+0x15de07]        # 8c6b60 <go:itab.*go.open |	  lea    rcx,[rip+0x15e407]        # 8c7160 <go:itab.*go.open
  mov    rbx,QWORD PTR [rsp+0x30]				  mov    rbx,QWORD PTR [rsp+0x30]
  mov    QWORD PTR [rbx],rcx					  mov    QWORD PTR [rbx],rcx
  cmp    DWORD PTR [rip+0x3edaf8],0x0        # b56860 <runtim	  cmp    DWORD PTR [rip+0x3edaf8],0x0        # b56860 <runtim
  jne    768d70 <go.opentelemetry.io/otel/internal/global.def	  jne    768d70 <go.opentelemetry.io/otel/internal/global.def
  mov    QWORD PTR [rbx+0x8],rax				  mov    QWORD PTR [rbx+0x8],rax
  jmp    768d79 <go.opentelemetry.io/otel/internal/global.def	  jmp    768d79 <go.opentelemetry.io/otel/internal/global.def
  lea    rdi,[rbx+0x8]						  lea    rdi,[rbx+0x8]
  call   46e200 <runtime.gcWriteBarrier>			  call   46e200 <runtime.gcWriteBarrier>
							      >	  nop
  mov    rax,QWORD PTR [rsp+0x20]				  mov    rax,QWORD PTR [rsp+0x20]
  xchg   ax,ax						      |	  nop
  call   467160 <sync/atomic.StorePointer>			  call   467160 <sync/atomic.StorePointer>
  mov    rax,QWORD PTR [rsp+0x20]				  mov    rax,QWORD PTR [rsp+0x20]
  mov    rbp,QWORD PTR [rsp+0x38]				  mov    rbp,QWORD PTR [rsp+0x38]
  add    rsp,0x40						  add    rsp,0x40
  ret    							  ret    
  call   46c100 <runtime.morestack_noctxt.abi0>			  call   46c100 <runtime.morestack_noctxt.abi0>
  jmp    768c60 <go.opentelemetry.io/otel/internal/global.def	  jmp    768c60 <go.opentelemetry.io/otel/internal/global.def
  int3   							  int3   
  int3								  int3hugo@Inrusus:~/Documents/Scripts/opentelemetry-go/internal/global$ diff -y /tmp/{old,new}
0000000000768c60 <go.opentelemetry.io/otel/internal/global.de	0000000000768c60 <go.opentelemetry.io/otel/internal/global.de
  cmp    rsp,QWORD PTR [r14+0x10]				  cmp    rsp,QWORD PTR [r14+0x10]
  jbe    768d94 <go.opentelemetry.io/otel/internal/global.def	  jbe    768d94 <go.opentelemetry.io/otel/internal/global.def
  sub    rsp,0x40						  sub    rsp,0x40
  mov    QWORD PTR [rsp+0x38],rbp				  mov    QWORD PTR [rsp+0x38],rbp
  lea    rbp,[rsp+0x38]						  lea    rbp,[rsp+0x38]
  lea    rax,[rip+0x7d9e1]        # 7e6660 <type:*+0x56660>   |	  lea    rax,[rip+0x7d6e1]        # 7e6360 <type:*+0x56360>
  nop								  nop
  call   40f900 <runtime.newobject>				  call   40f900 <runtime.newobject>
  mov    QWORD PTR [rsp+0x20],rax				  mov    QWORD PTR [rsp+0x20],rax
  lea    rax,[rip+0x743cf]        # 7dd060 <type:*+0x4d060>   |	  lea    rax,[rip+0x740cf]        # 7dcd60 <type:*+0x4cd60>
  call   40f900 <runtime.newobject>				  call   40f900 <runtime.newobject>
  mov    QWORD PTR [rsp+0x30],rax				  mov    QWORD PTR [rsp+0x30],rax
  mov    rcx,QWORD PTR [rip+0x3bcf46]        # b25be8 <os.Std	  mov    rcx,QWORD PTR [rip+0x3bcf46]        # b25be8 <os.Std
  mov    QWORD PTR [rsp+0x28],rcx				  mov    QWORD PTR [rsp+0x28],rcx
  lea    rax,[rip+0xab812]        # 8144c0 <type:*+0x844c0>   |	  lea    rax,[rip+0xab3b2]        # 814060 <type:*+0x84060>
  call   40f900 <runtime.newobject>				  call   40f900 <runtime.newobject>
  lea    rcx,[rip+0x15ea66]        # 8c7720 <go:itab.*os.File |	  lea    rcx,[rip+0x15e466]        # 8c7120 <go:itab.*os.File
  mov    QWORD PTR [rax+0x20],rcx				  mov    QWORD PTR [rax+0x20],rcx
  cmp    DWORD PTR [rip+0x3edb9b],0x0        # b56860 <runtim	  cmp    DWORD PTR [rip+0x3edb9b],0x0        # b56860 <runtim
  jne    768cd2 <go.opentelemetry.io/otel/internal/global.def	  jne    768cd2 <go.opentelemetry.io/otel/internal/global.def
  mov    rbx,QWORD PTR [rsp+0x28]				  mov    rbx,QWORD PTR [rsp+0x28]
  mov    QWORD PTR [rax+0x28],rbx				  mov    QWORD PTR [rax+0x28],rbx
  jmp    768ce5 <go.opentelemetry.io/otel/internal/global.def	  jmp    768ce5 <go.opentelemetry.io/otel/internal/global.def
  lea    rdi,[rax+0x28]						  lea    rdi,[rax+0x28]
  mov    rbx,QWORD PTR [rsp+0x28]				  mov    rbx,QWORD PTR [rsp+0x28]
  nop    DWORD PTR [rax+rax*1+0x0]				  nop    DWORD PTR [rax+rax*1+0x0]
  call   46e340 <runtime.gcWriteBarrierBX>			  call   46e340 <runtime.gcWriteBarrierBX>
  mov    QWORD PTR [rsp+0x18],rax				  mov    QWORD PTR [rsp+0x18],rax
  movups XMMWORD PTR [rax+0x8],xmm15				  movups XMMWORD PTR [rax+0x8],xmm15
  mov    QWORD PTR [rax+0x18],0x3				  mov    QWORD PTR [rax+0x18],0x3
  							      |
  mov    rdx,QWORD PTR [rip+0x3b0aba]        # b197b8 <io.Dis	  mov    rdx,QWORD PTR [rip+0x3b0aba]        # b197b8 <io.Dis
  xchg   ax,ax							  xchg   ax,ax
  cmp    QWORD PTR [rip+0x3b0aa9],rcx        # b197b0 <io.Dis	  cmp    QWORD PTR [rip+0x3b0aa9],rcx        # b197b0 <io.Dis
  jne    768d26 <go.opentelemetry.io/otel/internal/global.def	  jne    768d26 <go.opentelemetry.io/otel/internal/global.def
  mov    rax,rcx						  mov    rax,rcx
  mov    rcx,rdx						  mov    rcx,rdx
  call   405100 <runtime.ifaceeq>				  call   405100 <runtime.ifaceeq>
  test   al,al							  test   al,al
  je     768d26 <go.opentelemetry.io/otel/internal/global.def	  je     768d26 <go.opentelemetry.io/otel/internal/global.def
  nop								  nop
  mov    ecx,0x1						  mov    ecx,0x1
  mov    rdx,QWORD PTR [rsp+0x18]				  mov    rdx,QWORD PTR [rsp+0x18]
  xchg   DWORD PTR [rdx+0x48],ecx				  xchg   DWORD PTR [rdx+0x48],ecx
  lea    rax,[rip+0x7d9b3]        # 7e66e0 <type:*+0x566e0>   |	  lea    rax,[rip+0x7d6b3]        # 7e63e0 <type:*+0x563e0>
  call   40f900 <runtime.newobject>				  call   40f900 <runtime.newobject>
  cmp    DWORD PTR [rip+0x3edb27],0x0        # b56860 <runtim	  cmp    DWORD PTR [rip+0x3edb27],0x0        # b56860 <runtim
  jne    768d45 <go.opentelemetry.io/otel/internal/global.def	  jne    768d45 <go.opentelemetry.io/otel/internal/global.def
  mov    rcx,QWORD PTR [rsp+0x18]				  mov    rcx,QWORD PTR [rsp+0x18]
  mov    QWORD PTR [rax],rcx					  mov    QWORD PTR [rax],rcx
  jmp    768d52 <go.opentelemetry.io/otel/internal/global.def	  jmp    768d52 <go.opentelemetry.io/otel/internal/global.def
  mov    rdi,rax						  mov    rdi,rax
  mov    rcx,QWORD PTR [rsp+0x18]				  mov    rcx,QWORD PTR [rsp+0x18]
  call   46e300 <runtime.gcWriteBarrierCX>			  call   46e300 <runtime.gcWriteBarrierCX>
  lea    rcx,[rip+0x15e407]        # 8c7160 <go:itab.*go.open |	  lea    rcx,[rip+0x15de07]        # 8c6b60 <go:itab.*go.open
  mov    rbx,QWORD PTR [rsp+0x30]				  mov    rbx,QWORD PTR [rsp+0x30]
  mov    QWORD PTR [rbx],rcx					  mov    QWORD PTR [rbx],rcx
  cmp    DWORD PTR [rip+0x3edaf8],0x0        # b56860 <runtim	  cmp    DWORD PTR [rip+0x3edaf8],0x0        # b56860 <runtim
  jne    768d70 <go.opentelemetry.io/otel/internal/global.def	  jne    768d70 <go.opentelemetry.io/otel/internal/global.def
  mov    QWORD PTR [rbx+0x8],rax				  mov    QWORD PTR [rbx+0x8],rax
  jmp    768d79 <go.opentelemetry.io/otel/internal/global.def	  jmp    768d79 <go.opentelemetry.io/otel/internal/global.def
  lea    rdi,[rbx+0x8]						  lea    rdi,[rbx+0x8]
  call   46e200 <runtime.gcWriteBarrier>			  call   46e200 <runtime.gcWriteBarrier>
  nop							      <
  mov    rax,QWORD PTR [rsp+0x20]				  mov    rax,QWORD PTR [rsp+0x20]
  nop							      |	  xchg   ax,ax
  call   467160 <sync/atomic.StorePointer>			  call   467160 <sync/atomic.StorePointer>
  mov    rax,QWORD PTR [rsp+0x20]				  mov    rax,QWORD PTR [rsp+0x20]
  mov    rbp,QWORD PTR [rsp+0x38]				  mov    rbp,QWORD PTR [rsp+0x38]
  add    rsp,0x40						  add    rsp,0x40
  ret    							  ret    
  call   46c100 <runtime.morestack_noctxt.abi0>			  call   46c100 <runtime.morestack_noctxt.abi0>
  jmp    768c60 <go.opentelemetry.io/otel/internal/global.def	  jmp    768c60 <go.opentelemetry.io/otel/internal/global.def
  int3   							  int3   
  int3								  int3

Had to use global.defaultErrorHandler since (*ErrDelegator).setHandler is not compiled anywhere in the binary due to inlining.
The only relevent change is how a NOP has be rewriten to XCHG AX,AX, this does nothing and is free, this is golang's famous inline mark and allows debuggers to stop on the function entry of atomic.Pointer[ErrHandler].Load when single stepping.

Here is (*ErrDelegator).Handle since getDelegate gets inlined:

0000000000768c00 <go.opentelemetry.io/otel/internal/global.(*	0000000000768c00 <go.opentelemetry.io/otel/internal/global.(*
  cmp    rsp,QWORD PTR [r14+0x10]				  cmp    rsp,QWORD PTR [r14+0x10]
  jbe    768c38 <go.opentelemetry.io/otel/internal/global.(*E	  jbe    768c38 <go.opentelemetry.io/otel/internal/global.(*E
  sub    rsp,0x20						  sub    rsp,0x20
  mov    QWORD PTR [rsp+0x18],rbp				  mov    QWORD PTR [rsp+0x18],rbp
  lea    rbp,[rsp+0x18]						  lea    rbp,[rsp+0x18]
  mov    QWORD PTR [rsp+0x30],rbx				  mov    QWORD PTR [rsp+0x30],rbx
  mov    QWORD PTR [rsp+0x38],rcx				  mov    QWORD PTR [rsp+0x38],rcx
  mov    rdx,QWORD PTR [rax]					  mov    rdx,QWORD PTR [rax]
  mov    rsi,QWORD PTR [rdx]					  mov    rsi,QWORD PTR [rdx]
  mov    rsi,QWORD PTR [rsi+0x18]				  mov    rsi,QWORD PTR [rsi+0x18]
  mov    rax,QWORD PTR [rdx+0x8]				  mov    rax,QWORD PTR [rdx+0x8]
  call   rsi							  call   rsi
  mov    rbp,QWORD PTR [rsp+0x18]				  mov    rbp,QWORD PTR [rsp+0x18]
  add    rsp,0x20						  add    rsp,0x20
  ret    							  ret    
  mov    QWORD PTR [rsp+0x8],rax				  mov    QWORD PTR [rsp+0x8],rax
  mov    QWORD PTR [rsp+0x10],rbx				  mov    QWORD PTR [rsp+0x10],rbx
  mov    QWORD PTR [rsp+0x18],rcx				  mov    QWORD PTR [rsp+0x18],rcx
  call   46c100 <runtime.morestack_noctxt.abi0>			  call   46c100 <runtime.morestack_noctxt.abi0>
  mov    rax,QWORD PTR [rsp+0x8]				  mov    rax,QWORD PTR [rsp+0x8]
  mov    rbx,QWORD PTR [rsp+0x10]				  mov    rbx,QWORD PTR [rsp+0x10]
  mov    rcx,QWORD PTR [rsp+0x18]				  mov    rcx,QWORD PTR [rsp+0x18]
  jmp    768c00 <go.opentelemetry.io/otel/internal/global.(*E	  jmp    768c00 <go.opentelemetry.io/otel/internal/global.(*E
  int3   							  int3   
  int3   							  int3   
  int3								  int3

Here no change at all, I'm not exactly sure why the second inling mark does not show up (neither why getDelegate's one does not either) (I've traced it with GOSSAFUNC and through the compiler and I belive it's a bug in the genssa pass (final step of the SSA compiler where it generates textual assembly) where the line numberings for atomic.Pointer[ErrDelegator].Load and (*ErrDelegator).getDelegate are missattributed to (*ErrDelegator).Handle instead, then it scans the function and thinks all edges where the inlined operations exists has been pruned out so it does not output the inline mark) the globalLogger is more of the same. I can show benchmark if you really want but I think looking at byte for byte assembly is more speaking than benchmarks.

@pellared pellared merged commit cda2d6c into open-telemetry:main Jun 20, 2023
@Jorropo Jorropo deleted the generic-sync-pointer branch June 20, 2023 11:51
@MrAlias MrAlias added this to the v1.17.0 milestone Aug 3, 2023
Kavindu-Dodan referenced this pull request in open-feature/flagd Sep 8, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[go.opentelemetry.io/otel](https://togithub.com/open-telemetry/opentelemetry-go)
| require | minor | `v1.16.0` -> `v1.17.0` |
|
[go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc](https://togithub.com/open-telemetry/opentelemetry-go)
| require | minor | `v0.39.0` -> `v0.40.0` |
|
[go.opentelemetry.io/otel/exporters/otlp/otlptrace](https://togithub.com/open-telemetry/opentelemetry-go)
| require | minor | `v1.16.0` -> `v1.17.0` |
|
[go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc](https://togithub.com/open-telemetry/opentelemetry-go)
| require | minor | `v1.16.0` -> `v1.17.0` |
|
[go.opentelemetry.io/otel/exporters/prometheus](https://togithub.com/open-telemetry/opentelemetry-go)
| require | minor | `v0.39.0` -> `v0.40.0` |
|
[go.opentelemetry.io/otel/metric](https://togithub.com/open-telemetry/opentelemetry-go)
| require | minor | `v1.16.0` -> `v1.17.0` |
|
[go.opentelemetry.io/otel/sdk](https://togithub.com/open-telemetry/opentelemetry-go)
| require | minor | `v1.16.0` -> `v1.17.0` |
|
[go.opentelemetry.io/otel/sdk/metric](https://togithub.com/open-telemetry/opentelemetry-go)
| require | minor | `v0.39.0` -> `v0.40.0` |
|
[go.opentelemetry.io/otel/trace](https://togithub.com/open-telemetry/opentelemetry-go)
| require | minor | `v1.16.0` -> `v1.17.0` |

---

### Release Notes

<details>
<summary>open-telemetry/opentelemetry-go
(go.opentelemetry.io/otel)</summary>

###
[`v1.17.0`](https://togithub.com/open-telemetry/opentelemetry-go/releases/tag/v1.17.0):
/v0.40.0/v0.5.0

[Compare
Source](https://togithub.com/open-telemetry/opentelemetry-go/compare/v1.16.0...v1.17.0)

##### Added

- Export the `ManualReader` struct in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4244](https://togithub.com/open-telemetry/opentelemetry-go/issues/4244))
- Export the `PeriodicReader` struct in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4244](https://togithub.com/open-telemetry/opentelemetry-go/issues/4244))
-   Add support for exponential histogram aggregations.
A histogram can be configured as an exponential histogram using a view
with `"go.opentelemetry.io/otel/sdk/metric".ExponentialHistogram` as the
aggregation.
([#&#8203;4245](https://togithub.com/open-telemetry/opentelemetry-go/issues/4245))
- Export the `Exporter` struct in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`.
([#&#8203;4272](https://togithub.com/open-telemetry/opentelemetry-go/issues/4272))
- Export the `Exporter` struct in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`.
([#&#8203;4272](https://togithub.com/open-telemetry/opentelemetry-go/issues/4272))
- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`
now support the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`
environment variable.
([#&#8203;4287](https://togithub.com/open-telemetry/opentelemetry-go/issues/4287))
- Add `WithoutCounterSuffixes` option in
`go.opentelemetry.io/otel/exporters/prometheus` to disable addition of
`_total` suffixes.
([#&#8203;4306](https://togithub.com/open-telemetry/opentelemetry-go/issues/4306))
- Add info and debug logging to the metric SDK in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4315](https://togithub.com/open-telemetry/opentelemetry-go/issues/4315))
-   The `go.opentelemetry.io/otel/semconv/v1.21.0` package.
The package contains semantic conventions from the `v1.21.0` version of
the OpenTelemetry Semantic Conventions.
([#&#8203;4362](https://togithub.com/open-telemetry/opentelemetry-go/issues/4362))
- Accept 201 to 299 HTTP status as success in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`.
([#&#8203;4365](https://togithub.com/open-telemetry/opentelemetry-go/issues/4365))
- Document the `Temporality` and `Aggregation` methods of the
`"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent
safe.
([#&#8203;4381](https://togithub.com/open-telemetry/opentelemetry-go/issues/4381))
- Expand the set of units supported by the Prometheus exporter, and
don't add unit suffixes if they are already present in
`go.opentelemetry.op/otel/exporters/prometheus`
([#&#8203;4374](https://togithub.com/open-telemetry/opentelemetry-go/issues/4374))
- Move the `Aggregation` interface and its implementations from
`go.opentelemetry.io/otel/sdk/metric/aggregation` to
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4435](https://togithub.com/open-telemetry/opentelemetry-go/issues/4435))
- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`
now support the
`OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment
variable.
([#&#8203;4437](https://togithub.com/open-telemetry/opentelemetry-go/issues/4437))
- Add the `NewAllowKeysFilter` and `NewDenyKeysFilter` functions to
`go.opentelemetry.io/otel/attribute` to allow convenient creation of
allow-keys and deny-keys filters.
([#&#8203;4444](https://togithub.com/open-telemetry/opentelemetry-go/issues/4444))

##### Changed

- Starting from `v1.21.0` of semantic conventions,
`go.opentelemetry.io/otel/semconv/{version}/httpconv` and
`go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no
longer be published.
([#&#8203;4145](https://togithub.com/open-telemetry/opentelemetry-go/issues/4145))
- Log duplicate instrument conflict at a warning level instead of info
in `go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4202](https://togithub.com/open-telemetry/opentelemetry-go/issues/4202))
- Return an error on the creation of new instruments in
`go.opentelemetry.io/otel/sdk/metric` if their name doesn't pass regexp
validation.
([#&#8203;4210](https://togithub.com/open-telemetry/opentelemetry-go/issues/4210))
- `NewManualReader` in `go.opentelemetry.io/otel/sdk/metric` returns
`*ManualReader` instead of `Reader`.
([#&#8203;4244](https://togithub.com/open-telemetry/opentelemetry-go/issues/4244))
- `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns
`*PeriodicReader` instead of `Reader`.
([#&#8203;4244](https://togithub.com/open-telemetry/opentelemetry-go/issues/4244))
- Count the Collect time in the `PeriodicReader` timeout in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4221](https://togithub.com/open-telemetry/opentelemetry-go/issues/4221))
- The function `New` in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`
returns `*Exporter` instead of
`"go.opentelemetry.io/otel/sdk/metric".Exporter`.
([#&#8203;4272](https://togithub.com/open-telemetry/opentelemetry-go/issues/4272))
- The function `New` in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`
returns `*Exporter` instead of
`"go.opentelemetry.io/otel/sdk/metric".Exporter`.
([#&#8203;4272](https://togithub.com/open-telemetry/opentelemetry-go/issues/4272))
- If an attribute set is omitted from an async callback, the previous
value will no longer be exported in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4290](https://togithub.com/open-telemetry/opentelemetry-go/issues/4290))
- If an attribute set is observed multiple times in an async callback in
`go.opentelemetry.io/otel/sdk/metric`, the values will be summed instead
of the last observation winning.
([#&#8203;4289](https://togithub.com/open-telemetry/opentelemetry-go/issues/4289))
- Allow the explicit bucket histogram aggregation to be used for the
up-down counter, observable counter, observable up-down counter, and
observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package.
([#&#8203;4332](https://togithub.com/open-telemetry/opentelemetry-go/issues/4332))
- Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only
register and collect instruments it created.
([#&#8203;4333](https://togithub.com/open-telemetry/opentelemetry-go/issues/4333))
- `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in
`go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's
timeout to the operation if the user provided context does not contain a
deadline.
([#&#8203;4356](https://togithub.com/open-telemetry/opentelemetry-go/issues/4356),
[#&#8203;4377](https://togithub.com/open-telemetry/opentelemetry-go/issues/4377))
- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use
`v1.21.0`.
([#&#8203;4408](https://togithub.com/open-telemetry/opentelemetry-go/issues/4408))
- Increase instrument name maximum length from 63 to 255 characters in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4434](https://togithub.com/open-telemetry/opentelemetry-go/issues/4434))
- Add `go.opentelemetry.op/otel/sdk/metric.WithProducer` as an `Option`
for `"go.opentelemetry.io/otel/sdk/metric".NewManualReader` and
`"go.opentelemetry.io/otel/sdk/metric".NewPeriodicReader`.
([#&#8203;4346](https://togithub.com/open-telemetry/opentelemetry-go/issues/4346))

##### Removed

- Remove `Reader.RegisterProducer` in `go.opentelemetry.io/otel/metric`.
Use the added `WithProducer` option instead.
([#&#8203;4346](https://togithub.com/open-telemetry/opentelemetry-go/issues/4346))
-   Remove `Reader.ForceFlush` in `go.opentelemetry.io/otel/metric`.
Notice that `PeriodicReader.ForceFlush` is still available.
([#&#8203;4375](https://togithub.com/open-telemetry/opentelemetry-go/issues/4375))

##### Fixed

- Correctly format log messages from the
`go.opentelemetry.io/otel/exporters/zipkin` exporter.
([#&#8203;4143](https://togithub.com/open-telemetry/opentelemetry-go/issues/4143))
- Log an error for calls to `NewView` in
`go.opentelemetry.io/otel/sdk/metric` that have empty criteria.
([#&#8203;4307](https://togithub.com/open-telemetry/opentelemetry-go/issues/4307))
- Fix `"go.opentelemetry.io/otel/sdk/resource".WithHostID()` to not set
an empty `host.id`.
([#&#8203;4317](https://togithub.com/open-telemetry/opentelemetry-go/issues/4317))
- Use the instrument identifying fields to cache aggregators and
determine duplicate instrument registrations in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4337](https://togithub.com/open-telemetry/opentelemetry-go/issues/4337))
- Detect duplicate instruments for case-insensitive names in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4338](https://togithub.com/open-telemetry/opentelemetry-go/issues/4338))
- The `ManualReader` will not panic if `AggregationSelector` returns
`nil` in `go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4350](https://togithub.com/open-telemetry/opentelemetry-go/issues/4350))
- If a `Reader`'s `AggregationSelector` returns `nil` or
`DefaultAggregation` the pipeline will use the default aggregation.
([#&#8203;4350](https://togithub.com/open-telemetry/opentelemetry-go/issues/4350))
- Log a suggested view that fixes instrument conflicts in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4349](https://togithub.com/open-telemetry/opentelemetry-go/issues/4349))
- Fix possible panic, deadlock and race condition in batch span
processor in `go.opentelemetry.io/otel/sdk/trace`.
([#&#8203;4353](https://togithub.com/open-telemetry/opentelemetry-go/issues/4353))
- Improve context cancellation handling in batch span processor's
`ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`.
([#&#8203;4369](https://togithub.com/open-telemetry/opentelemetry-go/issues/4369))
- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal`
from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl.
([#&#8203;4397](https://togithub.com/open-telemetry/opentelemetry-go/issues/4397),
[#&#8203;3846](https://togithub.com/open-telemetry/opentelemetry-go/issues/3846))
- Decouple
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal`
from `go.opentelemetry.io/otel/exporters/otlp/internal` and
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using
gotmpl.
([#&#8203;4404](https://togithub.com/open-telemetry/opentelemetry-go/issues/4404),
[#&#8203;3846](https://togithub.com/open-telemetry/opentelemetry-go/issues/3846))
- Decouple
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal`
from `go.opentelemetry.io/otel/exporters/otlp/internal` and
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using
gotmpl.
([#&#8203;4407](https://togithub.com/open-telemetry/opentelemetry-go/issues/4407),
[#&#8203;3846](https://togithub.com/open-telemetry/opentelemetry-go/issues/3846))
- Decouple
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal`
from `go.opentelemetry.io/otel/exporters/otlp/internal` and
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using
gotmpl.
([#&#8203;4400](https://togithub.com/open-telemetry/opentelemetry-go/issues/4400),
[#&#8203;3846](https://togithub.com/open-telemetry/opentelemetry-go/issues/3846))
- Decouple
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal`
from `go.opentelemetry.io/otel/exporters/otlp/internal` and
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using
gotmpl.
([#&#8203;4401](https://togithub.com/open-telemetry/opentelemetry-go/issues/4401),
[#&#8203;3846](https://togithub.com/open-telemetry/opentelemetry-go/issues/3846))
- Do not block the metric SDK when OTLP metric exports are blocked in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`.
([#&#8203;3925](https://togithub.com/open-telemetry/opentelemetry-go/issues/3925),
[#&#8203;4395](https://togithub.com/open-telemetry/opentelemetry-go/issues/4395))
- Do not append `_total` if the counter already has that suffix for the
Prometheus exproter in `go.opentelemetry.io/otel/exporter/prometheus`.
([#&#8203;4373](https://togithub.com/open-telemetry/opentelemetry-go/issues/4373))
- Fix resource detection data race in
`go.opentelemetry.io/otel/sdk/resource`.
([#&#8203;4409](https://togithub.com/open-telemetry/opentelemetry-go/issues/4409))
- Use the first-seen instrument name during instrument name conflicts in
`go.opentelemetry.io/otel/sdk/metric`.
([#&#8203;4428](https://togithub.com/open-telemetry/opentelemetry-go/issues/4428))

##### Deprecated

- The `go.opentelemetry.io/otel/exporters/jaeger` package is deprecated.
    OpenTelemetry dropped support for Jaeger exporter in July 2023.
Use `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`
or `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`
instead.
([#&#8203;4423](https://togithub.com/open-telemetry/opentelemetry-go/issues/4423))
- The `go.opentelemetry.io/otel/example/jaeger` package is deprecated.
([#&#8203;4423](https://togithub.com/open-telemetry/opentelemetry-go/issues/4423))
- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal`
package is deprecated.
([#&#8203;4420](https://togithub.com/open-telemetry/opentelemetry-go/issues/4420))
- The
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf`
package is deprecated.
([#&#8203;4420](https://togithub.com/open-telemetry/opentelemetry-go/issues/4420))
- The
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest`
package is deprecated.
([#&#8203;4420](https://togithub.com/open-telemetry/opentelemetry-go/issues/4420))
- The
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform`
package is deprecated.
([#&#8203;4420](https://togithub.com/open-telemetry/opentelemetry-go/issues/4420))
- The `go.opentelemetry.io/otel/exporters/otlp/internal` package is
deprecated.
([#&#8203;4421](https://togithub.com/open-telemetry/opentelemetry-go/issues/4421))
- The `go.opentelemetry.io/otel/exporters/otlp/internal/envconfig`
package is deprecated.
([#&#8203;4421](https://togithub.com/open-telemetry/opentelemetry-go/issues/4421))
- The `go.opentelemetry.io/otel/exporters/otlp/internal/retry` package
is deprecated.
([#&#8203;4421](https://togithub.com/open-telemetry/opentelemetry-go/issues/4421))
- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal`
package is deprecated.
([#&#8203;4425](https://togithub.com/open-telemetry/opentelemetry-go/issues/4425))
- The
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig`
package is deprecated.
([#&#8203;4425](https://togithub.com/open-telemetry/opentelemetry-go/issues/4425))
- The
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig`
package is deprecated.
([#&#8203;4425](https://togithub.com/open-telemetry/opentelemetry-go/issues/4425))
- The
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest`
package is deprecated.
([#&#8203;4425](https://togithub.com/open-telemetry/opentelemetry-go/issues/4425))
- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry`
package is deprecated.
([#&#8203;4425](https://togithub.com/open-telemetry/opentelemetry-go/issues/4425))
- The `go.opentelemetry.io/otel/sdk/metric/aggregation` package is
deprecated.
Use the aggregation types added to `go.opentelemetry.io/otel/sdk/metric`
instead.
([#&#8203;4435](https://togithub.com/open-telemetry/opentelemetry-go/issues/4435))

##### New Contributors

- [@&#8203;serdarkalayci](https://togithub.com/serdarkalayci) made their
first contribution in
[https://github.com/open-telemetry/opentelemetry-go/pull/4129](https://togithub.com/open-telemetry/opentelemetry-go/pull/4129)
- [@&#8203;Jorropo](https://togithub.com/Jorropo) made their first
contribution in
[https://github.com/open-telemetry/opentelemetry-go/pull/4226](https://togithub.com/open-telemetry/opentelemetry-go/pull/4226)
- [@&#8203;hexdigest](https://togithub.com/hexdigest) made their first
contribution in
[https://github.com/open-telemetry/opentelemetry-go/pull/3899](https://togithub.com/open-telemetry/opentelemetry-go/pull/3899)
- [@&#8203;gkze](https://togithub.com/gkze) made their first
contribution in
[https://github.com/open-telemetry/opentelemetry-go/pull/4402](https://togithub.com/open-telemetry/opentelemetry-go/pull/4402)
- [@&#8203;jaredjenkins](https://togithub.com/jaredjenkins) made their
first contribution in
[https://github.com/open-telemetry/opentelemetry-go/pull/4409](https://togithub.com/open-telemetry/opentelemetry-go/pull/4409)
- [@&#8203;utezduyar](https://togithub.com/utezduyar) made their first
contribution in
[https://github.com/open-telemetry/opentelemetry-go/pull/4456](https://togithub.com/open-telemetry/opentelemetry-go/pull/4456)

**Full Changelog**:
open-telemetry/opentelemetry-go@v1.16.0...v1.17.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-feature/flagd).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi42Ni4wIiwidXBkYXRlZEluVmVyIjoiMzYuNjYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants