mirror of
https://github.com/openziti/zrok.git
synced 2025-06-21 18:21:34 +02:00
support for pprof endpoint
This commit is contained in:
parent
4420254c5c
commit
1578ecca98
@ -36,6 +36,7 @@ type Config struct {
|
|||||||
type AdminConfig struct {
|
type AdminConfig struct {
|
||||||
Secrets []string `cf:"+secret"`
|
Secrets []string `cf:"+secret"`
|
||||||
TouLink string
|
TouLink string
|
||||||
|
ProfileEndpoint string
|
||||||
}
|
}
|
||||||
|
|
||||||
type EndpointConfig struct {
|
type EndpointConfig struct {
|
||||||
|
@ -2,11 +2,13 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/openziti/zrok/controller/config"
|
"github.com/openziti/zrok/controller/config"
|
||||||
"github.com/openziti/zrok/controller/limits"
|
"github.com/openziti/zrok/controller/limits"
|
||||||
"github.com/openziti/zrok/controller/metrics"
|
"github.com/openziti/zrok/controller/metrics"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
_ "net/http/pprof"
|
||||||
|
|
||||||
"github.com/go-openapi/loads"
|
"github.com/go-openapi/loads"
|
||||||
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
||||||
@ -26,6 +28,12 @@ var limitsAgent *limits.Agent
|
|||||||
func Run(inCfg *config.Config) error {
|
func Run(inCfg *config.Config) error {
|
||||||
cfg = inCfg
|
cfg = inCfg
|
||||||
|
|
||||||
|
if cfg.Admin != nil && cfg.Admin.ProfileEndpoint != "" {
|
||||||
|
go func() {
|
||||||
|
log.Println(http.ListenAndServe(cfg.Admin.ProfileEndpoint, nil))
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
swaggerSpec, err := loads.Embedded(rest_server_zrok.SwaggerJSON, rest_server_zrok.FlatSwaggerJSON)
|
swaggerSpec, err := loads.Embedded(rest_server_zrok.SwaggerJSON, rest_server_zrok.FlatSwaggerJSON)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error loading embedded swagger spec")
|
return errors.Wrap(err, "error loading embedded swagger spec")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user