Skip to content

Commit

Permalink
Bump otel to v1.6.0 (#52)
Browse files Browse the repository at this point in the history
* Bump otel to v1.6.0

* Update README.md
  • Loading branch information
nhatthm authored Mar 24, 2022
1 parent 5551aa0 commit f431a4a
Show file tree
Hide file tree
Showing 18 changed files with 277 additions and 280 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ Add a OpenTelemetry wrapper to your existing database code to instrument the int
go get github.com/nhatthm/otelsql
```

Compatibility

| `otelsql` | `go.opentelemetry.io/otel` |
|:---------:|:--------------------------:|
| `v0.1.*` | `v1.3.0` ~> `v1.5.0` |
| `v0.2.*` | `v1.6.0` ~> `latest` |

[<sub><sup>[table of contents]</sup></sub>](#table-of-contents)

## Usage
Expand Down
12 changes: 6 additions & 6 deletions begin_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/nonrecording"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"

"github.com/nhatthm/otelsql/internal/test/oteltest"
)

func BenchmarkBeginStats(b *testing.B) {
meter := metric.NewNoopMeterProvider().Meter("")
meter := nonrecording.NewNoopMeter()

histogram, err := meter.NewFloat64Histogram("latency_ms")
histogram, err := meter.SyncFloat64().Histogram("latency_ms")
require.NoError(b, err)

count, err := meter.NewInt64Counter("calls")
count, err := meter.SyncInt64().Counter("calls")
require.NoError(b, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down Expand Up @@ -181,10 +181,10 @@ func TestBeginStats(t *testing.T) {
Run(t, func(s oteltest.SuiteContext) {
meter := s.MeterProvider().Meter("begin_test")

histogram, err := meter.NewFloat64Histogram(dbSQLClientLatencyMs)
histogram, err := meter.SyncFloat64().Histogram(dbSQLClientLatencyMs)
require.NoError(t, err)

count, err := meter.NewInt64Counter(dbSQLClientCalls)
count, err := meter.SyncInt64().Counter(dbSQLClientCalls)
require.NoError(t, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down
16 changes: 8 additions & 8 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"sync"

"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/global"
"go.opentelemetry.io/otel/metric/instrument"
"go.opentelemetry.io/otel/metric/unit"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
"go.opentelemetry.io/otel/trace"
Expand Down Expand Up @@ -83,7 +83,7 @@ func RegisterWithSource(driverName string, source string, options ...DriverOptio
// Wrap takes a SQL driver and wraps it with OpenCensus instrumentation.
func Wrap(d driver.Driver, opts ...DriverOption) driver.Driver {
o := driverOptions{
meterProvider: global.GetMeterProvider(),
meterProvider: global.MeterProvider(),
tracerProvider: otel.GetTracerProvider(),
}

Expand Down Expand Up @@ -127,15 +127,15 @@ func newConnConfig(opts driverOptions) connConfig {
traceWithSpanNameFormatter(opts.trace.spanNameFormatter),
)

latencyMsHistogram, err := meter.NewFloat64Histogram(dbSQLClientLatencyMs,
metric.WithUnit(unit.Milliseconds),
metric.WithDescription(`The distribution of latencies of various calls in milliseconds`),
latencyMsHistogram, err := meter.SyncFloat64().Histogram(dbSQLClientLatencyMs,
instrument.WithUnit(unit.Milliseconds),
instrument.WithDescription(`The distribution of latencies of various calls in milliseconds`),
)
handleErr(err)

callsCounter, err := meter.NewInt64Counter(dbSQLClientCalls,
metric.WithUnit(unit.Dimensionless),
metric.WithDescription(`The number of various calls of methods`),
callsCounter, err := meter.SyncInt64().Counter(dbSQLClientCalls,
instrument.WithUnit(unit.Dimensionless),
instrument.WithDescription(`The number of various calls of methods`),
)
handleErr(err)

Expand Down
12 changes: 6 additions & 6 deletions exec_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/nonrecording"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"

"github.com/nhatthm/otelsql/internal/test/oteltest"
)

func BenchmarkExecStats(b *testing.B) {
meter := metric.NewNoopMeterProvider().Meter("")
meter := nonrecording.NewNoopMeter()

histogram, err := meter.NewFloat64Histogram("latency_ms")
histogram, err := meter.SyncFloat64().Histogram("latency_ms")
require.NoError(b, err)

count, err := meter.NewInt64Counter("calls")
count, err := meter.SyncInt64().Counter("calls")
require.NoError(b, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down Expand Up @@ -155,10 +155,10 @@ func TestExecStats(t *testing.T) {
Run(t, func(s oteltest.SuiteContext) {
meter := s.MeterProvider().Meter("exec_test")

histogram, err := meter.NewFloat64Histogram(dbSQLClientLatencyMs)
histogram, err := meter.SyncFloat64().Histogram(dbSQLClientLatencyMs)
require.NoError(t, err)

count, err := meter.NewInt64Counter(dbSQLClientCalls)
count, err := meter.SyncInt64().Counter(dbSQLClientCalls)
require.NoError(t, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,28 @@ require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/stretchr/testify v1.7.1
github.com/swaggest/assertjson v1.6.8
go.opentelemetry.io/otel v1.5.0
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0
go.opentelemetry.io/otel/metric v0.27.0
go.opentelemetry.io/otel/sdk v1.5.0
go.opentelemetry.io/otel/sdk/metric v0.27.0
go.opentelemetry.io/otel/trace v1.5.0
go.opentelemetry.io/otel v1.6.0
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0
go.opentelemetry.io/otel/metric v0.28.0
go.opentelemetry.io/otel/sdk v1.6.0
go.opentelemetry.io/otel/sdk/metric v0.28.0
go.opentelemetry.io/otel/trace v1.6.0
)

require (
github.com/bool64/shared v0.1.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/iancoleman/orderedmap v0.2.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
go.opentelemetry.io/otel/internal/metric v0.27.0 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf // indirect
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
41 changes: 18 additions & 23 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -66,7 +67,6 @@ github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/swaggest/assertjson v1.6.8 h1:1O/9UI5M+2OJI7BeEWKGj0wTvpRXZt5FkOJ4nRkY4rA=
Expand All @@ -79,25 +79,20 @@ github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDf
github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI=
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk=
go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E=
go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0 h1:GMNns6UpdYhxcBgK1Z4qBvG9knRBGBFoe/alvaaBBeI=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0/go.mod h1:2T1VrynTXNdK4uB/hHqnvjTYL09wJWDGp8sOcJIMqjA=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 h1:/Lu2JuL9Mb+B+kSv/RsDMgA/5FaBaxfyfMnICFepiBs=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0/go.mod h1:5gUXICq93HyDh8Rij7p8ilJEC1Sqk0u3lSGs62i8hJQ=
go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk=
go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw=
go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ=
go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g=
go.opentelemetry.io/otel/sdk v1.4.0/go.mod h1:71GJPNJh4Qju6zJuYl1CrYtXbrgfau/M9UAggqiy1UE=
go.opentelemetry.io/otel/sdk v1.5.0 h1:QKhWBbcOC9fDCZKCfPFjWTWpfIlJR+i9xiUDYrLVmZs=
go.opentelemetry.io/otel/sdk v1.5.0/go.mod h1:CU4J1v+7iEljnm1G14QjdFWOXUyYLHVh0Lh+/BTYyFg=
go.opentelemetry.io/otel/sdk/metric v0.27.0 h1:CDEu96Js5IP7f4bJ8eimxF09V5hKYmE7CeyKSjmAL1s=
go.opentelemetry.io/otel/sdk/metric v0.27.0/go.mod h1:lOgrT5C3ORdbqp2LsDrx+pBj6gbZtQ5Omk27vH3EaW0=
go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE=
go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU=
go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE=
go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4=
go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 h1:ML6aEhlJAhSkPxVPS/3zkRcQOdYRiul8FDXcwL/KnpI=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0/go.mod h1:8JL8qoBinVMmTsd57ekSmuRf4nDQPttgO6MUKzKaLII=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 h1:1idGnMzWHpSp7HwPs+fkyhisQBp+JsLCHa2RIB6P+l8=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0/go.mod h1:itLJK+HwfvBpkUm7MYCK6usGbAlk2YRQkJzvFhk8QRc=
go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ=
go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw=
go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk=
go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM=
go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o=
go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU=
go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo=
go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down Expand Up @@ -127,8 +122,8 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf h1:Fm4IcnUL803i92qDlmB0obyHmosDrxZWxJL3gIeNqOw=
golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand Down
12 changes: 6 additions & 6 deletions ping_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/nonrecording"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"

"github.com/nhatthm/otelsql/internal/test/oteltest"
)

func BenchmarkPingStats(b *testing.B) {
meter := metric.NewNoopMeterProvider().Meter("")
meter := nonrecording.NewNoopMeter()

histogram, err := meter.NewFloat64Histogram("latency_ms")
histogram, err := meter.SyncFloat64().Histogram("latency_ms")
require.NoError(b, err)

count, err := meter.NewInt64Counter("calls")
count, err := meter.SyncInt64().Counter("calls")
require.NoError(b, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down Expand Up @@ -142,10 +142,10 @@ func TestPingStats(t *testing.T) {
Run(t, func(s oteltest.SuiteContext) {
meter := s.MeterProvider().Meter("ping_test")

histogram, err := meter.NewFloat64Histogram(dbSQLClientLatencyMs)
histogram, err := meter.SyncFloat64().Histogram(dbSQLClientLatencyMs)
require.NoError(t, err)

count, err := meter.NewInt64Counter(dbSQLClientCalls)
count, err := meter.SyncInt64().Counter(dbSQLClientCalls)
require.NoError(t, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down
12 changes: 6 additions & 6 deletions prepare_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/nonrecording"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"

"github.com/nhatthm/otelsql/internal/test/oteltest"
)

func BenchmarkPrepareStats(b *testing.B) {
meter := metric.NewNoopMeterProvider().Meter("")
meter := nonrecording.NewNoopMeter()

histogram, err := meter.NewFloat64Histogram("latency_ms")
histogram, err := meter.SyncFloat64().Histogram("latency_ms")
require.NoError(b, err)

count, err := meter.NewInt64Counter("calls")
count, err := meter.SyncInt64().Counter("calls")
require.NoError(b, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down Expand Up @@ -181,10 +181,10 @@ func TestPrepareStats(t *testing.T) {
Run(t, func(s oteltest.SuiteContext) {
meter := s.MeterProvider().Meter("prepare_test")

histogram, err := meter.NewFloat64Histogram(dbSQLClientLatencyMs)
histogram, err := meter.SyncFloat64().Histogram(dbSQLClientLatencyMs)
require.NoError(t, err)

count, err := meter.NewInt64Counter(dbSQLClientCalls)
count, err := meter.SyncInt64().Counter(dbSQLClientCalls)
require.NoError(t, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down
12 changes: 6 additions & 6 deletions query_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/nonrecording"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"

"github.com/nhatthm/otelsql/internal/test/oteltest"
)

func BenchmarkQueryStats(b *testing.B) {
meter := metric.NewNoopMeterProvider().Meter("")
meter := nonrecording.NewNoopMeter()

histogram, err := meter.NewFloat64Histogram("latency_ms")
histogram, err := meter.SyncFloat64().Histogram("latency_ms")
require.NoError(b, err)

count, err := meter.NewInt64Counter("calls")
count, err := meter.SyncInt64().Counter("calls")
require.NoError(b, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down Expand Up @@ -155,10 +155,10 @@ func TestQueryStats(t *testing.T) {
Run(t, func(s oteltest.SuiteContext) {
meter := s.MeterProvider().Meter("query_test")

histogram, err := meter.NewFloat64Histogram(dbSQLClientLatencyMs)
histogram, err := meter.SyncFloat64().Histogram(dbSQLClientLatencyMs)
require.NoError(t, err)

count, err := meter.NewInt64Counter(dbSQLClientCalls)
count, err := meter.SyncInt64().Counter(dbSQLClientCalls)
require.NoError(t, err)

r := newMethodRecorder(histogram.Record, count.Add,
Expand Down
Loading

0 comments on commit f431a4a

Please sign in to comment.