1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-12 10:04:29 +02:00
opentelemetry-go/sdk/metric/alignment_test.go
Bogdan Drutu 69df67d449
Refactor metric records logic (#468)
* Refactor metric records logic.

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

* Fix lint errors

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

* Fix a bug that we try to readd the old entry instead of a new one.

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

* Update comments in refcount_mapped.

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

* Remove the need to use a records list, iterate over the map.

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

* Fix comments and typos

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

* Fix more comments

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

* Clarify tryUnmap comment

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

* Fix one more typo.

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
2020-02-06 14:45:56 -08:00

29 lines
494 B
Go

package metric
import (
"os"
"testing"
"unsafe"
ottest "go.opentelemetry.io/otel/internal/testing"
)
// Ensure struct alignment prior to running tests.
func TestMain(m *testing.M) {
fields := []ottest.FieldOffset{
{
Name: "record.refMapped.value",
Offset: unsafe.Offsetof(record{}.refMapped.value),
},
{
Name: "record.modified",
Offset: unsafe.Offsetof(record{}.modified),
},
}
if !ottest.Aligned8Byte(fields, os.Stderr) {
os.Exit(1)
}
os.Exit(m.Run())
}