From 19b583506310521f310565d27f66aeaf8479f652 Mon Sep 17 00:00:00 2001 From: Kevin Franklin Kim Date: Thu, 1 Oct 2026 10:00:21 +0200 Subject: [PATCH] feat: remove deprecated gotsrpc/v2 integarations --- integration/gotsrpc/go.mod | 78 ------ integration/gotsrpc/go.sum | 191 --------------- integration/gotsrpc/net/middleware/doc.go | 9 - .../gotsrpc/net/middleware/telemetry.go | 224 ------------------ semconv/doc.go | 3 +- semconv/gotsrpc.go | 63 ----- semconv/gotsrpcconv/doc.go | 7 - semconv/gotsrpcconv/example_test.go | 69 ------ semconv/gotsrpcconv/metric.go | 141 ----------- 9 files changed, 1 insertion(+), 784 deletions(-) delete mode 100644 integration/gotsrpc/net/middleware/doc.go delete mode 100644 integration/gotsrpc/net/middleware/telemetry.go delete mode 100644 semconv/gotsrpc.go delete mode 100644 semconv/gotsrpcconv/doc.go delete mode 100644 semconv/gotsrpcconv/example_test.go delete mode 100644 semconv/gotsrpcconv/metric.go diff --git a/integration/gotsrpc/go.mod b/integration/gotsrpc/go.mod index cc82d28e..4fd7e1e9 100644 --- a/integration/gotsrpc/go.mod +++ b/integration/gotsrpc/go.mod @@ -3,81 +3,3 @@ module github.com/foomo/keel/integration/gotsrpc go 1.27.0 replace github.com/foomo/keel => ../../ - -require ( - github.com/foomo/gotsrpc/v2 v2.16.2 - github.com/foomo/keel v0.31.0 - go.opentelemetry.io/otel v1.46.0 - go.opentelemetry.io/otel/metric v1.46.0 - go.uber.org/zap v1.28.0 -) - -require ( - github.com/avast/retry-go/v4 v4.7.0 // indirect - github.com/beorn7/perks v1.0.1 // indirect - github.com/cenkalti/backoff/v5 v5.0.3 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/ebitengine/purego v0.10.2 // indirect - github.com/fbiville/markdown-table-formatter v0.3.0 // indirect - github.com/felixge/httpsnoop v1.1.0 // indirect - github.com/foomo/go v0.17.1 // indirect - github.com/foomo/gostandards v0.3.0 // indirect - github.com/foomo/opentelemetry-go v0.4.0 // indirect - github.com/go-logr/logr v1.4.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-ole/go-ole v1.3.0 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/grafana/otel-profiling-go v0.6.0 // indirect - github.com/grafana/pyroscope-go v1.4.2 // indirect - github.com/grafana/pyroscope-go/godeltaprof v0.1.11 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 // indirect - github.com/klauspost/compress v1.20.1 // indirect - github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/philhofer/fwd v1.2.0 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6 // indirect - github.com/prometheus/client_golang v1.24.1 // indirect - github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.70.1 // indirect - github.com/prometheus/otlptranslator v1.0.0 // indirect - github.com/prometheus/procfs v0.21.1 // indirect - github.com/shirou/gopsutil/v4 v4.26.7 // indirect - github.com/sony/gobreaker v1.0.0 // indirect - github.com/tinylib/msgp v1.6.5 // indirect - github.com/tklauser/go-sysconf v0.4.0 // indirect - github.com/tklauser/numcpus v0.12.0 // indirect - github.com/ugorji/go/codec v1.3.1 // indirect - github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/contrib/bridges/otelzap v0.20.1 // indirect - go.opentelemetry.io/contrib/instrumentation/host v0.71.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 // indirect - go.opentelemetry.io/contrib/instrumentation/runtime v0.71.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.22.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.22.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.46.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.46.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.46.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.46.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.46.0 // indirect - go.opentelemetry.io/otel/exporters/prometheus v0.68.0 // indirect - go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.22.0 // indirect - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.46.0 // indirect - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.46.0 // indirect - go.opentelemetry.io/otel/log v0.22.0 // indirect - go.opentelemetry.io/otel/sdk v1.46.0 // indirect - go.opentelemetry.io/otel/sdk/log v0.22.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.46.0 // indirect - go.opentelemetry.io/otel/trace v1.46.0 // indirect - go.opentelemetry.io/proto/otlp v1.11.0 // indirect - go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.58.0 // indirect - golang.org/x/sys v0.48.0 // indirect - golang.org/x/text v0.42.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260819154853-08b0e4226688 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688 // indirect - google.golang.org/grpc v1.83.2 // indirect - google.golang.org/protobuf v1.36.12 // indirect -) diff --git a/integration/gotsrpc/go.sum b/integration/gotsrpc/go.sum index 936ec700..e69de29b 100644 --- a/integration/gotsrpc/go.sum +++ b/integration/gotsrpc/go.sum @@ -1,191 +0,0 @@ -github.com/avast/retry-go/v4 v4.7.0 h1:yjDs35SlGvKwRNSykujfjdMxMhMQQM0TnIjJaHB+Zio= -github.com/avast/retry-go/v4 v4.7.0/go.mod h1:ZMPDa3sY2bKgpLtap9JRUgk2yTAba7cgiFhqxY2Sg6Q= -github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= -github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/buger/jsonparser v1.1.2 h1:frqHqw7otoVbk5M8LlE/L7HTnIq2v9RX6EJ48i9AxJk= -github.com/buger/jsonparser v1.1.2/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= -github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= -github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/ebitengine/purego v0.10.2 h1:W809HbnvzAxgdm+aOvlSekrM16wGCdT/e76+9tS7gzE= -github.com/ebitengine/purego v0.10.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= -github.com/fbiville/markdown-table-formatter v0.3.0 h1:PIm1UNgJrFs8q1htGTw+wnnNYvwXQMMMIKNZop2SSho= -github.com/fbiville/markdown-table-formatter v0.3.0/go.mod h1:q89TDtSEVDdTaufgSbfHpNVdPU/bmfvqNkrC5HagmLY= -github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= -github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= -github.com/foomo/go v0.17.1 h1:tDrovWbh1dOzsBX19pII6nAPIECswhBmNSPEGBYNawY= -github.com/foomo/go v0.17.1/go.mod h1:Zz5aBFte6ayLEJ17n4L1bqYmEEja9xTeLKC0Z1wAy+0= -github.com/foomo/gostandards v0.3.0 h1:Ev88Tdu0+52UH/d0l2KcAWx542A13o42d++LSTG0DC4= -github.com/foomo/gostandards v0.3.0/go.mod h1:8hJ56tpyFAVwavs5FuUF3po7Bq7hOTkQ1+DzFi4GCWg= -github.com/foomo/gotsrpc/v2 v2.16.2 h1:b1LK4dUEq1wZw+SV9Vt8hIFwKA03JSwmbxhbCXrGdoU= -github.com/foomo/gotsrpc/v2 v2.16.2/go.mod h1:/YWfjIxp1CnkTZLOaMhqD/jj2tbHe6Goce7mbxuLb10= -github.com/foomo/opentelemetry-go v0.4.0 h1:UQneCUSokIYJXzFUKQSI8rlelbUuf6atgSZMhvD+Nzo= -github.com/foomo/opentelemetry-go v0.4.0/go.mod h1:R3Se/rc5FRAs4ThE6JQ9Oq3cOLo2MOsUzZLJxZquwxA= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= -github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -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.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= -github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grafana/otel-profiling-go v0.6.0 h1:W7lOZaJj4IJISXMcM1UBk3fJF3tzF2OD6MJBJaQp1H8= -github.com/grafana/otel-profiling-go v0.6.0/go.mod h1:cqLIDgNXlnzknJ0WLiEe+JPjZk2MZ4ftMdqRJRWj1ZM= -github.com/grafana/pyroscope-go v1.4.2 h1:0LW5HrUJXgGr9zF5gITP/HaFXN9/LsMiwlgVJAK75l0= -github.com/grafana/pyroscope-go v1.4.2/go.mod h1:Ej13Jr05rRJrjWvrrFhfh6gGYXtfibuukOs3Tl3Y7QQ= -github.com/grafana/pyroscope-go/godeltaprof v0.1.11 h1:el5LYpXissAiCKZ5/6yjlr6mhYVV6Cp5lahTocxraXM= -github.com/grafana/pyroscope-go/godeltaprof v0.1.11/go.mod h1:jl1V8M4cWsXciROCPIDDG7CtjSjT/ECbp6eLVuMxYRI= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 h1:/Tnpcb2E0Pz/tN9s3bfEY2Q8ePCEX9iuS+cneUwncnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0/go.mod h1:zOBXOsUaBSjKgmH4OGzV1esUpR3oUSCPYVd2cUBjKYY= -github.com/invopop/jsonschema v0.14.0 h1:MHQqLhvpNUZfw+hM3AZDYK7jxO8FZoQeQM77g8iyZjg= -github.com/invopop/jsonschema v0.14.0/go.mod h1:ygm6C2EaVNMBDPpaPlnOA2pFAxBnxGjFlMZABxm9n2I= -github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ= -github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5 h1:eveIIGn4BGM3qknO74omf6HYr30/exH+eVUTuAgwjZ0= -github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/pb33f/ordered-map/v2 v2.3.1 h1:5319HDO0aw4DA4gzi+zv4FXU9UlSs3xGZ40wcP1nBjY= -github.com/pb33f/ordered-map/v2 v2.3.1/go.mod h1:qxFQgd0PkVUtOMCkTapqotNgzRhMPL7VvaHKbd1HnmQ= -github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= -github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6 h1:jL3a8soXdzuTCcRnKhOmtcsVOObdDTFf4O2B403HPRU= -github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU= -github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE= -github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= -github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi/PY= -github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc= -github.com/prometheus/otlptranslator v1.0.0 h1:s0LJW/iN9dkIH+EnhiD3BlkkP5QVIUVEoIwkU+A6qos= -github.com/prometheus/otlptranslator v1.0.0/go.mod h1:vRYWnXvI6aWGpsdY/mOT/cbeVRBlPWtBNDb7kGR3uKM= -github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI= -github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY= -github.com/shirou/gopsutil/v4 v4.26.7 h1:IXzpHz/dkMRYAhKkOXr1HB6SuzWU3eoyyeWe7g3bNZc= -github.com/shirou/gopsutil/v4 v4.26.7/go.mod h1:5O9FjBiXoTDFatIWjZZosqj4pV0DRtLx598xGbBehzM= -github.com/sony/gobreaker v1.0.0 h1:feX5fGGXSl3dYd4aHZItw+FpHLvvoaqkawKjVNiFMNQ= -github.com/sony/gobreaker v1.0.0/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= -github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= -github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= -github.com/tinylib/msgp v1.6.5 h1:iAH6XTP7BpzErjBZlujJQXxA+GmRi2YWs6M4KdLtNbE= -github.com/tinylib/msgp v1.6.5/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= -github.com/tklauser/go-sysconf v0.4.0 h1:7H0uAN+7RkwWRaxhYXDLqa5V3LPrJeV8wmD9dRUgPQU= -github.com/tklauser/go-sysconf v0.4.0/go.mod h1:8mTNWyog7H+MpKijp4VmKJAd2bbYQ2zuUwkYRbUArPI= -github.com/tklauser/numcpus v0.12.0 h1:NR85qdvHA9pFse3x3weVZ0r0ST8R6l5RHbZrlRaqob4= -github.com/tklauser/numcpus v0.12.0/go.mod h1:ABHeXzJnr/qqwguhClkZKT1/8VABcYrsyUiUGobwWJg= -github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY= -github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= -github.com/valyala/gorpc v0.0.0-20160519171614-908281bef774 h1:SUHFQHAaySqF0YHCmmm0EIFooFZpDPpi5KTom7YJ07c= -github.com/valyala/gorpc v0.0.0-20160519171614-908281bef774/go.mod h1:8uNqM1i7pr0jO7gdvbNCgsSa8Ki2vMh7JCQxO9BlF90= -github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= -github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= -go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/contrib/bridges/otelzap v0.20.1 h1:piZS6uocc7ODKtb9Fq2ayIVOT+N8jfvWhfoA9QTxef4= -go.opentelemetry.io/contrib/bridges/otelzap v0.20.1/go.mod h1:FfAgLPYhn6ZhkVFzS2BOAnJF0IAAw7GJUVB+ZVtMSyo= -go.opentelemetry.io/contrib/instrumentation/host v0.71.0 h1:w4LFwIdxvbuLJFS4GgUSKkMocKYGE61DJ5Rr+vW3Lfs= -go.opentelemetry.io/contrib/instrumentation/host v0.71.0/go.mod h1:3bLYpeWrDSzFnG5Hvuz7EON6f+ZbcRo/NriKeIXh72E= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 h1:3g7B90UzBltIDKq1/5mrTGxTnOFDV0ICOhLoxiZ8jlg= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0/go.mod h1:Ef8SuTh59BT7+ofpDxN9z+yOlc4t2GjLmKDgYNJL/NU= -go.opentelemetry.io/contrib/instrumentation/runtime v0.71.0 h1:v4KkRLVvE1cWqTJDfZZkTCG+Z4aolsa6RVos0FX7vqE= -go.opentelemetry.io/contrib/instrumentation/runtime v0.71.0/go.mod h1:g/xbuPC0XbgwMdKuyF5sKOUUEsorSkN6APydyFP/H9E= -go.opentelemetry.io/otel v1.46.0 h1:FHt5/CDyVxi/8IM1CH7VE/rRgq3kLHa2mSTVMO8AWyc= -go.opentelemetry.io/otel v1.46.0/go.mod h1:Gj3SEScelsNC45tp4nSxRYlS+f5iez7W8XPMCt905kE= -go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.22.0 h1:Bu39F5tzJct+f2IZbB8989fwyTps3c8e7EsUQsz+vs8= -go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.22.0/go.mod h1:dJUwod88EsFgYCqrDHaSPzhiY9pBUpt0d85/qSfua7k= -go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.22.0 h1:lYk7RmxdLK865qLwibroNGldHa1U7SWKYYvNjlK7PIo= -go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.22.0/go.mod h1:6GvlND0H0xdUJanOtIAn0xfwLkauh1tmsYEEVSMDdqY= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.46.0 h1:qkDYCAFiZXLcs1L4aY+tP2wguQ4kURANqHOQMA2et2s= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.46.0/go.mod h1:tkipS4DRzmpAmvg+Gw4++O1IdDq6TVDnvnYU6cmbQVs= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.46.0 h1:AP23h/mFgb/lc7tdck1Kfn9qxsM8TAeNPCU5C3pzaps= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.46.0/go.mod h1:K4EqCe1b4kGk5WR690ntg9LaBfsPoV32FwthbyoptuA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.46.0 h1:OFnwLJr+pF3iHrlGSzbxyuo6/6HyBlnlN1CWEJmBVcw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.46.0/go.mod h1:716wFneO0ov19A2beH5hjfh9AK5z/VWNAtDijp1Y0/g= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.46.0 h1:w53CDeOA/Kurp7yRsegSr6pbbr759dOvJ+yNmWM6Hxs= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.46.0/go.mod h1:BOmGMCbAtvcJiSJ+hLuhgPLdDbimnraSl8irz3iY8sY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.46.0 h1:KrC1YrQeSt46ITMWAbgQx1M1eV1/1TKzttrBzymPmss= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.46.0/go.mod h1:zDSEzoEqsOrgBeGvH66KRgxh90VonFyJqBHA0Pk3+rM= -go.opentelemetry.io/otel/exporters/prometheus v0.68.0 h1:QOf2IftqQwITVRJpnn0M7M9ZCbgWfxz4P7i9C9yc2N4= -go.opentelemetry.io/otel/exporters/prometheus v0.68.0/go.mod h1:bgSvqu2TWGXiz7yr5UTMfObH8oqxJWHTnubQ3ef9BO4= -go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.22.0 h1:kvMAiLEudKmk+CSG+iYbU8vTUGNNDaf/V09OO5lrTwI= -go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.22.0/go.mod h1:L9Dlksri+MdT1cb2gIiA1cJJYW3Y92ipvDjNxYEyaDI= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.46.0 h1:PR9eAf7o0dQs3hshZNZpE9aW2dXWX/KdDf6pJilVD3U= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.46.0/go.mod h1:2Z4KyNdH1uuzivdinyfGsxzNNT/Rl45pwtVwfYVI0xk= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.46.0 h1:KdRxPiAoMptR3vfWzvjjvutTsSiwbC2uG0496rzZNfo= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.46.0/go.mod h1:K/qSA+3G7Eovxi4K09wzrAgkWRnosS0DAOZeEpve7sM= -go.opentelemetry.io/otel/log v0.22.0 h1:5DBNnfvaJ6CVdkJ+Jle8Tzs50aSSv49TXGj9XRsEYw0= -go.opentelemetry.io/otel/log v0.22.0/go.mod h1:gzOt/R67vF2GniAqWu8Qv0SXy89f71muHcrkz76PCdc= -go.opentelemetry.io/otel/log/logtest v0.22.0 h1:0pvI8BwoRN7c0KVXqzSdZQgkFdsNBL/aokbSp3boQec= -go.opentelemetry.io/otel/log/logtest v0.22.0/go.mod h1:9+PjkCcSiKB2CEn3LYZ6Y3c37KJs7fziPXNiuyQGmRQ= -go.opentelemetry.io/otel/metric v1.46.0 h1:yBnkXvgV7AXFILZc5K6IZe/CBFF3OS7BJ8ov6/lj0K8= -go.opentelemetry.io/otel/metric v1.46.0/go.mod h1:iPmdWqifKUdzziPkvvzIJXITl56fQx2mGM/DHLB3/2o= -go.opentelemetry.io/otel/metric/x v0.68.0 h1:TA/cBT23D3MnxYPwHL7YFOdYGdx0A0v+s7Mzotpd1dU= -go.opentelemetry.io/otel/metric/x v0.68.0/go.mod h1:agudOmvWhwUTjgibWDzxD2PoWYnpw5Ht5jISYOD2Hd4= -go.opentelemetry.io/otel/sdk v1.46.0 h1:h5CNQQjEbuQXY/JfZtgt3i7HVFV3aHPO2OAwO2eTYPI= -go.opentelemetry.io/otel/sdk v1.46.0/go.mod h1:GAERFXFt5SYCEB+YiKUbMBeza6UaDH7GmGOZEfh2gSM= -go.opentelemetry.io/otel/sdk/log v0.22.0 h1:PRL+s6P63XT4E/bheEflopPUpVxuvANqZwtt89yhoGk= -go.opentelemetry.io/otel/sdk/log v0.22.0/go.mod h1:JNp0sBELrjCTcu5W3GzABVypeU6vDJjBS+X0JISuz+g= -go.opentelemetry.io/otel/sdk/log/logtest v0.22.0 h1:infPnfNrhCNgOUZRs3gWUg8vhoBUHihq02gwK05gzlg= -go.opentelemetry.io/otel/sdk/log/logtest v0.22.0/go.mod h1:gkQZA3z15Bv3KU9vigBTi8dFechSozRP7v94X4VZv+s= -go.opentelemetry.io/otel/sdk/metric v1.46.0 h1:0piZ26EG4RBfebb2jhDH6ERCYHoVWduc3kLgPCwSnSE= -go.opentelemetry.io/otel/sdk/metric v1.46.0/go.mod h1:I1PbKrdVc8Qu8HYVDNtqVIwLwjNrhsV/uFuxfwg8mO4= -go.opentelemetry.io/otel/trace v1.46.0 h1:OULy7ccdJnZtJ0UDYFOIGaCmiWzJ8Vi2G/Rsu60qs1c= -go.opentelemetry.io/otel/trace v1.46.0/go.mod h1:J7GAXweO77XSFkB/rmAqk9D6ihszhFjLU+d9WuUxDLI= -go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= -go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= -go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= -go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= -go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= -go.yaml.in/yaml/v4 v4.0.0-rc.2 h1:/FrI8D64VSr4HtGIlUtlFMGsm7H7pWTbj6vOLVZcA6s= -go.yaml.in/yaml/v4 v4.0.0-rc.2/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= -golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= -golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= -golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= -gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= -gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= -google.golang.org/genproto/googleapis/api v0.0.0-20260819154853-08b0e4226688 h1:ax2KzoSRIZU/M0cIxri3pKxy99vniH1PVxWC6si/eZI= -google.golang.org/genproto/googleapis/api v0.0.0-20260819154853-08b0e4226688/go.mod h1:1RJ9BQGyNdZwkGc1eTqkErfRZ6RJyYPHZo73BZ1vQqI= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688 h1:cYNAzI2sUwhmCcoj9TxvihSrqsxt6uIkj3rDRhSDmW4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688/go.mod h1:DjtHYE8FKJLivXcBEjGwndXfIC23G0VpXiXKqG179uA= -google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU= -google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8= -google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= -google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/integration/gotsrpc/net/middleware/doc.go b/integration/gotsrpc/net/middleware/doc.go deleted file mode 100644 index 70041896..00000000 --- a/integration/gotsrpc/net/middleware/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Package keelgotsrpcmiddleware provides HTTP middleware that adds gotsrpc -// call telemetry to keel HTTP services. -// -// [Telemetry] renames the active span after the called gotsrpc service and -// function, annotates it and the request logger with gotsrpc attributes and -// records the execution duration metric defined in -// [github.com/foomo/keel/semconv/gotsrpcconv]. The middleware is deprecated -// in favor of gotsrpc v3, which includes OpenTelemetry instrumentation. -package keelgotsrpcmiddleware diff --git a/integration/gotsrpc/net/middleware/telemetry.go b/integration/gotsrpc/net/middleware/telemetry.go deleted file mode 100644 index 429af600..00000000 --- a/integration/gotsrpc/net/middleware/telemetry.go +++ /dev/null @@ -1,224 +0,0 @@ -package keelgotsrpcmiddleware - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "net/http" - - "github.com/foomo/gotsrpc/v2" - "github.com/foomo/keel/env" - "github.com/foomo/keel/log" - keelhttp "github.com/foomo/keel/net/http" - httplog "github.com/foomo/keel/net/http/log" - keelsemconv "github.com/foomo/keel/semconv" - "github.com/foomo/keel/semconv/gotsrpcconv" - "github.com/foomo/keel/telemetry" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/metric" - semconv "go.opentelemetry.io/otel/semconv/v1.41.0" - "go.uber.org/zap" -) - -type ( - // TelemetryOptions configures the [Telemetry] middleware. - TelemetryOptions struct { - meter metric.Meter - bucketBoundaries []float64 - // PayloadAttributeDisabled reports whether the request payload is - // omitted from the span attributes. - PayloadAttributeDisabled bool - } - // TelemetryOption modifies [TelemetryOptions]. - TelemetryOption func(*TelemetryOptions) -) - -// DefaultTelemetryOptions returns the default options: the keel meter, -// histogram buckets from 5ms to 10s and the payload attribute disabled unless -// OTEL_GOTSRPC_PAYLOAD_ATTRIBUTE_DISABLED is false. -func DefaultTelemetryOptions() TelemetryOptions { - return TelemetryOptions{ - meter: telemetry.Meter(), - bucketBoundaries: []float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}, - PayloadAttributeDisabled: env.GetBool("OTEL_GOTSRPC_PAYLOAD_ATTRIBUTE_DISABLED", true), - } -} - -// TelemetryWithExemplarsDisabled has no effect. -// -// Deprecated: Exemplars are not configurable. -func TelemetryWithExemplarsDisabled(v bool) TelemetryOption { - return func(o *TelemetryOptions) { - } -} - -// TelemetryWithObserveExecution has no effect. -// -// Deprecated: Execution is always observed. -func TelemetryWithObserveExecution(v bool) TelemetryOption { - return func(o *TelemetryOptions) { - } -} - -// TelemetryWithObserveMarshalling has no effect. -// -// Deprecated: Marshalling is not observed as a separate metric. -func TelemetryWithObserveMarshalling(v bool) TelemetryOption { - return func(o *TelemetryOptions) { - } -} - -// TelemetryWithObserveUnmarshalling has no effect. -// -// Deprecated: Unmarshalling is not observed as a separate metric. -func TelemetryWithObserveUnmarshalling(v bool) TelemetryOption { - return func(o *TelemetryOptions) { - } -} - -// TelemetryWithBucketBoundries sets the explicit bucket boundaries, in -// seconds, of the execution duration histogram. -func TelemetryWithBucketBoundries(v []float64) TelemetryOption { - return func(o *TelemetryOptions) { - o.bucketBoundaries = v - } -} - -// TelemetryWithPayloadAttributeDisabled sets whether the request payload is -// omitted from the span attributes. Defaults to true. -func TelemetryWithPayloadAttributeDisabled(v bool) TelemetryOption { - return func(o *TelemetryOptions) { - o.PayloadAttributeDisabled = v - } -} - -// Telemetry returns a middleware configured by [DefaultTelemetryOptions] and -// opts; see [TelemetryWithOptions]. Nil options are skipped. -// -// Deprecated: Use gotsrpc v3, which includes OpenTelemetry instrumentation. -func Telemetry(opts ...TelemetryOption) keelhttp.Middleware { - options := DefaultTelemetryOptions() - - for _, opt := range opts { - if opt != nil { - opt(&options) - } - } - - return TelemetryWithOptions(options) -} - -// TelemetryWithOptions returns a middleware that, after a gotsrpc call has -// been handled, renames the active span to "/", adds gotsrpc -// attributes and error details to the span and the request log labeler, and -// records the execution duration. -// -// Deprecated: Use gotsrpc v3, which includes OpenTelemetry instrumentation. -func TelemetryWithOptions(opts TelemetryOptions) keelhttp.Middleware { - m, err := gotsrpcconv.NewExecutionDuration( - opts.meter, - metric.WithExplicitBucketBoundaries(opts.bucketBoundaries...), - ) - if err != nil { - otel.Handle(err) - } - - sanitizePayload := func(r *http.Request) string { - if r.Method != http.MethodPost { - return "" - } - - body, err := io.ReadAll(r.Body) - if err != nil { - return "" - } - - if err := r.Body.Close(); err != nil { - return "" - } - - r.Body = io.NopCloser(bytes.NewBuffer(body)) - - var out bytes.Buffer - if err = json.Indent(&out, body, "", " "); err != nil { - return "" - } - - return out.String() - } - - return func(l *zap.Logger, name string, next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - *r = *gotsrpc.RequestWithStatsContext(r) - sp := telemetry.SpanFromContext(r.Context()) - - sp.AddEvent("GOTSRPC Telemetry") - - next.ServeHTTP(w, r) - - if stats, ok := gotsrpc.GetStatsForRequest(r); ok { - if !opts.PayloadAttributeDisabled { - sp.SetAttributes(keelsemconv.GoTSRPCPayload(sanitizePayload(r))) - } - - // override span name - sp.SetName(fmt.Sprintf("%s/%s", stats.Service, stats.Func)) - - // define default attributes - attrs := []attribute.KeyValue{ - semconv.RPCSystemNameKey.String("gotsrpc"), - keelsemconv.GoTSRPCFunc(stats.Func), - keelsemconv.GoTSRPCService(stats.Service), - keelsemconv.GoTSRPCPackage(stats.Package), - } - - // add trace attributes - sp.SetAttributes(append(attrs, - keelsemconv.GoTSRPCMarshalling(stats.Marshalling.Milliseconds()), - keelsemconv.GoTSRPCUnmarshalling(stats.Unmarshalling.Milliseconds()), - )...) - - if stats.ErrorCode != 0 { - sp.SetStatus(codes.Error, stats.ErrorMessage) - sp.SetAttributes(keelsemconv.GoTSRPCErrorCode(stats.ErrorCode)) - } - - if stats.ErrorType != "" { - sp.SetAttributes(keelsemconv.GoTSRPCErrorType(stats.ErrorType)) - } - - if stats.ErrorMessage != "" { - sp.SetAttributes(keelsemconv.GoTSRPCErrorMessage(stats.ErrorMessage)) - } - - m.Record(r.Context(), - stats.Execution.Seconds(), - stats.Package, - stats.Service, - stats.Func, - m.AttrError(stats.ErrorCode != 0), - ) - - // enrich logger - if labeler, ok := httplog.LabelerFromRequest(r); ok { - labeler.Add(log.Attributes(attrs...)...) - - if stats.ErrorCode != 0 { - labeler.Add(log.Attribute(keelsemconv.GoTSRPCErrorCode(stats.ErrorCode))) - } - - if stats.ErrorType != "" { - labeler.Add(log.Attribute(keelsemconv.GoTSRPCErrorType(stats.ErrorType))) - } - - if stats.ErrorMessage != "" { - labeler.Add(log.Attribute(keelsemconv.GoTSRPCErrorMessage(stats.ErrorMessage))) - } - } - } - }) - } -} diff --git a/semconv/doc.go b/semconv/doc.go index 2bf643cc..9c5c7568 100644 --- a/semconv/doc.go +++ b/semconv/doc.go @@ -5,6 +5,5 @@ // [go.opentelemetry.io/otel/attribute.Key] constant (for example // [KeelServiceNameKey]) and a constructor returning a // [go.opentelemetry.io/otel/attribute.KeyValue] (for example -// [KeelServiceName]). Attributes cover keel services, debug state and gotsrpc -// calls. +// [KeelServiceName]). Attributes cover keel services and debug state. package semconv diff --git a/semconv/gotsrpc.go b/semconv/gotsrpc.go deleted file mode 100644 index 3abf8046..00000000 --- a/semconv/gotsrpc.go +++ /dev/null @@ -1,63 +0,0 @@ -package semconv - -import ( - "go.opentelemetry.io/otel/attribute" -) - -// Attribute keys for gotsrpc calls. -const ( - GoTSRPCFuncKey = attribute.Key("gotsrpc.func") - GoTSRPCServiceKey = attribute.Key("gotsrpc.service") - GoTSRPCPackageKey = attribute.Key("gotsrpc.package") - GoTSRPCMarshallingKey = attribute.Key("gotsrpc.marshalling") - GoTSRPCUnmarshallingKey = attribute.Key("gotsrpc.unmarshalling") - GoTSRPCPayloadKey = attribute.Key("gotsrpc.payload") - GoTSRPCErrorCodeKey = attribute.Key("gotsrpc.error.code") - GoTSRPCErrorMessageKey = attribute.Key("gotsrpc.error.message") - GoTSRPCErrorTypeKey = attribute.Key("gotsrpc.error.type") -) - -// GoTSRPCFunc returns a new attribute.KeyValue for gotsrpc.func. -func GoTSRPCFunc(v string) attribute.KeyValue { - return GoTSRPCFuncKey.String(v) -} - -// GoTSRPCService returns a new attribute.KeyValue for gotsrpc.service. -func GoTSRPCService(v string) attribute.KeyValue { - return GoTSRPCServiceKey.String(v) -} - -// GoTSRPCPackage returns a new attribute.KeyValue for gotsrpc.package. -func GoTSRPCPackage(v string) attribute.KeyValue { - return GoTSRPCPackageKey.String(v) -} - -// GoTSRPCMarshalling returns a new attribute.KeyValue for gotsrpc.marshalling. -func GoTSRPCMarshalling(v int64) attribute.KeyValue { - return GoTSRPCMarshallingKey.Int64(v) -} - -// GoTSRPCUnmarshalling returns a new attribute.KeyValue for gotsrpc.unmarshalling. -func GoTSRPCUnmarshalling(v int64) attribute.KeyValue { - return GoTSRPCUnmarshallingKey.Int64(v) -} - -// GoTSRPCPayload returns a new attribute.KeyValue for gotsrpc.payload. -func GoTSRPCPayload(v string) attribute.KeyValue { - return GoTSRPCPayloadKey.String(v) -} - -// GoTSRPCErrorCode returns a new attribute.KeyValue for gotsrpc.error.code. -func GoTSRPCErrorCode(v int) attribute.KeyValue { - return GoTSRPCErrorCodeKey.Int(v) -} - -// GoTSRPCErrorMessage returns a new attribute.KeyValue for gotsrpc.error.message. -func GoTSRPCErrorMessage(v string) attribute.KeyValue { - return GoTSRPCErrorMessageKey.String(v) -} - -// GoTSRPCErrorType returns a new attribute.KeyValue for gotsrpc.error.type. -func GoTSRPCErrorType(v string) attribute.KeyValue { - return GoTSRPCErrorTypeKey.String(v) -} diff --git a/semconv/gotsrpcconv/doc.go b/semconv/gotsrpcconv/doc.go deleted file mode 100644 index 6316d161..00000000 --- a/semconv/gotsrpcconv/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// Package gotsrpcconv provides typed OpenTelemetry metric instruments for -// gotsrpc semantic conventions. -// -// [NewExecutionDuration] creates the "gotsrpc.execution.duration" histogram, -// recorded in seconds and labeled with the gotsrpc package, service and -// function. A nil meter yields a no-op instrument. -package gotsrpcconv diff --git a/semconv/gotsrpcconv/example_test.go b/semconv/gotsrpcconv/example_test.go deleted file mode 100644 index 0e0f735b..00000000 --- a/semconv/gotsrpcconv/example_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package gotsrpcconv_test - -import ( - "context" - "fmt" - - "github.com/foomo/keel/semconv/gotsrpcconv" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/noop" -) - -func ExampleNewExecutionDuration() { - // Create an ExecutionDuration instrument from a meter. - meter := noop.NewMeterProvider().Meter("example") - - duration, err := gotsrpcconv.NewExecutionDuration(meter) - if err != nil { - panic(err) - } - - // Record a 150ms execution. - duration.Record(context.Background(), 0.150, "mypackage", "MyService", "MyFunc") - - fmt.Println(duration.Name()) - fmt.Println(duration.Unit()) - fmt.Println(duration.Description()) - - // Output: - // gotsrpc.execution.duration - // s - // Duration of GOTSRPC execution. -} - -func ExampleExecutionDuration_AttrError() { - duration, _ := gotsrpcconv.NewExecutionDuration(nil) - - attr := duration.AttrError(true) - fmt.Println(attr.Key) - fmt.Println(attr.Value.AsBool()) - - // Record with error attribute. - duration.Record( - context.Background(), - 0.250, - "mypackage", "MyService", "MyFunc", - attr, - ) - - // Output: - // gotsrpc.error - // true -} - -func ExampleNewExecutionDuration_nilMeter() { - // Passing a nil meter returns a safe no-op instrument. - duration, err := gotsrpcconv.NewExecutionDuration(nil) - if err != nil { - panic(err) - } - - // Recording is a no-op but does not panic. - duration.Record(context.Background(), 0.100, "pkg", "Svc", "Fn") - duration.RecordSet(context.Background(), 0.200, attribute.NewSet()) - - fmt.Println("ok") - - // Output: - // ok -} diff --git a/semconv/gotsrpcconv/metric.go b/semconv/gotsrpcconv/metric.go deleted file mode 100644 index 4750de48..00000000 --- a/semconv/gotsrpcconv/metric.go +++ /dev/null @@ -1,141 +0,0 @@ -package gotsrpcconv - -import ( - "context" - "sync" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" -) - -// recOptPool pools record option slices to avoid allocations per record. -var ( - // addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} - recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} -) - -// ExecutionDuration is an instrument used to record metric values conforming -// to the "gotsrpc.execution.duration" semantic conventions. It represents the -// duration of GOTSRPC execution. -type ExecutionDuration struct { - metric.Float64Histogram -} - -// newExecutionDurationOpts are the histogram options appended to every -// [NewExecutionDuration] call. -var newExecutionDurationOpts = []metric.Float64HistogramOption{ - metric.WithDescription("Duration of GOTSRPC execution."), - metric.WithUnit("s"), -} - -// NewExecutionDuration returns a new ExecutionDuration instrument created -// with m and opt. If m is nil, a no-op instrument is returned. On error, the -// returned instrument is a no-op. -func NewExecutionDuration( - m metric.Meter, - opt ...metric.Float64HistogramOption, -) (ExecutionDuration, error) { - // Check if the meter is nil. - if m == nil { - return ExecutionDuration{noop.Float64Histogram{}}, nil - } - - if len(opt) == 0 { - opt = newExecutionDurationOpts - } else { - opt = append(opt, newExecutionDurationOpts...) - } - - i, err := m.Float64Histogram( - "gotsrpc.execution.duration", - opt..., - ) - if err != nil { - return ExecutionDuration{noop.Float64Histogram{}}, err - } - - return ExecutionDuration{i}, nil -} - -// Inst returns the underlying metric instrument. -func (m ExecutionDuration) Inst() metric.Float64Histogram { - return m.Float64Histogram -} - -// Name returns the semantic convention name of the instrument. -func (ExecutionDuration) Name() string { - return "gotsrpc.execution.duration" -} - -// Unit returns the semantic convention unit of the instrument. -func (ExecutionDuration) Unit() string { - return "s" -} - -// Description returns the semantic convention description of the instrument. -func (ExecutionDuration) Description() string { - return "Duration of GOTSRPC execution." -} - -// Record records val, in seconds, labeled with the gotsrpc package pkg, -// service svs, function fnc and attrs. If attrs is empty, val is recorded -// without any attributes, including pkg, svs and fnc. -func (m ExecutionDuration) Record( - ctx context.Context, - val float64, - pkg string, - svs string, - fnc string, - attrs ...attribute.KeyValue, -) { - if len(attrs) == 0 { - m.Float64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) //nolint:forcetypeassert - - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append( - *o, - metric.WithAttributes( - append( - attrs, - attribute.String("gotsrpc.package", pkg), - attribute.String("gotsrpc.service", svs), - attribute.String("gotsrpc.func", fnc), - )..., - ), - ) - - m.Float64Histogram.Record(ctx, val, *o...) -} - -// RecordSet records val to the current distribution for set. -func (m ExecutionDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { - if set.Len() == 0 { - m.Float64Histogram.Record(ctx, val) - return - } - - o := recOptPool.Get().(*[]metric.RecordOption) //nolint:forcetypeassert - - defer func() { - *o = (*o)[:0] - recOptPool.Put(o) - }() - - *o = append(*o, metric.WithAttributeSet(set)) - m.Float64Histogram.Record(ctx, val, *o...) -} - -// AttrError returns an optional attribute for the "gotsrpc.error" semantic -// convention, reporting whether the call failed. -func (ExecutionDuration) AttrError(val bool) attribute.KeyValue { - return attribute.Bool("gotsrpc.error", val) -}