Compare commits
6 Commits
main
...
feat/refac
Author | SHA1 | Date |
---|---|---|
|
93c491387a | |
|
98a9ef6c0a | |
|
dee9da8ffe | |
|
727f949f50 | |
|
2921bc9869 | |
|
54cc84c5b6 |
|
@ -7,7 +7,7 @@ package senderservice
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-notification-service/gen_result/pb/notification"
|
"code.30cm.net/digimon/app-cloudep-notification-service/gen_result/pb/notification"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/zrpc"
|
"github.com/zeromicro/go-zero/zrpc"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
|
@ -32,13 +32,3 @@ 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,7 +8,6 @@ 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
|
||||||
|
@ -48,14 +47,12 @@ 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,11 +36,4 @@ type Config struct {
|
||||||
User string
|
User string
|
||||||
Password string
|
Password string
|
||||||
}
|
}
|
||||||
|
|
||||||
// PyroScope 監控
|
|
||||||
PyroScope struct {
|
|
||||||
Enable bool
|
|
||||||
URL string
|
|
||||||
Token string
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
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,8 +20,6 @@ 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