From 7035afc854fb34174e454d53aedef5159d4978bb Mon Sep 17 00:00:00 2001 From: Valeriy Tetevin Date: Mon, 24 Jul 2023 17:00:49 +0200 Subject: [PATCH] Fix trace aggregation --- ci/gateway-config.json | 7 ++ docker-compose.yml | 17 +++ k6test/script.js | 4 +- src/go.mod | 49 ++++----- src/go.sum | 100 ++++++++++-------- src/internal/api/gateway/composition.go | 20 ++-- src/internal/api/gateway/contribution.go | 4 +- src/internal/api/gateway/doc_access.go | 4 +- src/internal/api/gateway/ehr.go | 12 +-- src/internal/api/gateway/ehr_status.go | 8 +- src/internal/api/gateway/query.go | 4 +- src/internal/api/gateway/stored_query.go | 10 +- src/internal/api/gateway/template.go | 6 +- src/internal/api/gateway/user.go | 8 +- src/internal/api/gateway/user_group.go | 10 +- src/internal/observability/metrics/metrics.go | 32 +++--- .../observability/metrics/middleware.go | 12 ++- .../observability/tracer/middleware.go | 6 +- src/internal/observability/tracer/tracer.go | 5 + 19 files changed, 181 insertions(+), 137 deletions(-) diff --git a/ci/gateway-config.json b/ci/gateway-config.json index f3a8cbb3..01386ec8 100644 --- a/ci/gateway-config.json +++ b/ci/gateway-config.json @@ -37,5 +37,12 @@ }, "db": { "filePath": "/srv/data/local.db" + }, + "observability": { + "service_name": "ipehr-gateway", + "collect_metrics": false, + "metrics_port": 8081, + "collect_traces": true, + "jaeger_endpoint": "http://jaeger:14268/api/traces" } } diff --git a/docker-compose.yml b/docker-compose.yml index 43fda1fb..8285a3eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,10 +53,27 @@ services: condition: service_healthy ipehr-stat: condition: service_started + jaeger: + condition: service_started ports: - 8080:8080 networks: - ipehr-network + + jaeger: + image: jaegertracing/all-in-one:1.22 + environment: + - COLLECTOR_ZIPKIN_HTTP_PORT=9411 + ports: + - 16686:16686 + - 14268:14268 + - 9411:9411 + - 5775:5775/udp + - 6831:6831/udp + - 6832:6832/udp + - 5778:5778 + networks: + - ipehr-network # configs: # gateway-config: diff --git a/k6test/script.js b/k6test/script.js index 8f720adb..d5fceee6 100644 --- a/k6test/script.js +++ b/k6test/script.js @@ -23,9 +23,9 @@ const formFailRate = new Rate('failed form fetches'); const submitFailRate = new Rate('failed form submits'); export const options = { - iterations: 1, + iterations: 10, // vus: 1, - // vus: 10, + vus: 3, // vus: 20, duration: '100s', ext: { diff --git a/src/go.mod b/src/go.mod index 2d0b0b77..92e8b620 100644 --- a/src/go.mod +++ b/src/go.mod @@ -25,19 +25,20 @@ require ( github.com/mattn/go-sqlite3 v1.14.12 github.com/multiformats/go-multihash v0.1.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.14.0 - github.com/stretchr/testify v1.8.1 + github.com/prometheus/client_golang v1.15.1 + github.com/stretchr/testify v1.8.3 github.com/swaggo/files v1.0.0 github.com/swaggo/gin-swagger v1.4.3 - github.com/swaggo/swag v1.8.10 + github.com/swaggo/swag v1.16.1 github.com/vmihailenco/msgpack/v5 v5.3.5 - go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.42.0 + go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/jaeger v1.2.0 - go.opentelemetry.io/otel/exporters/prometheus v0.36.0 - go.opentelemetry.io/otel/metric v0.36.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel/exporters/prometheus v0.39.0 + go.opentelemetry.io/otel/metric v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel/trace v1.16.0 golang.org/x/crypto v0.6.0 golang.org/x/exp v0.0.0-20230206171751-46f607a40771 gorm.io/driver/sqlite v1.3.6 @@ -85,21 +86,21 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gbrlsnchs/jwt/v3 v3.0.1 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.5 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/spec v0.20.8 // indirect github.com/go-openapi/swag v0.22.3 // indirect - github.com/go-playground/locales v0.14.0 // indirect - github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.11.1 // indirect github.com/go-stack/stack v1.8.1 // indirect - github.com/goccy/go-json v0.9.11 // indirect + github.com/goccy/go-json v0.10.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/hannahhoward/cbor-gen-for v0.0.0-20200817222906-ea96cece81f1 // indirect github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e // indirect @@ -150,7 +151,7 @@ require ( github.com/libp2p/go-openssl v0.0.7 // indirect github.com/magefile/mage v1.9.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/miekg/dns v1.1.48 // indirect github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect @@ -171,8 +172,8 @@ require ( github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.39.0 // indirect + github.com/prometheus/client_model v0.4.0 // indirect + github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/raulk/clock v1.1.0 // indirect github.com/rs/cors v1.7.0 // indirect @@ -182,7 +183,7 @@ require ( github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/numcpus v0.2.2 // indirect - github.com/ugorji/go/codec v1.2.7 // indirect + github.com/ugorji/go/codec v1.2.9 // indirect github.com/urfave/cli/v2 v2.24.3 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.1 // indirect @@ -195,13 +196,13 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/mod v0.7.0 // indirect - golang.org/x/net v0.6.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - golang.org/x/tools v0.5.0 // indirect + golang.org/x/mod v0.9.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/tools v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/src/go.sum b/src/go.sum index addb8142..8d474da9 100644 --- a/src/go.sum +++ b/src/go.sum @@ -79,8 +79,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a h1:E/8AP5dFtMhl5KPJz66Kt9G0n+7Sn41Fy1wv9/jHOrc= github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12 h1:npHgfD4Tl2WJS3AJaMUi5ynGDPUBfkg3U3fCzDyXZ+4= @@ -348,8 +348,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= 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/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/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/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= @@ -373,12 +373,14 @@ github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBY github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= @@ -390,8 +392,8 @@ github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= +github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= @@ -442,8 +444,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -1135,8 +1138,8 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= @@ -1349,16 +1352,16 @@ github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU= github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -1368,8 +1371,8 @@ github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16 github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.39.0 h1:oOyhkDq05hPZKItWVBkJ6g6AtGxi+fy7F4JvUV8uhsI= -github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -1393,7 +1396,7 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -1483,16 +1486,17 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= github.com/swaggo/files v1.0.0 h1:1gGXVIeUFCS/dta17rnP0iOpr6CXFwKD7EO5ID233e4= github.com/swaggo/files v1.0.0/go.mod h1:N59U6URJLyU1PQgFqPM7wXLMhJx7QAolnvfQkqO13kc= github.com/swaggo/gin-swagger v1.4.3 h1:mHJz+yzJne0udgYnC5qlDf4e7KuxUbVNX2dhD/cw2rU= github.com/swaggo/gin-swagger v1.4.3/go.mod h1:hBg6tGeKJsUu/P79BH+WGUR8nq2LuGE0O160+s4iefo= github.com/swaggo/swag v1.8.1/go.mod h1:ugemnJsPZm/kRwFUnzBlbHRd0JY9zE1M4F+uy2pAaPQ= -github.com/swaggo/swag v1.8.10 h1:eExW4bFa52WOjqRzRD58bgWsWfdFJso50lpbeTcmTfo= -github.com/swaggo/swag v1.8.10/go.mod h1:ezQVUUhly8dludpVk+/PuwJWvLLanB13ygV5Pr9enSk= +github.com/swaggo/swag v1.16.1 h1:fTNRhKstPKxcnoKsytm4sahr8FaYzUcT7i1/3nd/fBg= +github.com/swaggo/swag v1.16.1/go.mod h1:9/LMvHycG3NFHfR6LwvikHv5iFvmPADQ359cKikGxto= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= @@ -1505,11 +1509,10 @@ github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZF github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= -github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU= +github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= @@ -1593,28 +1596,31 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.42.0 h1:l7AmwSVqozWKKXeZHycpdmpycQECRpoGwJ1FW2sWfTo= +go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.42.0/go.mod h1:Ep4uoO2ijR0f49Pr7jAqyTjSCyS1SRL18wwttKfwqXA= +go.opentelemetry.io/contrib/propagators/b3 v1.17.0 h1:ImOVvHnku8jijXqkwCSyYKRDt2YrnGXD4BbhcpfbfJo= go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= go.opentelemetry.io/otel v1.2.0/go.mod h1:aT17Fk0Z1Nor9e0uisf98LrntPGMnk4frBO9+dkf69I= -go.opentelemetry.io/otel v1.13.0 h1:1ZAKnNQKwBBxFtww/GwxNUyTf0AxkZzrukO8MeXqe4Y= -go.opentelemetry.io/otel v1.13.0/go.mod h1:FH3RtdZCzRkJYFTCsAKDy9l/XYjMdNv6QrkFFB8DvVg= +go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= +go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= go.opentelemetry.io/otel/exporters/jaeger v1.2.0 h1:C/5Egj3MJBXRJi22cSl07suqPqtZLnLFmH//OxETUEc= go.opentelemetry.io/otel/exporters/jaeger v1.2.0/go.mod h1:KJLFbEMKTNPIfOxcg/WikIozEoKcPgJRz3Ce1vLlM8E= -go.opentelemetry.io/otel/exporters/prometheus v0.36.0 h1:EbfJRxojnpb+ux8IO79oKHXu9jsbWjd00cT0XmbP5gU= -go.opentelemetry.io/otel/exporters/prometheus v0.36.0/go.mod h1:gYHAjuEuMrtPXccEHyvYcQVC//c4QwgQcUq1/3mx7Ys= +go.opentelemetry.io/otel/exporters/prometheus v0.39.0 h1:whAaiHxOatgtKd+w0dOi//1KUxj3KoPINZdtDaDj3IA= +go.opentelemetry.io/otel/exporters/prometheus v0.39.0/go.mod h1:4jo5Q4CROlCpSPsXLhymi+LYrDXd2ObU5wbKayfZs7Y= go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= -go.opentelemetry.io/otel/metric v0.36.0 h1:t0lgGI+L68QWt3QtOIlqM9gXoxqxWLhZ3R/e5oOAY0Q= -go.opentelemetry.io/otel/metric v0.36.0/go.mod h1:wKVw57sd2HdSZAzyfOM9gTqqE8v7CbqWsYL6AyrH9qk= +go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= +go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= go.opentelemetry.io/otel/sdk v1.2.0/go.mod h1:jNN8QtpvbsKhgaC6V5lHiejMoKD+V8uadoSafgHPx1U= -go.opentelemetry.io/otel/sdk v1.13.0 h1:BHib5g8MvdqS65yo2vV1s6Le42Hm6rrw08qU6yz5JaM= -go.opentelemetry.io/otel/sdk v1.13.0/go.mod h1:YLKPx5+6Vx/o1TCUYYs+bpymtkmazOMT6zoRrC7AQ7I= -go.opentelemetry.io/otel/sdk/metric v0.36.0 h1:dEXpkkOAEcHiRiaZdvd63MouV+3bCtAB/bF3jlNKnr8= -go.opentelemetry.io/otel/sdk/metric v0.36.0/go.mod h1:Lv4HQQPSCSkhyBKzLNtE8YhTSdK4HCwNh3lh7CiR20s= +go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= +go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= +go.opentelemetry.io/otel/sdk/metric v0.39.0 h1:Kun8i1eYf48kHH83RucG93ffz0zGV1sh46FAScOTuDI= +go.opentelemetry.io/otel/sdk/metric v0.39.0/go.mod h1:piDIRgjcK7u0HCL5pCA4e74qpK/jk3NiUoAHATVAmiI= go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= go.opentelemetry.io/otel/trace v1.2.0/go.mod h1:N5FLswTubnxKxOJHM7XZC074qpeEdLy3CgAVsdMucK0= -go.opentelemetry.io/otel/trace v1.13.0 h1:CBgRZ6ntv+Amuj1jDsMhZtlAPT6gbyIRdaIzFhfBSdY= -go.opentelemetry.io/otel/trace v1.13.0/go.mod h1:muCvmmO9KKpvuXSf3KKAXXB2ygNYHQ+ZfI5X08d3tds= +go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= +go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1721,8 +1727,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1785,8 +1791,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1903,8 +1909,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1917,8 +1923,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1986,8 +1992,8 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4= -golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= +golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -2096,8 +2102,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/src/internal/api/gateway/composition.go b/src/internal/api/gateway/composition.go index 9255f204..49a7f33f 100644 --- a/src/internal/api/gateway/composition.go +++ b/src/internal/api/gateway/composition.go @@ -97,7 +97,7 @@ func (h *CompositionHandler) Create(c *gin.Context) { return } - userEhrUUID, err := h.indexer.GetEhrUUIDByUserID(c, userID, systemID) + userEhrUUID, err := h.indexer.GetEhrUUIDByUserID(c.Request.Context(), userID, systemID) switch { case err != nil && errors.Is(err, errors.ErrIsNotExist): c.AbortWithStatus(http.StatusNotFound) @@ -149,7 +149,7 @@ func (h *CompositionHandler) Create(c *gin.Context) { } // Composition document creating - doc, err := h.service.Create(c, userID, systemID, &ehrUUID, groupAccessUUID, composition, procRequest) + doc, err := h.service.Create(c.Request.Context(), userID, systemID, &ehrUUID, groupAccessUUID, composition, procRequest) if err != nil { log.Println("Composition creating error:", err) c.JSON(http.StatusUnprocessableEntity, gin.H{"error": "Composition creating error"}) @@ -207,7 +207,7 @@ func (h *CompositionHandler) GetByID(c *gin.Context) { } // Checking EHR does not exist - userEhrUUID, err := h.indexer.GetEhrUUIDByUserID(c, userID, systemID) + userEhrUUID, err := h.indexer.GetEhrUUIDByUserID(c.Request.Context(), userID, systemID) switch { case err != nil && errors.Is(err, errors.ErrIsNotExist): c.AbortWithStatus(http.StatusNotFound) @@ -223,7 +223,7 @@ func (h *CompositionHandler) GetByID(c *gin.Context) { c.AbortWithStatus(http.StatusInternalServerError) } - data, err := h.service.GetByID(c, userID, systemID, &ehrUUID, versionUID) + data, err := h.service.GetByID(c.Request.Context(), userID, systemID, &ehrUUID, versionUID) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) @@ -284,7 +284,7 @@ func (h *CompositionHandler) Delete(c *gin.Context) { return } - userEhrUUID, err := h.indexer.GetEhrUUIDByUserID(c, userID, systemID) + userEhrUUID, err := h.indexer.GetEhrUUIDByUserID(c.Request.Context(), userID, systemID) if err != nil { if errors.Is(err, errors.ErrIsNotExist) { c.AbortWithStatus(http.StatusNotFound) @@ -309,7 +309,7 @@ func (h *CompositionHandler) Delete(c *gin.Context) { return } - newUID, err := h.service.DeleteByID(c, procRequest, &ehrUUID, versionUID, userID, systemID) + newUID, err := h.service.DeleteByID(c.Request.Context(), procRequest, &ehrUUID, versionUID, userID, systemID) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) @@ -389,7 +389,7 @@ func (h CompositionHandler) Update(c *gin.Context) { return } - userEhrUUID, err := h.indexer.GetEhrUUIDByUserID(c, userID, systemID) + userEhrUUID, err := h.indexer.GetEhrUUIDByUserID(c.Request.Context(), userID, systemID) switch { case err != nil && errors.Is(err, errors.ErrIsNotExist): c.AbortWithStatus(http.StatusNotFound) @@ -437,7 +437,7 @@ func (h CompositionHandler) Update(c *gin.Context) { return } - compositionLast, err := h.service.GetLastByBaseID(c, userID, systemID, &ehrUUID, versionUID) + compositionLast, err := h.service.GetLastByBaseID(c.Request.Context(), userID, systemID, &ehrUUID, versionUID) if err != nil { if errors.Is(err, errors.ErrIsNotExist) { c.AbortWithStatus(http.StatusNotFound) @@ -467,7 +467,7 @@ func (h CompositionHandler) Update(c *gin.Context) { return } - compositionUpdated, err := h.service.Update(c, procRequest, userID, systemID, &ehrUUID, groupAccessUUID, &compositionUpdate) + compositionUpdated, err := h.service.Update(c.Request.Context(), procRequest, userID, systemID, &ehrUUID, groupAccessUUID, &compositionUpdate) if err != nil { log.Println("Composition Update error:", err) c.AbortWithStatus(http.StatusInternalServerError) @@ -506,7 +506,7 @@ func (h CompositionHandler) GetList(c *gin.Context) { systemID := c.GetString("ehrSystemID") userID := c.GetString("userID") - list, err := h.service.GetList(c, userID, systemID) + list, err := h.service.GetList(c.Request.Context(), userID, systemID) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) diff --git a/src/internal/api/gateway/contribution.go b/src/internal/api/gateway/contribution.go index 5e1861a7..cfcd948c 100644 --- a/src/internal/api/gateway/contribution.go +++ b/src/internal/api/gateway/contribution.go @@ -73,7 +73,7 @@ func (h *ContributionHandler) GetByID(c *gin.Context) { return } - con, err := h.service.GetByID(c, userID, cUID) + con, err := h.service.GetByID(c.Request.Context(), userID, cUID) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) @@ -119,7 +119,7 @@ func (h *ContributionHandler) Create(ctx *gin.Context) { } ehrID := ctx.Param("ehrid") - // TODO do we need checking userID by EHRid because it can be summary data with different users (GetEhrUUIDByUserID(c, userID, systemID)) + // TODO do we need checking userID by EHRid because it can be summary data with different users (GetEhrUUIDByUserID(c.Request.Context(),userID, systemID)) ehrUUID, err := uuid.Parse(ehrID) if err != nil { diff --git a/src/internal/api/gateway/doc_access.go b/src/internal/api/gateway/doc_access.go index bcdbbfb3..948e0f1e 100644 --- a/src/internal/api/gateway/doc_access.go +++ b/src/internal/api/gateway/doc_access.go @@ -48,7 +48,7 @@ func (h *DocAccessHandler) List(c *gin.Context) { systemID := c.GetString("ehrSystemID") - resp, err := h.service.List(c, userID, systemID) + resp, err := h.service.List(c.Request.Context(), userID, systemID) if err != nil && !errors.Is(err, errors.ErrNotFound) { log.Println(err) c.AbortWithStatus(http.StatusInternalServerError) @@ -114,7 +114,7 @@ func (h *DocAccessHandler) Set(c *gin.Context) { return } - if err := h.service.Set(c, userID, systemID, req.UserID, reqID, &CID, level); err != nil { + if err := h.service.Set(c.Request.Context(), userID, systemID, req.UserID, reqID, &CID, level); err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) return diff --git a/src/internal/api/gateway/ehr.go b/src/internal/api/gateway/ehr.go index 825f55e6..220479e9 100644 --- a/src/internal/api/gateway/ehr.go +++ b/src/internal/api/gateway/ehr.go @@ -89,7 +89,7 @@ func (h *EhrHandler) Create(c *gin.Context) { // Checking EHR does not exist? // проверить чему будет равен ehrUUID - ehrUUID, err := h.service.Infra.Index.GetEhrUUIDByUserID(c, userID, systemID) + ehrUUID, err := h.service.Infra.Index.GetEhrUUIDByUserID(c.Request.Context(), userID, systemID) switch { case err == nil && ehrUUID != nil: c.AbortWithStatus(http.StatusConflict) @@ -125,7 +125,7 @@ func (h *EhrHandler) Create(c *gin.Context) { } // EHR document creating - doc, err := h.service.EhrCreate(c, userID, systemID, &ehrUUIDnew, groupAccessUUID, &request, procRequest) + doc, err := h.service.EhrCreate(c.Request.Context(), userID, systemID, &ehrUUIDnew, groupAccessUUID, &request, procRequest) if err != nil { if errors.Is(err, errors.ErrAlreadyExist) { c.JSON(http.StatusConflict, gin.H{"error": "EHR already exists"}) @@ -204,7 +204,7 @@ func (h *EhrHandler) CreateWithID(c *gin.Context) { systemID := c.GetString("ehrSystemID") // Checking EHR does not exist - _ehrUUID, err := h.service.Infra.Index.GetEhrUUIDByUserID(c, userID, systemID) + _ehrUUID, err := h.service.Infra.Index.GetEhrUUIDByUserID(c.Request.Context(), userID, systemID) switch { case err == nil && _ehrUUID != nil: c.AbortWithStatus(http.StatusConflict) @@ -238,7 +238,7 @@ func (h *EhrHandler) CreateWithID(c *gin.Context) { } // EHR document creating - newDoc, err := h.service.EhrCreateWithID(c, userID, systemID, &ehrUUID, groupAccessUUID, &request, procRequest) + newDoc, err := h.service.EhrCreateWithID(c.Request.Context(), userID, systemID, &ehrUUID, groupAccessUUID, &request, procRequest) if err != nil { if errors.Is(err, errors.ErrAlreadyExist) { c.JSON(http.StatusConflict, gin.H{"error": "EHR already exists"}) @@ -293,7 +293,7 @@ func (h *EhrHandler) GetByID(c *gin.Context) { systemID := c.GetString("ehrSystemID") - docDecrypted, err := h.service.GetByID(c, userID, systemID, &ehrUUID) + docDecrypted, err := h.service.GetByID(c.Request.Context(), userID, systemID, &ehrUUID) if err != nil && errors.Is(err, errors.ErrIsInProcessing) { c.AbortWithStatus(http.StatusAccepted) return @@ -344,7 +344,7 @@ func (h *EhrHandler) GetBySubjectIDAndNamespace(c *gin.Context) { systemID := c.GetString("ehrSystemID") - docDecrypted, err := h.service.GetDocBySubject(c, userID, systemID, subjectID, namespace) + docDecrypted, err := h.service.GetDocBySubject(c.Request.Context(), userID, systemID, subjectID, namespace) if err != nil && errors.Is(err, errors.ErrIsInProcessing) { c.AbortWithStatus(http.StatusAccepted) return diff --git a/src/internal/api/gateway/ehr_status.go b/src/internal/api/gateway/ehr_status.go index bd86f15b..cefc9eca 100644 --- a/src/internal/api/gateway/ehr_status.go +++ b/src/internal/api/gateway/ehr_status.go @@ -82,7 +82,7 @@ func (h *EhrStatusHandler) Update(c *gin.Context) { IfMatch := c.Request.Header.Get("If-Match") - docLast, err := h.service.GetStatus(c, userID, systemID, &ehrUUID) + docLast, err := h.service.GetStatus(c.Request.Context(), userID, systemID, &ehrUUID) if err != nil { log.Println("ehrStatusService.Get error:", err) c.JSON(http.StatusInternalServerError, gin.H{"error": "Error getting last EHR document status"}) @@ -131,7 +131,7 @@ func (h *EhrStatusHandler) Update(c *gin.Context) { return } - if err := h.service.UpdateStatus(c, procRequest, userID, systemID, &ehrUUID, &status); err != nil { + if err := h.service.UpdateStatus(c.Request.Context(), procRequest, userID, systemID, &ehrUUID, &status); err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err}) return } @@ -199,7 +199,7 @@ func (h *EhrStatusHandler) GetStatusByTime(c *gin.Context) { return } - docDecrypted, err := h.service.GetStatusByNearestTime(c, userID, systemID, &ehrUUID, statusTime) + docDecrypted, err := h.service.GetStatusByNearestTime(c.Request.Context(), userID, systemID, &ehrUUID, statusTime) if err != nil { if errors.Is(err, errors.ErrIsInProcessing) { c.AbortWithStatus(http.StatusAccepted) @@ -261,7 +261,7 @@ func (h *EhrStatusHandler) GetByID(c *gin.Context) { return } - docDecrypted, err := h.service.GetStatusByVersionID(c, userID, systemID, &ehrUUID, objectVersionID) + docDecrypted, err := h.service.GetStatusByVersionID(c.Request.Context(), userID, systemID, &ehrUUID, objectVersionID) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) diff --git a/src/internal/api/gateway/query.go b/src/internal/api/gateway/query.go index e14885bb..ebb52b9c 100644 --- a/src/internal/api/gateway/query.go +++ b/src/internal/api/gateway/query.go @@ -192,7 +192,7 @@ func (h QueryHandler) ExecStoredQuery(c *gin.Context) { return } - resp, err := h.service.ExecStoredQuery(c, userID, systemID, qualifiedQueryName, req) + resp, err := h.service.ExecStoredQuery(c.Request.Context(), userID, systemID, qualifiedQueryName, req) if err != nil { log.Printf("cannot exec stored query: %v", err) c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"}) @@ -240,7 +240,7 @@ func (h QueryHandler) PostExecStoredQuery(c *gin.Context) { defer c.Request.Body.Close() - resp, err := h.service.ExecStoredQuery(c, userID, systemID, qualifiedQueryName, &req) + resp, err := h.service.ExecStoredQuery(c.Request.Context(), userID, systemID, qualifiedQueryName, &req) if err != nil { log.Printf("cannot exec stored query: %v", err) c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"}) diff --git a/src/internal/api/gateway/stored_query.go b/src/internal/api/gateway/stored_query.go index 16d9887d..54d47548 100644 --- a/src/internal/api/gateway/stored_query.go +++ b/src/internal/api/gateway/stored_query.go @@ -41,7 +41,7 @@ func (h *QueryHandler) ListStored(c *gin.Context) { // But otherwise it is not clear how the client can get the full list of stored queries qName := c.Param("qualified_query_name") - queryList, err := h.service.List(c, userID, systemID, qName) + queryList, err := h.service.List(c.Request.Context(), userID, systemID, qName) if err != nil { log.Printf("StoredQuery service error: %s", err.Error()) // TODO replace to ErrorF after merge IPEHR-32 @@ -96,7 +96,7 @@ func (h *QueryHandler) GetStoredByVersion(c *gin.Context) { return } - sq, err := h.service.GetByVersion(c, userID, systemID, qName, v) + sq, err := h.service.GetByVersion(c.Request.Context(), userID, systemID, qName, v) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) @@ -169,7 +169,7 @@ func (h *QueryHandler) Store(c *gin.Context) { reqID := c.GetString("reqID") - sQ, err := h.service.Store(c, userID, systemID, reqID, qType, qName, string(data)) + sQ, err := h.service.Store(c.Request.Context(), userID, systemID, reqID, qType, qName, string(data)) if err != nil { log.Printf("StoredQuery service error: %s", err.Error()) // TODO replace to ErrorF after merge IPEHR-32 @@ -229,7 +229,7 @@ func (h *QueryHandler) StoreVersion(c *gin.Context) { return } - query, err := h.service.GetByVersion(c, userID, systemID, qName, v) + query, err := h.service.GetByVersion(c.Request.Context(), userID, systemID, qName, v) if err != nil && !errors.Is(err, errors.ErrNotFound) { log.Printf("GetByVersion error: %v", err) // TODO replace to ErrorF after merge IPEHR-32 @@ -261,7 +261,7 @@ func (h *QueryHandler) StoreVersion(c *gin.Context) { reqID := c.GetString("reqID") - sQ, err := h.service.StoreVersion(c, userID, systemID, reqID, qType, qName, v, string(data)) + sQ, err := h.service.StoreVersion(c.Request.Context(), userID, systemID, reqID, qType, qName, v, string(data)) if err != nil { log.Printf("StoredQuery service error: %s", err.Error()) // TODO replace to ErrorF after merge IPEHR-32 diff --git a/src/internal/api/gateway/template.go b/src/internal/api/gateway/template.go index d564f8b8..c2cc8584 100644 --- a/src/internal/api/gateway/template.go +++ b/src/internal/api/gateway/template.go @@ -64,7 +64,7 @@ func (h *TemplateHandler) GetByID(c *gin.Context) { tID := c.Param("template_id") - t, err := h.service.GetByID(c, userID, systemID, tID) + t, err := h.service.GetByID(c.Request.Context(), userID, systemID, tID) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) @@ -107,7 +107,7 @@ func (h *TemplateHandler) ListStored(c *gin.Context) { systemID := c.GetString("ehrSystemID") - l, err := h.service.GetList(c, userID, systemID) + l, err := h.service.GetList(c.Request.Context(), userID, systemID) if err != nil { log.Printf("Template service error: %s", err.Error()) // TODO replace to ErrorF after merge IPEHR-32 @@ -184,7 +184,7 @@ func (h *TemplateHandler) Store(c *gin.Context) { } reqID := c.GetString("reqID") - if err := h.service.Store(c, userID, systemID, reqID, m); err != nil { + if err := h.service.Store(c.Request.Context(), userID, systemID, reqID, m); err != nil { log.Printf("Template service store error: %s", err.Error()) // TODO replace to ErrorF after merge IPEHR-32 c.AbortWithStatus(http.StatusInternalServerError) diff --git a/src/internal/api/gateway/user.go b/src/internal/api/gateway/user.go index a8c10ca5..02b7b897 100644 --- a/src/internal/api/gateway/user.go +++ b/src/internal/api/gateway/user.go @@ -96,7 +96,7 @@ func (h *UserHandler) Register(c *gin.Context) { return } - if err := h.service.Register(c, &userCreateRequest, systemID, reqID); err != nil { + if err := h.service.Register(c.Request.Context(), &userCreateRequest, systemID, reqID); err != nil { if errors.Is(err, errors.ErrAlreadyExist) { c.JSON(http.StatusConflict, gin.H{"error": "User already exists"}) } else { @@ -150,7 +150,7 @@ func (h *UserHandler) Login(c *gin.Context) { return } - err := h.service.Login(c, u.UserID, systemID, u.Password) + err := h.service.Login(c.Request.Context(), u.UserID, systemID, u.Password) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.JSON(http.StatusNotFound, err.Error()) @@ -288,7 +288,7 @@ func (h *UserHandler) Info(c *gin.Context) { systemID := c.GetString("ehrSystemID") - userInfo, err := h.service.Info(c, userID, systemID) + userInfo, err := h.service.Info(c.Request.Context(), userID, systemID) if err != nil { if errors.Is(err, errors.ErrNotFound) || errors.Is(err, errors.ErrIsNotExist) { c.AbortWithStatus(http.StatusNotFound) @@ -333,7 +333,7 @@ func (h *UserHandler) InfoByCode(c *gin.Context) { return } - userInfo, err := h.service.InfoByCode(c, codeInt) + userInfo, err := h.service.InfoByCode(c.Request.Context(), codeInt) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) diff --git a/src/internal/api/gateway/user_group.go b/src/internal/api/gateway/user_group.go index e16b54b1..8bfc28e2 100644 --- a/src/internal/api/gateway/user_group.go +++ b/src/internal/api/gateway/user_group.go @@ -75,7 +75,7 @@ func (h *UserHandler) GroupCreate(c *gin.Context) { return } - userGroup, err = h.service.GroupCreate(c, procRequest, userID, systemID, userGroup.Name, userGroup.Description) + userGroup, err = h.service.GroupCreate(c.Request.Context(), procRequest, userID, systemID, userGroup.Name, userGroup.Description) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) @@ -136,7 +136,7 @@ func (h *UserHandler) GroupGetByID(c *gin.Context) { systemID := c.GetString("ehrSystemID") - userGroup, err := h.service.GroupGetByID(c, userID, systemID, &groupID, nil) + userGroup, err := h.service.GroupGetByID(c.Request.Context(), userID, systemID, &groupID, nil) if err != nil { if errors.Is(err, errors.ErrAccessDenied) { c.AbortWithStatus(http.StatusForbidden) @@ -210,7 +210,7 @@ func (h *UserHandler) GroupAddUser(c *gin.Context) { reqID := c.GetString("reqID") //TODO split systemID and adding user SystemID - err = h.service.GroupAddUser(c, userID, systemID, addUserID, systemID, reqID, level, &groupID) + err = h.service.GroupAddUser(c.Request.Context(), userID, systemID, addUserID, systemID, reqID, level, &groupID) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) @@ -279,7 +279,7 @@ func (h *UserHandler) GroupRemoveUser(c *gin.Context) { reqID := c.GetString("reqID") - err = h.service.GroupRemoveUser(c, userID, systemID, removeUserID, systemID, reqID, &groupID) + err = h.service.GroupRemoveUser(c.Request.Context(), userID, systemID, removeUserID, systemID, reqID, &groupID) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) @@ -320,7 +320,7 @@ func (h *UserHandler) GroupGetList(c *gin.Context) { systemID := c.GetString("ehrSystemID") - groupList, err := h.service.GroupGetList(c, userID, systemID) + groupList, err := h.service.GroupGetList(c.Request.Context(), userID, systemID) if err != nil { if errors.Is(err, errors.ErrNotFound) { c.AbortWithStatus(http.StatusNotFound) diff --git a/src/internal/observability/metrics/metrics.go b/src/internal/observability/metrics/metrics.go index 3c90c1fb..de7fe2c6 100644 --- a/src/internal/observability/metrics/metrics.go +++ b/src/internal/observability/metrics/metrics.go @@ -5,19 +5,18 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" - "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/unit" + + api "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) var ( - requestCounter instrument.Int64Counter - requestDuration instrument.Int64Histogram - requestSize instrument.Int64Histogram - responseSize instrument.Int64Histogram + requestCounter api.Int64Counter + requestDuration api.Int64Histogram + requestSize api.Int64Histogram + responseSize api.Int64Histogram ) func SetupMetrics(serviceName string) { @@ -30,35 +29,36 @@ func SetupMetrics(serviceName string) { metric.WithReader(exporter), metric.WithResource(getServiceResource(serviceName)), ) - global.SetMeterProvider(provider) - meter := global.Meter(serviceName) + meter := provider.Meter(serviceName) + // global.SetMeterProvider(provider) + // meter := global.Meter(serviceName) requestDuration, err = meter.Int64Histogram("request_duration", - instrument.WithDescription("Request duration in milliseconds"), - instrument.WithUnit(unit.Milliseconds), + api.WithDescription("Request duration in milliseconds"), + api.WithUnit("ms"), ) if err != nil { log.Fatalf("error on create request_duration histogram: %v", err) } requestSize, err = meter.Int64Histogram("request_size", - instrument.WithDescription("Request size"), - instrument.WithUnit(unit.Dimensionless), + api.WithDescription("Request size"), + api.WithUnit("bytes"), ) if err != nil { log.Fatalf("error on create request_size histogram: %v", err) } responseSize, err = meter.Int64Histogram("response_size", - instrument.WithDescription("Response size"), - instrument.WithUnit(unit.Dimensionless), + api.WithDescription("Response size"), + api.WithUnit("bytes"), ) if err != nil { log.Fatalf("error on create response_size histogram: %v", err) } requestCounter, err = meter.Int64Counter("request_counter", - instrument.WithDescription("Total requests count"), + api.WithDescription("Total requests count"), ) if err != nil { log.Fatalf("error on request counter: %v", err) diff --git a/src/internal/observability/metrics/middleware.go b/src/internal/observability/metrics/middleware.go index e8130a71..5b62b189 100644 --- a/src/internal/observability/metrics/middleware.go +++ b/src/internal/observability/metrics/middleware.go @@ -7,6 +7,7 @@ import ( "github.com/gin-gonic/gin" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" ) var Middleware func(c *gin.Context) = func(c *gin.Context) { @@ -28,14 +29,17 @@ func middleware(c *gin.Context) { attribute.Int("status_code", c.Writer.Status()), } + opt := metric.WithAttributes(attrs...) + elapsed := time.Since(startTime).Milliseconds() respSize := int64(c.Writer.Size()) - requestCounter.Add(c.Request.Context(), 1, attrs...) - requestDuration.Record(c.Request.Context(), elapsed, append(attrs, attribute.String("handler", c.HandlerName()))...) + ctx := c.Request.Context() + requestCounter.Add(ctx, 1, opt) + requestDuration.Record(ctx, elapsed, metric.WithAttributes(append(attrs, attribute.String("handler", c.HandlerName()))...)) - requestSize.Record(c.Request.Context(), reqSize, attrs...) - responseSize.Record(c.Request.Context(), respSize, attrs...) + requestSize.Record(ctx, reqSize, opt) + responseSize.Record(ctx, respSize, opt) } func computeApproximateRequestSize(r *http.Request) int64 { diff --git a/src/internal/observability/tracer/middleware.go b/src/internal/observability/tracer/middleware.go index 61ba0452..857dbf4e 100644 --- a/src/internal/observability/tracer/middleware.go +++ b/src/internal/observability/tracer/middleware.go @@ -10,7 +10,11 @@ import ( oteltrace "go.opentelemetry.io/otel/trace" ) -func Middleware(c *gin.Context) { +var Middleware = func(c *gin.Context) { + c.Next() +} + +func middleware(c *gin.Context) { savedCtx := c.Request.Context() defer func() { c.Request = c.Request.WithContext(savedCtx) diff --git a/src/internal/observability/tracer/tracer.go b/src/internal/observability/tracer/tracer.go index c7138626..275dfffe 100644 --- a/src/internal/observability/tracer/tracer.go +++ b/src/internal/observability/tracer/tracer.go @@ -4,6 +4,7 @@ import ( "context" "log" + "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/jaeger" @@ -42,6 +43,10 @@ func Setup(serviceName, url string) { ) otel.SetTracerProvider(tracerProvider) + + Middleware = otelgin.Middleware(serviceName, + otelgin.WithTracerProvider(tracerProvider), + ) } func Stop(ctx context.Context) {