Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shiqinfeng1 committed Jan 7, 2024
1 parent c657c8b commit 8cb47eb
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ ARG GOARCH=amd64
# Keep Go's build cache between builds.
# https://github.com/golang/go/issues/27719#issuecomment-514747274
# --tags "${TAGS}"
RUN echo "${VERSION}"
RUN --mount=type=cache,sharing=locked,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=secret,id=git_creds,dst=/root/.netrc \
Expand Down
2 changes: 1 addition & 1 deletion app/bff-gomono/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func newApp(register *conf.Register, logger klog.Logger, regstr registry.Registr
hs,
),
kratos.Registrar(regstr),
kratos.Endpoint(&url.URL{Scheme: "http", Host: register.Endpoints[0]}), // 指定服务地址,该地址会提交给注册中心,如果不指定,那么将注册容器内部地址,导致外部无法访问
kratos.Endpoint(&url.URL{Scheme: "http", Host: register.Endpoints[0]}), // 指定服务地址,该地址会提交给注册中心,如果不指定,那么将注册容器内部地址,导致外部无法访问本服务
)
}

Expand Down
2 changes: 1 addition & 1 deletion app/biz-trainer/cmd/svc-trainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func newApp(register *conf.Register, logger klog.Logger, regstr registry.Registr
gs,
),
kratos.Registrar(regstr),
kratos.Endpoint(&url.URL{Scheme: "http", Host: register.Endpoints[0]}), // 指定服务地址,该地址会提交给注册中心,如果不指定,那么将注册容器内部地址,导致外部无法访问
kratos.Endpoint(&url.URL{Scheme: "http", Host: register.Endpoints[0]}), // 指定服务地址,该地址会提交给注册中心,如果不指定,那么将注册容器内部地址,导致外部无法访问本服务
)
}

Expand Down
2 changes: 1 addition & 1 deletion app/biz-training/cmd/svc-training.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func newApp(register *conf.Register, logger klog.Logger, regstr registry.Registr
gs,
),
kratos.Registrar(regstr),
kratos.Endpoint(&url.URL{Scheme: "http", Host: register.Endpoints[0]}), // 指定服务地址,该地址会提交给注册中心,如果不指定,那么将注册容器内部地址,导致外部无法访问
kratos.Endpoint(&url.URL{Scheme: "http", Host: register.Endpoints[0]}), // 指定服务地址,该地址会提交给注册中心,如果不指定,那么将注册容器内部地址,导致外部无法访问本服务
)
}

Expand Down
4 changes: 3 additions & 1 deletion app/common/client/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ package client
import "github.com/prometheus/client_golang/prometheus"

var (
// 设置 metrics 中间件统计请求耗时的 Observer 直方图
MetricsSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "server",
Subsystem: "requests",
Name: "duration_sec",
Help: "server requests duration(sec).",
Buckets: []float64{0.005, 0.01, 0.025, 0.05, 0.1, 0.250, 0.5, 1},
}, []string{"kind", "operation"})

// 设置 metrics 中间件统计请求计数的 Counter 计数器
MetricsRequests = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "client",
Subsystem: "requests",
Name: "code_total",
Help: "The total number of processed requests",
}, []string{"kind", "operation", "code", "reason"})
// 统计系统资源
MetricsLoads = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "server",
Subsystem: "system",
Expand Down
1 change: 0 additions & 1 deletion app/gateway-gomono/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func main() {
),
kratos.Metadata(map[string]string{}),
kratos.Logger(logger),
// kratos.Endpoint(&url.URL{Scheme: "http", Host: pubCfg.GatewayRegister.Endpoints[0]}), // 指定服务地址,该地址会提交给注册中心,如果不指定,那么将注册容器内部地址,导致外部无法访问
)
if err := app.Run(); err != nil {
l.Errorf("failed to run servers: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker/tmpl/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ scrape_configs:
# scheme defaults to 'http'.

static_configs:
- targets: ['localhost:{{prometheus_srv_port}}']
- targets: ['{{bff_host}}:{{bff_port}}']

- job_name: 'nacos'
metrics_path: '/nacos/actuator/prometheus'
Expand Down

0 comments on commit 8cb47eb

Please sign in to comment.