1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-12 02:28:05 +02:00
kratos/contrib/opensergo
2024-07-22 19:57:54 +08:00
..
go.mod deps: upgrade kratos version to v2.8.0 (#3378) 2024-07-22 19:57:54 +08:00
go.sum build(deps): bump golang.org/x/net in /contrib/opensergo (#3277) 2024-04-22 11:40:56 +08:00
opensergo_test.go fix: rectification of non-standard lint codes (#2746) 2023-03-21 15:33:08 +08:00
opensergo.go fix(contrib/opensergo): incorrect conversion between integer types (#3309) 2024-04-30 17:22:55 +08:00
README.md feat(contrib/opensergo): add opensergo reportMetadata fields (#1996) 2022-05-24 10:04:36 +08:00

OpenSergo

Usage

	osServer, err := opensergo.New(opensergo.WithEndpoint("localhost:9090"))
	if err != nil {
		panic("init opensergo error")
	}

	s := &server{}
	grpcSrv := grpc.NewServer(
		grpc.Address(":9000"),
		grpc.Middleware(
			recovery.Recovery(),
		),
	)
	helloworld.RegisterGreeterServer(grpcSrv, s)

	app := kratos.New(
		kratos.Name(Name),
		kratos.Server(
			grpcSrv,
		),
	)

	osServer.ReportMetadata(context.Background(), app)

	if err := app.Run(); err != nil {
		log.Fatal(err)
	}