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

Upgrade OTel to version 1.12.0/0.35.0 #139

Merged
merged 4 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Changed

- Upgrade OTel to version `1.12.0/0.35.0`. (#139)

## [0.17.1] - 2022-12-13

### Changed
Expand Down
14 changes: 7 additions & 7 deletions example/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ require (
github.com/XSAM/otelsql v0.0.0
github.com/go-sql-driver/mysql v1.7.0
github.com/prometheus/client_golang v1.14.0
go.opentelemetry.io/otel v1.11.2
go.opentelemetry.io/otel/exporters/prometheus v0.34.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2
go.opentelemetry.io/otel/metric v0.34.0
go.opentelemetry.io/otel/sdk v1.11.2
go.opentelemetry.io/otel/sdk/metric v0.34.0
go.opentelemetry.io/otel v1.12.0
go.opentelemetry.io/otel/exporters/prometheus v0.35.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0
go.opentelemetry.io/otel/metric v0.35.0
go.opentelemetry.io/otel/sdk v1.12.0
go.opentelemetry.io/otel/sdk/metric v0.35.0
)

require (
Expand All @@ -26,7 +26,7 @@ require (
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
go.opentelemetry.io/otel/trace v1.11.2 // indirect
go.opentelemetry.io/otel/trace v1.12.0 // indirect
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
28 changes: 14 additions & 14 deletions example/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,20 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0=
go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI=
go.opentelemetry.io/otel/exporters/prometheus v0.34.0 h1:L5D+HxdaC/ORB47ribbTBbkXRZs9JzPjq0EoIOMWncM=
go.opentelemetry.io/otel/exporters/prometheus v0.34.0/go.mod h1:6gUoJyfhoWqF0tOLaY0ZmKgkQRcvEQx6p5rVlKHp3s4=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 h1:BhEVgvuE1NWLLuMLvC6sif791F45KFHi5GhOs1KunZU=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2/go.mod h1:bx//lU66dPzNT+Y0hHA12ciKoMOH9iixEwCqC1OeQWQ=
go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8=
go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8=
go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU=
go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU=
go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo=
go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ=
go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0=
go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA=
go.opentelemetry.io/otel v1.12.0 h1:IgfC7kqQrRccIKuB7Cl+SRUmsKbEwSGPr0Eu+/ht1SQ=
go.opentelemetry.io/otel v1.12.0/go.mod h1:geaoz0L0r1BEOR81k7/n9W4TCXYCJ7bPO7K374jQHG0=
go.opentelemetry.io/otel/exporters/prometheus v0.35.0 h1:OCWu7Z5W9wNis5aViq+MqRFj2PEFmFhvIHOk32TABM0=
go.opentelemetry.io/otel/exporters/prometheus v0.35.0/go.mod h1:U0tqTnN6hnGiNKKGNN5uPOuhb/3C7gcZuh23d2k9bXc=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0 h1:FXwvCIXsrMas/reQkSUTPZVCqud1yDy441acn4Fdu6w=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0/go.mod h1:TTDkohPFSX4LMcbmNMYDh0hMXV8YigEjw5WwD+nDn6U=
go.opentelemetry.io/otel/metric v0.35.0 h1:aPT5jk/w7F9zW51L7WgRqNKDElBdyRLGuBtI5MX34e8=
go.opentelemetry.io/otel/metric v0.35.0/go.mod h1:qAcbhaTRFU6uG8QM7dDo7XvFsWcugziq/5YI065TokQ=
go.opentelemetry.io/otel/sdk v1.12.0 h1:8npliVYV7qc0t1FKdpU08eMnOjgPFMnriPhn0HH4q3o=
go.opentelemetry.io/otel/sdk v1.12.0/go.mod h1:WYcvtgquYvgODEvxOry5owO2y9MyciW7JqMz6cpXShE=
go.opentelemetry.io/otel/sdk/metric v0.35.0 h1:gryV4W5GzpOhKK48/lZb8ldyWIs3DRugSVlQZmCwELA=
go.opentelemetry.io/otel/sdk/metric v0.35.0/go.mod h1:eDyp1GxSiwV98kr7w4pzrszQh/eze9MqBqPd2bCPmyE=
go.opentelemetry.io/otel/trace v1.12.0 h1:p28in++7Kd0r2d8gSt931O57fdjUyWxkVbESuILAeUc=
go.opentelemetry.io/otel/trace v1.12.0/go.mod h1:pHlgBynn6s25qJ2szD+Bv+iwKJttjHSI3lUAyf0GNuQ=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ go 1.18

require (
github.com/stretchr/testify v1.8.1
go.opentelemetry.io/otel v1.11.2
go.opentelemetry.io/otel/metric v0.34.0
go.opentelemetry.io/otel/sdk v1.11.2
go.opentelemetry.io/otel/trace v1.11.2
go.opentelemetry.io/otel v1.12.0
go.opentelemetry.io/otel/metric v0.35.0
go.opentelemetry.io/otel/sdk v1.12.0
go.opentelemetry.io/otel/sdk/metric v0.35.0
go.opentelemetry.io/otel/trace v1.12.0
)

require (
Expand Down
18 changes: 10 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0=
go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI=
go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8=
go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8=
go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU=
go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU=
go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0=
go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA=
go.opentelemetry.io/otel v1.12.0 h1:IgfC7kqQrRccIKuB7Cl+SRUmsKbEwSGPr0Eu+/ht1SQ=
go.opentelemetry.io/otel v1.12.0/go.mod h1:geaoz0L0r1BEOR81k7/n9W4TCXYCJ7bPO7K374jQHG0=
go.opentelemetry.io/otel/metric v0.35.0 h1:aPT5jk/w7F9zW51L7WgRqNKDElBdyRLGuBtI5MX34e8=
go.opentelemetry.io/otel/metric v0.35.0/go.mod h1:qAcbhaTRFU6uG8QM7dDo7XvFsWcugziq/5YI065TokQ=
go.opentelemetry.io/otel/sdk v1.12.0 h1:8npliVYV7qc0t1FKdpU08eMnOjgPFMnriPhn0HH4q3o=
go.opentelemetry.io/otel/sdk v1.12.0/go.mod h1:WYcvtgquYvgODEvxOry5owO2y9MyciW7JqMz6cpXShE=
go.opentelemetry.io/otel/sdk/metric v0.35.0 h1:gryV4W5GzpOhKK48/lZb8ldyWIs3DRugSVlQZmCwELA=
go.opentelemetry.io/otel/sdk/metric v0.35.0/go.mod h1:eDyp1GxSiwV98kr7w4pzrszQh/eze9MqBqPd2bCPmyE=
go.opentelemetry.io/otel/trace v1.12.0 h1:p28in++7Kd0r2d8gSt931O57fdjUyWxkVbESuILAeUc=
go.opentelemetry.io/otel/trace v1.12.0/go.mod h1:pHlgBynn6s25qJ2szD+Bv+iwKJttjHSI3lUAyf0GNuQ=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
35 changes: 16 additions & 19 deletions instruments.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ import (

"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/instrument"
"go.opentelemetry.io/otel/metric/instrument/asyncfloat64"
"go.opentelemetry.io/otel/metric/instrument/asyncint64"
"go.opentelemetry.io/otel/metric/instrument/syncfloat64"
"go.opentelemetry.io/otel/metric/unit"
)

Expand All @@ -31,25 +28,25 @@ const (
)

type dbStatsInstruments struct {
connectionMaxOpen asyncint64.Gauge
connectionOpen asyncint64.Gauge
connectionWaitTotal asyncint64.Counter
connectionWaitDurationTotal asyncfloat64.Counter
connectionClosedMaxIdleTotal asyncint64.Counter
connectionClosedMaxIdleTimeTotal asyncint64.Counter
connectionClosedMaxLifetimeTotal asyncint64.Counter
connectionMaxOpen instrument.Int64ObservableGauge
connectionOpen instrument.Int64ObservableGauge
connectionWaitTotal instrument.Int64ObservableCounter
connectionWaitDurationTotal instrument.Float64ObservableCounter
connectionClosedMaxIdleTotal instrument.Int64ObservableCounter
connectionClosedMaxIdleTimeTotal instrument.Int64ObservableCounter
connectionClosedMaxLifetimeTotal instrument.Int64ObservableCounter
}

type instruments struct {
// The latency of calls in milliseconds
latency syncfloat64.Histogram
latency instrument.Float64Histogram
}

func newInstruments(meter metric.Meter) (*instruments, error) {
var instruments instruments
var err error

if instruments.latency, err = meter.SyncFloat64().Histogram(
if instruments.latency, err = meter.Float64Histogram(
strings.Join([]string{namespace, "latency"}, "."),
instrument.WithDescription("The latency of calls in milliseconds"),
instrument.WithUnit(unit.Milliseconds),
Expand All @@ -64,50 +61,50 @@ func newDBStatsInstruments(meter metric.Meter) (*dbStatsInstruments, error) {
var err error
subsystem := "connection"

if instruments.connectionMaxOpen, err = meter.AsyncInt64().Gauge(
if instruments.connectionMaxOpen, err = meter.Int64ObservableGauge(
strings.Join([]string{namespace, subsystem, "max_open"}, "."),
instrument.WithDescription("Maximum number of open connections to the database"),
); err != nil {
return nil, fmt.Errorf("failed to create connectionMaxOpen instrument, %v", err)
}

if instruments.connectionOpen, err = meter.AsyncInt64().Gauge(
if instruments.connectionOpen, err = meter.Int64ObservableGauge(
strings.Join([]string{namespace, subsystem, "open"}, "."),
instrument.WithDescription("The number of established connections both in use and idle"),
); err != nil {
return nil, fmt.Errorf("failed to create connectionOpen instrument, %v", err)
}

if instruments.connectionWaitTotal, err = meter.AsyncInt64().Counter(
if instruments.connectionWaitTotal, err = meter.Int64ObservableCounter(
strings.Join([]string{namespace, subsystem, "wait"}, "."),
instrument.WithDescription("The total number of connections waited for"),
); err != nil {
return nil, fmt.Errorf("failed to create connectionWaitTotal instrument, %v", err)
}

if instruments.connectionWaitDurationTotal, err = meter.AsyncFloat64().Counter(
if instruments.connectionWaitDurationTotal, err = meter.Float64ObservableCounter(
strings.Join([]string{namespace, subsystem, "wait_duration"}, "."),
instrument.WithDescription("The total time blocked waiting for a new connection"),
instrument.WithUnit(unit.Milliseconds),
); err != nil {
return nil, fmt.Errorf("failed to create connectionWaitDurationTotal instrument, %v", err)
}

if instruments.connectionClosedMaxIdleTotal, err = meter.AsyncInt64().Counter(
if instruments.connectionClosedMaxIdleTotal, err = meter.Int64ObservableCounter(
strings.Join([]string{namespace, subsystem, "closed_max_idle"}, "."),
instrument.WithDescription("The total number of connections closed due to SetMaxIdleConns"),
); err != nil {
return nil, fmt.Errorf("failed to create connectionClosedMaxIdleTotal instrument, %v", err)
}

if instruments.connectionClosedMaxIdleTimeTotal, err = meter.AsyncInt64().Counter(
if instruments.connectionClosedMaxIdleTimeTotal, err = meter.Int64ObservableCounter(
strings.Join([]string{namespace, subsystem, "closed_max_idle_time"}, "."),
instrument.WithDescription("The total number of connections closed due to SetConnMaxIdleTime"),
); err != nil {
return nil, fmt.Errorf("failed to create connectionClosedMaxIdleTimeTotal instrument, %v", err)
}

if instruments.connectionClosedMaxLifetimeTotal, err = meter.AsyncInt64().Counter(
if instruments.connectionClosedMaxLifetimeTotal, err = meter.Int64ObservableCounter(
strings.Join([]string{namespace, subsystem, "closed_max_lifetime"}, "."),
instrument.WithDescription("The total number of connections closed due to SetConnMaxLifetime"),
); err != nil {
Expand Down
Loading