fix: package name
This commit is contained in:
parent
9980caf1cd
commit
b5bf36e7ee
|
@ -32,3 +32,13 @@ MitakeSMSSender:
|
||||||
User: xxxxxx
|
User: xxxxxx
|
||||||
Password : xxxxxx
|
Password : xxxxxx
|
||||||
|
|
||||||
|
DevServer:
|
||||||
|
Enabled: false
|
||||||
|
Port: 6470
|
||||||
|
MetricsPath: /metrics
|
||||||
|
EnableMetrics: true
|
||||||
|
|
||||||
|
PyroScope:
|
||||||
|
Enable: false
|
||||||
|
URL: http://10.0.0.13:4040
|
||||||
|
Token: "xxx"
|
3
go.mod
3
go.mod
|
@ -8,6 +8,7 @@ require (
|
||||||
github.com/aws/aws-sdk-go-v2 v1.36.3
|
github.com/aws/aws-sdk-go-v2 v1.36.3
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.61
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.61
|
||||||
github.com/aws/aws-sdk-go-v2/service/ses v1.30.0
|
github.com/aws/aws-sdk-go-v2/service/ses v1.30.0
|
||||||
|
github.com/grafana/pyroscope-go v1.2.0
|
||||||
github.com/matcornic/hermes/v2 v2.1.0
|
github.com/matcornic/hermes/v2 v2.1.0
|
||||||
github.com/minchao/go-mitake v1.0.0
|
github.com/minchao/go-mitake v1.0.0
|
||||||
github.com/zeromicro/go-zero v1.7.0
|
github.com/zeromicro/go-zero v1.7.0
|
||||||
|
@ -47,12 +48,14 @@ require (
|
||||||
github.com/google/gofuzz v1.2.0 // indirect
|
github.com/google/gofuzz v1.2.0 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/gorilla/css v1.0.0 // indirect
|
github.com/gorilla/css v1.0.0 // indirect
|
||||||
|
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
|
||||||
github.com/huandu/xstrings v1.2.0 // indirect
|
github.com/huandu/xstrings v1.2.0 // indirect
|
||||||
github.com/imdario/mergo v0.3.6 // indirect
|
github.com/imdario/mergo v0.3.6 // indirect
|
||||||
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 // indirect
|
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 // indirect
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
|
github.com/klauspost/compress v1.17.8 // indirect
|
||||||
github.com/mailru/easyjson v0.7.7 // indirect
|
github.com/mailru/easyjson v0.7.7 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
|
|
@ -36,4 +36,11 @@ type Config struct {
|
||||||
User string
|
User string
|
||||||
Password string
|
Password string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PyroScope 監控
|
||||||
|
PyroScope struct {
|
||||||
|
Enable bool
|
||||||
|
URL string
|
||||||
|
Token string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
package svc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"code.30cm.net/digimon/app-cloudep-notification-service/internal/config"
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/grafana/pyroscope-go"
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitPyroScope(c config.Config) {
|
||||||
|
if c.PyroScope.Enable {
|
||||||
|
podName := os.Getenv("POD_NAME")
|
||||||
|
|
||||||
|
_, err := pyroscope.Start(pyroscope.Config{
|
||||||
|
ApplicationName: fmt.Sprintf("biz-%s-%s", c.Name, podName),
|
||||||
|
ServerAddress: c.PyroScope.URL,
|
||||||
|
Logger: logx.WithContext(context.Background()),
|
||||||
|
ProfileTypes: []pyroscope.ProfileType{
|
||||||
|
pyroscope.ProfileCPU,
|
||||||
|
|
||||||
|
pyroscope.ProfileInuseObjects,
|
||||||
|
pyroscope.ProfileAllocObjects,
|
||||||
|
pyroscope.ProfileInuseSpace,
|
||||||
|
pyroscope.ProfileAllocSpace,
|
||||||
|
|
||||||
|
pyroscope.ProfileGoroutines,
|
||||||
|
|
||||||
|
pyroscope.ProfileMutexCount,
|
||||||
|
pyroscope.ProfileMutexDuration,
|
||||||
|
|
||||||
|
pyroscope.ProfileBlockCount,
|
||||||
|
pyroscope.ProfileBlockDuration,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
logx.WithCallerSkip(1).WithFields(logx.LogField{
|
||||||
|
Key: "error", Value: err.Error(),
|
||||||
|
}).Error("failed to init pyroscope")
|
||||||
|
|
||||||
|
panic(fmt.Sprintf("Pyroscope start err: %s", err.Error()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,8 @@ type ServiceContext struct {
|
||||||
func NewServiceContext(c config.Config) *ServiceContext {
|
func NewServiceContext(c config.Config) *ServiceContext {
|
||||||
errs.Scope = code.CloudEPNotification
|
errs.Scope = code.CloudEPNotification
|
||||||
|
|
||||||
|
InitPyroScope(c)
|
||||||
|
|
||||||
param := usecase.DeliveryUseCaseParam{}
|
param := usecase.DeliveryUseCaseParam{}
|
||||||
if c.AmazonSesSettings.Enable {
|
if c.AmazonSesSettings.Enable {
|
||||||
sesRepo := repository.MustAwsSesMailRepository(repository.AwsEmailDeliveryParam{
|
sesRepo := repository.MustAwsSesMailRepository(repository.AwsEmailDeliveryParam{
|
||||||
|
|
Loading…
Reference in New Issue