Skip to content

Commit

Permalink
Deprecate and add warning to remove AtomicFieldOffsets, unnecessary p…
Browse files Browse the repository at this point in the history
…ublic func

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Dec 13, 2021
1 parent 6cafa6a commit b8e4e70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdk/metric/alignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ package metric
import (
"os"
"testing"
"unsafe"

ottest "go.opentelemetry.io/otel/internal/internaltest"
)

// Ensure struct alignment prior to running tests.
func TestMain(m *testing.M) {
offsets := AtomicFieldOffsets()
offsets := map[string]uintptr{
"record.refMapped.value": unsafe.Offsetof(record{}.refMapped.value),
"record.updateCount": unsafe.Offsetof(record{}.updateCount),
}
var r []ottest.FieldOffset
for name, offset := range offsets {
r = append(r, ottest.FieldOffset{
Expand Down
1 change: 1 addition & 0 deletions sdk/metric/atomicfields.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric"

import "unsafe"

// Deprecated: will be removed soon.
func AtomicFieldOffsets() map[string]uintptr {
return map[string]uintptr{
"record.refMapped.value": unsafe.Offsetof(record{}.refMapped.value),
Expand Down

0 comments on commit b8e4e70

Please sign in to comment.