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 (#2445)

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
  • Loading branch information
bogdandrutu and MrAlias committed Dec 15, 2021
1 parent 8f4a477 commit 4702f6f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

- Deprecate module `"go.opentelemetry.io/otel/sdk/export/metric"`, new functionality available in "go.opentelemetry.io/otel/sdk/metric" module:
- Import path changed `import "go.opentelemetry.io/otel/sdk/export/metric"` to `import go.opentelemetry.io/otel/sdk/metric/export` (#2382).
- Deprecate `AtomicFieldOffsets`, unnecessary public func (#2445)

## [1.3.0] - 2021-12-10

Expand Down
6 changes: 5 additions & 1 deletion sdk/metric/alignment_test.go
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
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 4702f6f

Please sign in to comment.