mirror of
				https://github.com/binwiederhier/ntfy.git
				synced 2025-11-04 15:00:19 +01:00 
			
		
		
		
	Profiling support
This commit is contained in:
		
							parent
							
								
									23c5d4e345
								
							
						
					
					
						commit
						29c9551548
					
				
					 11 changed files with 350 additions and 194 deletions
				
			
		| 
						 | 
				
			
			@ -88,6 +88,7 @@ var flagsServe = append(
 | 
			
		|||
	altsrc.NewStringFlag(&cli.StringFlag{Name: "billing-contact", Aliases: []string{"billing_contact"}, EnvVars: []string{"NTFY_BILLING_CONTACT"}, Value: "", Usage: "e-mail or website to display in upgrade dialog (only if payments are enabled)"}),
 | 
			
		||||
	altsrc.NewBoolFlag(&cli.BoolFlag{Name: "enable-metrics", Aliases: []string{"enable_metrics"}, EnvVars: []string{"NTFY_ENABLE_METRICS"}, Value: false, Usage: "if set, Prometheus metrics are exposed via the /metrics endpoint"}),
 | 
			
		||||
	altsrc.NewStringFlag(&cli.StringFlag{Name: "metrics-listen-http", Aliases: []string{"metrics_listen_http"}, EnvVars: []string{"NTFY_METRICS_LISTEN_HTTP"}, Usage: "ip:port used to expose the metrics endpoint (implicitly enables metrics)"}),
 | 
			
		||||
	altsrc.NewStringFlag(&cli.StringFlag{Name: "profile-listen-http", Aliases: []string{"profile_listen_http"}, EnvVars: []string{"NTFY_PROFILE_LISTEN_HTTP"}, Usage: "ip:port used to expose the profiling endpoints (implicitly enables profiling)"}),
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var cmdServe = &cli.Command{
 | 
			
		||||
| 
						 | 
				
			
			@ -167,6 +168,7 @@ func execServe(c *cli.Context) error {
 | 
			
		|||
	billingContact := c.String("billing-contact")
 | 
			
		||||
	metricsListenHTTP := c.String("metrics-listen-http")
 | 
			
		||||
	enableMetrics := c.Bool("enable-metrics") || metricsListenHTTP != ""
 | 
			
		||||
	profileListenHTTP := c.String("profile-listen-http")
 | 
			
		||||
 | 
			
		||||
	// Check values
 | 
			
		||||
	if firebaseKeyFile != "" && !util.FileExists(firebaseKeyFile) {
 | 
			
		||||
| 
						 | 
				
			
			@ -321,6 +323,7 @@ func execServe(c *cli.Context) error {
 | 
			
		|||
	conf.EnableReservations = enableReservations
 | 
			
		||||
	conf.EnableMetrics = enableMetrics
 | 
			
		||||
	conf.MetricsListenHTTP = metricsListenHTTP
 | 
			
		||||
	conf.ProfileListenHTTP = profileListenHTTP
 | 
			
		||||
	conf.Version = c.App.Version
 | 
			
		||||
 | 
			
		||||
	// Set up hot-reloading of config
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue