Skip to content

Commit e7ab7c8

Browse files
committed
otel demo version
1 parent 1dbf0d7 commit e7ab7c8

34 files changed

+1249
-28
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ linters:
1717
- nakedret
1818
- nolintlint
1919
- revive
20+
- spancheck
2021
- staticcheck
2122
- stylecheck
2223
- tenv

go.mod

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ require (
109109
github.com/sassoftware/go-rpmutils v0.4.0
110110
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
111111
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92
112-
github.com/stretchr/testify v1.9.0
112+
github.com/stretchr/testify v1.10.0
113113
github.com/syndtr/goleveldb v1.0.0
114114
github.com/tstranex/u2f v1.0.0
115115
github.com/ulikunitz/xz v0.5.12
@@ -124,13 +124,13 @@ require (
124124
golang.org/x/crypto v0.31.0
125125
golang.org/x/image v0.21.0
126126
golang.org/x/net v0.33.0
127-
golang.org/x/oauth2 v0.23.0
127+
golang.org/x/oauth2 v0.24.0
128128
golang.org/x/sync v0.10.0
129129
golang.org/x/sys v0.28.0
130130
golang.org/x/text v0.21.0
131131
golang.org/x/tools v0.26.0
132-
google.golang.org/grpc v1.67.1
133-
google.golang.org/protobuf v1.35.1
132+
google.golang.org/grpc v1.68.1
133+
google.golang.org/protobuf v1.35.2
134134
gopkg.in/ini.v1 v1.67.0
135135
gopkg.in/yaml.v3 v3.0.1
136136
mvdan.cc/xurls/v2 v2.5.0
@@ -184,6 +184,7 @@ require (
184184
github.com/boombuler/barcode v1.0.2 // indirect
185185
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 // indirect
186186
github.com/caddyserver/zerossl v0.1.3 // indirect
187+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
187188
github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a // indirect
188189
github.com/cespare/xxhash/v2 v2.3.0 // indirect
189190
github.com/cloudflare/circl v1.5.0 // indirect
@@ -209,6 +210,8 @@ require (
209210
github.com/go-fed/httpsig v1.1.1-0.20201223112313-55836744818e // indirect
210211
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
211212
github.com/go-ini/ini v1.67.0 // indirect
213+
github.com/go-logr/logr v1.4.2 // indirect
214+
github.com/go-logr/stdr v1.2.2 // indirect
212215
github.com/go-openapi/analysis v0.23.0 // indirect
213216
github.com/go-openapi/errors v0.22.0 // indirect
214217
github.com/go-openapi/inflect v0.21.0 // indirect
@@ -236,6 +239,7 @@ require (
236239
github.com/gorilla/handlers v1.5.2 // indirect
237240
github.com/gorilla/mux v1.8.1 // indirect
238241
github.com/gorilla/securecookie v1.1.2 // indirect
242+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
239243
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
240244
github.com/hashicorp/errwrap v1.1.0 // indirect
241245
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@@ -279,6 +283,7 @@ require (
279283
github.com/prometheus/common v0.60.1 // indirect
280284
github.com/prometheus/procfs v0.15.1 // indirect
281285
github.com/rhysd/actionlint v1.7.3 // indirect
286+
github.com/riandyrn/otelchi v0.11.0 // indirect
282287
github.com/rivo/uniseg v0.4.7 // indirect
283288
github.com/rogpeppe/go-internal v1.13.1 // indirect
284289
github.com/rs/xid v1.6.0 // indirect
@@ -310,15 +315,23 @@ require (
310315
github.com/zeebo/blake3 v0.2.4 // indirect
311316
go.etcd.io/bbolt v1.3.11 // indirect
312317
go.mongodb.org/mongo-driver v1.17.1 // indirect
313-
go.opentelemetry.io/otel v1.31.0 // indirect
314-
go.opentelemetry.io/otel/trace v1.31.0 // indirect
318+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
319+
go.opentelemetry.io/otel v1.33.0 // indirect
320+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect
321+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 // indirect
322+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 // indirect
323+
go.opentelemetry.io/otel/metric v1.33.0 // indirect
324+
go.opentelemetry.io/otel/sdk v1.33.0 // indirect
325+
go.opentelemetry.io/otel/trace v1.33.0 // indirect
326+
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
315327
go.uber.org/atomic v1.11.0 // indirect
316328
go.uber.org/multierr v1.11.0 // indirect
317329
go.uber.org/zap v1.27.0 // indirect
318330
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
319331
golang.org/x/mod v0.21.0 // indirect
320332
golang.org/x/time v0.7.0 // indirect
321-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
333+
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
334+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
322335
gopkg.in/warnings.v0 v0.1.2 // indirect
323336
gopkg.in/yaml.v2 v2.4.0 // indirect
324337
)

go.sum

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ github.com/caddyserver/certmagic v0.21.4 h1:e7VobB8rffHv8ZZpSiZtEwnLDHUwLVYLWzWS
199199
github.com/caddyserver/certmagic v0.21.4/go.mod h1:swUXjQ1T9ZtMv95qj7/InJvWLXURU85r+CfG0T+ZbDE=
200200
github.com/caddyserver/zerossl v0.1.3 h1:onS+pxp3M8HnHpN5MMbOMyNjmTheJyWRaZYwn+YTAyA=
201201
github.com/caddyserver/zerossl v0.1.3/go.mod h1:CxA0acn7oEGO6//4rtrRjYgEoa4MFw/XofZnrYwGqG4=
202+
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
203+
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
202204
github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a h1:MISbI8sU/PSK/ztvmWKFcI7UGb5/HQT7B+i3a2myKgI=
203205
github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a/go.mod h1:2GxOXOlEPAMFPfp014mK1SWq8G8BN8o7/dfYqJrVGn8=
204206
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
@@ -335,6 +337,11 @@ github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
335337
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
336338
github.com/go-ldap/ldap/v3 v3.4.8 h1:loKJyspcRezt2Q3ZRMq2p/0v8iOurlmeXDPw6fikSvQ=
337339
github.com/go-ldap/ldap/v3 v3.4.8/go.mod h1:qS3Sjlu76eHfHGpUdWkAXQTw4beih+cHsco2jXlIXrk=
340+
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
341+
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
342+
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
343+
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
344+
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
338345
github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU=
339346
github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo=
340347
github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w=
@@ -468,6 +475,8 @@ github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/z
468475
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
469476
github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ=
470477
github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik=
478+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 h1:TmHmbvxPmaegwhDubVz0lICL0J5Ka2vwTzhoePEXsGE=
479+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0/go.mod h1:qztMSjm835F2bXf+5HKAPIS5qsmQDqZna/PgVt4rWtI=
471480
github.com/h2non/gock v1.2.0 h1:K6ol8rfrRkUOefooBC8elXoaNGYkpp7y2qcxGG6BzUE=
472481
github.com/h2non/gock v1.2.0/go.mod h1:tNhoxHYW2W42cYkYb1WqzdbYIieALC99kpYr7rH/BQk=
473482
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
@@ -711,6 +720,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6O
711720
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
712721
github.com/rhysd/actionlint v1.7.3 h1:WD919WuLYrSCwY8VGBqJBEuzyVEIL5viXmXqRRcKOVs=
713722
github.com/rhysd/actionlint v1.7.3/go.mod h1:rl+8ZoX1rqnbcMWKaTyOHmw08mmb/zlmG/Zu1fY47F4=
723+
github.com/riandyrn/otelchi v0.11.0 h1:x9MFoTgHcwCC2DdWkTEEZ2ZQFkbl6z7GXLQtTANN6Gk=
724+
github.com/riandyrn/otelchi v0.11.0/go.mod h1:FlBYmG9fBQu0jFRvZZrATP4mDvLX2H5gwELfpZvNlxY=
714725
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
715726
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
716727
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
@@ -791,6 +802,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
791802
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
792803
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
793804
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
805+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
806+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
794807
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM=
795808
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8=
796809
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
@@ -866,10 +879,28 @@ go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
866879
go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
867880
go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM=
868881
go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
882+
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
883+
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
869884
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
870885
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
886+
go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw=
887+
go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I=
888+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 h1:Vh5HayB/0HHfOQA7Ctx69E/Y/DcQSMPpKANYVMQ7fBA=
889+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0/go.mod h1:cpgtDBaqD/6ok/UG0jT15/uKjAY8mRA53diogHBg3UI=
890+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 h1:5pojmb1U1AogINhN3SurB+zm/nIcusopeBNp42f45QM=
891+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0/go.mod h1:57gTHJSE5S1tqg+EKsLPlTWhpHMsWlVmer+LA926XiA=
892+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 h1:wpMfgF8E1rkrT1Z6meFh1NDtownE9Ii3n3X2GJYjsaU=
893+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0/go.mod h1:wAy0T/dUbs468uOlkT31xjvqQgEVXv58BRFWEgn5v/0=
894+
go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ=
895+
go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M=
896+
go.opentelemetry.io/otel/sdk v1.33.0 h1:iax7M131HuAm9QkZotNHEfstof92xM+N8sr3uHXc2IM=
897+
go.opentelemetry.io/otel/sdk v1.33.0/go.mod h1:A1Q5oi7/9XaMlIWzPSxLRWOI8nG3FnzHJNbiENQuihM=
871898
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
872899
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
900+
go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s=
901+
go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck=
902+
go.opentelemetry.io/proto/otlp v1.4.0 h1:TA9WRvW6zMwP+Ssb6fLoUIuirti1gGbP28GcKG1jgeg=
903+
go.opentelemetry.io/proto/otlp v1.4.0/go.mod h1:PPBWZIP98o2ElSqI35IHfu7hIhSwvc5N38Jw8pXuGFY=
873904
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
874905
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
875906
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
@@ -936,6 +967,8 @@ golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
936967
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
937968
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
938969
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
970+
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
971+
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
939972
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
940973
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
941974
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -1036,10 +1069,17 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
10361069
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
10371070
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
10381071
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1072+
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y=
1073+
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q=
1074+
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08=
10391075
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI=
10401076
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
1077+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY=
1078+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
10411079
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
10421080
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
1081+
google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0=
1082+
google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw=
10431083
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
10441084
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
10451085
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -1050,6 +1090,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
10501090
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
10511091
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
10521092
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
1093+
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
1094+
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
10531095
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10541096
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10551097
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

modules/git/batch_reader.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ type WriteCloserError interface {
2828
// Run before opening git cat-file.
2929
// This is needed otherwise the git cat-file will hang for invalid repositories.
3030
func ensureValidGitRepository(ctx context.Context, repoPath string) error {
31+
ctx, span := tracer.Start(ctx, "EnsureValidGitRepository")
32+
defer span.End()
3133
stderr := strings.Builder{}
3234
err := NewCommand(ctx, "rev-parse").
3335
Run(&RunOpts{
@@ -42,6 +44,8 @@ func ensureValidGitRepository(ctx context.Context, repoPath string) error {
4244

4345
// catFileBatchCheck opens git cat-file --batch-check in the provided repo and returns a stdin pipe, a stdout reader and cancel function
4446
func catFileBatchCheck(ctx context.Context, repoPath string) (WriteCloserError, *bufio.Reader, func()) {
47+
ctx, span := tracer.Start(ctx, "CatFileBatchCheck")
48+
defer span.End()
4549
batchStdinReader, batchStdinWriter := io.Pipe()
4650
batchStdoutReader, batchStdoutWriter := io.Pipe()
4751
ctx, ctxCancel := context.WithCancel(ctx)
@@ -90,6 +94,8 @@ func catFileBatchCheck(ctx context.Context, repoPath string) (WriteCloserError,
9094
func catFileBatch(ctx context.Context, repoPath string) (WriteCloserError, *bufio.Reader, func()) {
9195
// We often want to feed the commits in order into cat-file --batch, followed by their trees and sub trees as necessary.
9296
// so let's create a batch stdin and stdout
97+
ctx, span := tracer.Start(ctx, "CatFileBatch")
98+
defer span.End()
9399
batchStdinReader, batchStdinWriter := io.Pipe()
94100
batchStdoutReader, batchStdoutWriter := nio.Pipe(buffer.New(32 * 1024))
95101
ctx, ctxCancel := context.WithCancel(ctx)

modules/git/blame.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ func (r *BlameReader) Close() error {
130130

131131
// CreateBlameReader creates reader for given repository, commit and file
132132
func CreateBlameReader(ctx context.Context, objectFormat ObjectFormat, repoPath string, commit *Commit, file string, bypassBlameIgnore bool) (*BlameReader, error) {
133+
ctx, span := tracer.Start(ctx, "CreateBlameReader")
134+
defer span.End()
133135
var ignoreRevsFile *string
134136
if DefaultFeatures().CheckVersionAtLeast("2.23") && !bypassBlameIgnore {
135137
ignoreRevsFile = tryCreateBlameIgnoreRevsFile(commit)

modules/git/command.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import (
2121
"code.gitea.io/gitea/modules/log"
2222
"code.gitea.io/gitea/modules/process"
2323
"code.gitea.io/gitea/modules/util"
24+
"go.opentelemetry.io/otel/attribute"
25+
"go.opentelemetry.io/otel/codes"
26+
semconv "go.opentelemetry.io/otel/semconv/v1.20.0"
27+
"go.opentelemetry.io/otel/trace"
2428
)
2529

2630
// TrustedCmdArgs returns the trusted arguments for git command.
@@ -275,6 +279,12 @@ func (c *Command) Run(opts *RunOpts) error {
275279
}
276280

277281
func (c *Command) run(skip int, opts *RunOpts) error {
282+
283+
_, span := tracer.Start(c.parentContext, c.args[c.globalArgsLength], trace.WithAttributes(
284+
semconv.ProcessCommand(c.prog), semconv.ProcessCommandArgs(c.args...),
285+
), trace.WithSpanKind(trace.SpanKindInternal))
286+
defer span.End()
287+
278288
if len(c.brokenArgs) != 0 {
279289
log.Error("git command is broken: %s, broken args: %s", c.LogString(), strings.Join(c.brokenArgs, " "))
280290
return ErrBrokenCommand
@@ -283,6 +293,8 @@ func (c *Command) run(skip int, opts *RunOpts) error {
283293
opts = &RunOpts{}
284294
}
285295

296+
span.SetAttributes(attribute.String("repo_path", opts.Dir))
297+
286298
// We must not change the provided options
287299
timeout := opts.Timeout
288300
if timeout <= 0 {
@@ -325,6 +337,7 @@ func (c *Command) run(skip int, opts *RunOpts) error {
325337
cmd.Stderr = opts.Stderr
326338
cmd.Stdin = opts.Stdin
327339
if err := cmd.Start(); err != nil {
340+
span.SetStatus(codes.Error, err.Error())
328341
return err
329342
}
330343

@@ -333,6 +346,7 @@ func (c *Command) run(skip int, opts *RunOpts) error {
333346
if err != nil {
334347
cancel()
335348
_ = cmd.Wait()
349+
span.SetStatus(codes.Error, err.Error())
336350
return err
337351
}
338352
}
@@ -355,6 +369,7 @@ func (c *Command) run(skip int, opts *RunOpts) error {
355369
}
356370

357371
if err != nil && ctx.Err() != context.DeadlineExceeded {
372+
span.SetStatus(codes.Error, err.Error())
358373
return err
359374
}
360375

modules/git/commit.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616

1717
"code.gitea.io/gitea/modules/log"
1818
"code.gitea.io/gitea/modules/util"
19+
"go.opentelemetry.io/otel/codes"
1920
)
2021

2122
// Commit represents a git commit.
@@ -432,6 +433,8 @@ func parseCommitFileStatus(fileStatus *CommitFileStatus, stdout io.Reader) {
432433

433434
// GetCommitFileStatus returns file status of commit in given repository.
434435
func GetCommitFileStatus(ctx context.Context, repoPath, commitID string) (*CommitFileStatus, error) {
436+
ctx, span := tracer.Start(ctx, "GetCommitFileStatus")
437+
defer span.End()
435438
stdout, w := io.Pipe()
436439
done := make(chan struct{})
437440
fileStatus := NewCommitFileStatus()
@@ -448,6 +451,7 @@ func GetCommitFileStatus(ctx context.Context, repoPath, commitID string) (*Commi
448451
})
449452
w.Close() // Close writer to exit parsing goroutine
450453
if err != nil {
454+
span.SetStatus(codes.Error, err.Error())
451455
return nil, ConcatenateError(err, stderr.String())
452456
}
453457

0 commit comments

Comments
 (0)