-
Notifications
You must be signed in to change notification settings - Fork 3
/
module.go
50 lines (45 loc) · 1.45 KB
/
module.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package transport
import (
"github.com/alexfalkowski/go-service/transport/grpc"
gprometheus "github.com/alexfalkowski/go-service/transport/grpc/metrics/prometheus"
gotel "github.com/alexfalkowski/go-service/transport/grpc/otel"
"github.com/alexfalkowski/go-service/transport/http"
hprometheus "github.com/alexfalkowski/go-service/transport/http/metrics/prometheus"
hotel "github.com/alexfalkowski/go-service/transport/http/otel"
"github.com/alexfalkowski/go-service/transport/nsq/marshaller"
nprometheus "github.com/alexfalkowski/go-service/transport/nsq/metrics/prometheus"
notel "github.com/alexfalkowski/go-service/transport/nsq/otel"
"go.uber.org/fx"
)
var (
// GRPCModule for fx.
GRPCModule = fx.Options(
fx.Provide(grpc.NewServer),
fx.Provide(grpc.UnaryServerInterceptor),
fx.Provide(grpc.StreamServerInterceptor),
fx.Provide(gprometheus.NewServerMetrics),
fx.Provide(gprometheus.NewClientMetrics),
fx.Provide(gotel.NewTracer),
)
// HTTPModule for fx.
HTTPModule = fx.Options(
fx.Provide(http.NewServer),
fx.Provide(hprometheus.NewServerMetrics),
fx.Provide(hprometheus.NewClientMetrics),
fx.Provide(hotel.NewTracer),
)
// NSQModule for fx.
NSQModule = fx.Options(
fx.Provide(nprometheus.NewProducerMetrics),
fx.Provide(nprometheus.NewConsumerMetrics),
fx.Provide(notel.NewTracer),
fx.Provide(marshaller.NewMsgPack),
)
// Module for fx.
Module = fx.Options(
GRPCModule,
HTTPModule,
NSQModule,
fx.Invoke(Register),
)
)