Skip to content

Commit

Permalink
fix: upgrade kratos metrics example (#50)
Browse files Browse the repository at this point in the history
* fix: upgrade kratos metrics example

* Update main.go

* fix: go mod
  • Loading branch information
songzhibin97 authored Sep 6, 2024
1 parent 79c95e3 commit 0a29e8d
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 206 deletions.
8 changes: 4 additions & 4 deletions auth/jwt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/go-kratos/kratos/v2/middleware/auth/jwt"
"github.com/go-kratos/kratos/v2/transport/grpc"
"github.com/go-kratos/kratos/v2/transport/http"
jwtv4 "github.com/golang-jwt/jwt/v4"
jwtv5 "github.com/golang-jwt/jwt/v5"
)

type server struct {
Expand All @@ -27,15 +27,15 @@ func main() {
httpSrv := http.NewServer(
http.Address(":8000"),
http.Middleware(
jwt.Server(func(token *jwtv4.Token) (interface{}, error) {
jwt.Server(func(token *jwtv5.Token) (interface{}, error) {
return []byte(testKey), nil
}),
),
)
grpcSrv := grpc.NewServer(
grpc.Address(":9000"),
grpc.Middleware(
jwt.Server(func(token *jwtv4.Token) (interface{}, error) {
jwt.Server(func(token *jwtv5.Token) (interface{}, error) {
return []byte(testKey), nil
}),
),
Expand All @@ -45,7 +45,7 @@ func main() {
context.Background(),
grpc.WithEndpoint("dns:///127.0.0.1:9001"),
grpc.WithMiddleware(
jwt.Client(func(token *jwtv4.Token) (interface{}, error) {
jwt.Client(func(token *jwtv5.Token) (interface{}, error) {
return []byte(serviceTestKey), nil
}),
),
Expand Down
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,47 @@ require (
github.com/gin-gonic/gin v1.7.7
github.com/go-kratos/gin v0.1.0
github.com/go-kratos/kratos/contrib/config/apollo/v2 v2.0.0-20220309025117-4387085047b9
github.com/go-kratos/kratos/contrib/metrics/prometheus/v2 v2.0.0-20220309025117-4387085047b9
github.com/go-kratos/kratos/contrib/opensergo/v2 v2.0.0-20220517145828-c8c870b77f70
github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20220309025117-4387085047b9
github.com/go-kratos/kratos/contrib/registry/discovery/v2 v2.0.0-20220309025117-4387085047b9
github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20220309025117-4387085047b9
github.com/go-kratos/kratos/contrib/registry/eureka/v2 v2.0.0-20220330020930-99a0646acb98
github.com/go-kratos/kratos/contrib/registry/nacos/v2 v2.0.0-20220309025117-4387085047b9
github.com/go-kratos/kratos/contrib/registry/zookeeper/v2 v2.0.0-20220309025117-4387085047b9
github.com/go-kratos/kratos/v2 v2.7.1
github.com/go-kratos/kratos/v2 v2.8.0
github.com/go-kratos/swagger-api v1.0.0
github.com/go-redis/redis/extra/redisotel v0.3.0
github.com/go-redis/redis/v8 v8.11.2
github.com/go-sql-driver/mysql v1.6.0
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang-jwt/jwt/v5 v5.1.0
github.com/google/wire v0.5.0
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/gorilla/mux v1.8.1
github.com/gorilla/securecookie v1.1.1
github.com/gorilla/websocket v1.4.2
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0
github.com/hashicorp/consul/api v1.12.0
github.com/labstack/echo/v4 v4.6.3
github.com/nacos-group/nacos-sdk-go v1.0.9
github.com/nicksnyder/go-i18n/v2 v2.1.2
github.com/prometheus/client_golang v1.12.0
github.com/segmentio/kafka-go v0.4.27
github.com/sirupsen/logrus v1.8.1
github.com/soheilhy/cmux v0.1.4
github.com/xuri/excelize/v2 v2.6.1
go.etcd.io/etcd/client/v3 v3.5.1
go.mongodb.org/mongo-driver v1.10.3
go.opentelemetry.io/otel v1.23.1
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/exporters/jaeger v1.3.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.1
go.opentelemetry.io/otel/sdk v1.23.1
go.opentelemetry.io/otel/trace v1.23.1
go.opentelemetry.io/otel/metric v1.24.0
go.opentelemetry.io/otel/sdk v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
go.uber.org/zap v1.19.0
golang.org/x/text v0.14.0
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917
google.golang.org/grpc v1.61.0
google.golang.org/grpc v1.61.1
google.golang.org/grpc/examples v0.0.0-20220105183818-2fb1ac854b20 // indirect
google.golang.org/protobuf v1.32.0
google.golang.org/protobuf v1.33.0
gorm.io/driver/mysql v1.3.2
gorm.io/gorm v1.23.2
)
Loading

0 comments on commit 0a29e8d

Please sign in to comment.