add metrics
This commit is contained in:
1 parent
77bcc2858a
commit
3aca9b638c
3 files changed
+21
-3
No files matched your search
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/integration-system/isp-lib/bootstrap"
|
||||
"github.com/integration-system/isp-lib/config/schema"
|
||||
"github.com/integration-system/isp-lib/logger"
|
||||
"github.com/integration-system/isp-lib/metric"
|
||||
"github.com/integration-system/isp-lib/structure"
|
||||
"google.golang.org/grpc"
|
||||
"isp-script-service/compile"
|
||||
@@ -17,6 +18,8 @@ import (
|
||||
|
||||
var (
|
||||
version = "1.0.0"
|
||||
|
||||
metricMethod = metric.NewMethodMetrics("api", metric.GetRegistry())
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -53,12 +56,15 @@ func onShutdown(_ context.Context, _ os.Signal) {
|
||||
|
||||
func onRemoteConfigReceive(remoteConfig, oldRemoteConfig *conf.RemoteConfig) {
|
||||
compile.Script.Init(remoteConfig.Scripts)
|
||||
metric.InitCollectors(remoteConfig.Metrics, oldRemoteConfig.Metrics)
|
||||
metric.InitHttpServer(remoteConfig.Metrics)
|
||||
}
|
||||
|
||||
func onLocalConfigLoad(cfg *conf.Configuration) {
|
||||
handlers := helper.GetAllHandlers()
|
||||
service := backend.GetDefaultService(cfg.ModuleName, handlers...)
|
||||
backend.StartBackendGrpcServer(
|
||||
service := backend.GetDefaultService(cfg.ModuleName, handlers...).
|
||||
WithInterceptor(metric.WithMetrics(metricMethod, nil))
|
||||
backend.StartBackendGrpcServer(
|
||||
cfg.GrpcInnerAddress, service,
|
||||
grpc.MaxRecvMsgSize(1024*1024*512),
|
||||
grpc.MaxSendMsgSize(1024*1024*512),
|
||||
|
||||
Reference in new issue
Block a user