-
Notifications
You must be signed in to change notification settings - Fork 83
feat(profiling): Go 1.26 + pprof, runtime metrics and continuous profiler on all Go deployables #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat(profiling): Go 1.26 + pprof, runtime metrics and continuous profiler on all Go deployables #384
Changes from all commits
e870153
ede5de0
59bb575
ee75967
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,9 @@ deployment: | |
| - containerPort: 8082 | ||
| name: http | ||
| protocol: TCP | ||
| - containerPort: 14271 | ||
| name: metrics | ||
| protocol: TCP | ||
| probes: | ||
| liveness: | ||
| path: /health | ||
|
|
@@ -245,6 +248,13 @@ deployment: | |
| value: "true" | ||
| - name: SKYE_TRIGGER_URL | ||
| value: "http://skye-trigger:8080" | ||
| # Profiling. metric.Init binds the Prometheus registry + pprof on :14271 | ||
| # (the `metrics` containerPort above). CICD_VERSION_ID tags captured profiles | ||
| # with the running build and is injected by CI/CD; when it is empty the | ||
| # continuous profiler is skipped with a warning and pprof + Go runtime | ||
| # metrics still work. | ||
| - name: CICD_VERSION_ID | ||
| value: "" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The newly added profiler code treats an empty Same issue also flagged at:
|
||
| volumes: | ||
| - name: configs | ||
| configMap: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,9 @@ deployment: | |
| - containerPort: 8090 | ||
| name: http | ||
| protocol: TCP | ||
| - containerPort: 14271 | ||
| name: metrics | ||
| protocol: TCP | ||
| probes: | ||
| liveness: | ||
| path: /health/self | ||
|
|
@@ -73,7 +76,7 @@ deployment: | |
| - name: APP_METRIC_SAMPLING_RATE | ||
| value: "1" | ||
| - name: APP_NAME | ||
| value: "onfs" | ||
| value: "onfs-consumer" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| - name: APP_PORT | ||
| value: "8090" | ||
| # Kafka consumer | ||
|
|
@@ -118,7 +121,7 @@ deployment: | |
| - name: STORAGE_SCYLLA_1_CONTACT_POINTS | ||
| value: "scylla" | ||
| - name: STORAGE_SCYLLA_1_KEYSPACE | ||
| value: "onfs" | ||
| value: "onfs-consumer" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 BLOCKER — Do not change This changes the datastore namespace the consumer connects to, not just profiling configuration. If the production Scylla schema/data lives in the existing Also flagged on this line:
|
||
| - name: STORAGE_SCYLLA_1_PORT | ||
| value: "9042" | ||
| - name: STORAGE_SCYLLA_1_NUM_CONNS | ||
|
|
@@ -166,6 +169,13 @@ deployment: | |
| value: "30" | ||
| - name: STORAGE_REDIS_STANDALONE_ACTIVE_CONFIG_IDS | ||
| value: "2" | ||
| # Profiling. metric.Init binds the Prometheus registry + pprof on :14271 | ||
| # (the `metrics` containerPort above). CICD_VERSION_ID tags captured profiles | ||
| # with the running build and is injected by CI/CD; when it is empty the | ||
| # continuous profiler is skipped with a warning and pprof + Go runtime | ||
| # metrics still work. | ||
| - name: CICD_VERSION_ID | ||
| value: "" | ||
| serviceAccount: | ||
| enabled: false | ||
| annotations: {} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,9 @@ import ( | |
| "github.com/Meesho/BharatMLStack/horizon/pkg/infra" | ||
| "github.com/Meesho/BharatMLStack/horizon/pkg/logger" | ||
| "github.com/Meesho/BharatMLStack/horizon/pkg/metric" | ||
| "github.com/Meesho/BharatMLStack/horizon/pkg/profiling" | ||
| "github.com/Meesho/BharatMLStack/horizon/pkg/scheduler" | ||
| "github.com/rs/zerolog/log" | ||
| ) | ||
|
|
||
| type AppConfig struct { | ||
|
|
@@ -63,6 +65,13 @@ func main() { | |
| horizonConfig.InitAll(appConfig.Configs) | ||
| logger.Init(appConfig.Configs) | ||
| metric.Init(appConfig.Configs) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR describes metric.Init as returning an error when the metrics port cannot be bound, but this call discards that error. If the metrics server fails to start, profiling initialization will only fail indirectly and the service will silently lose the new runtime metrics surface. Same issue also flagged at:
|
||
| if err := profiling.InitWithOptions( | ||
| profiling.WithPprof(profiling.PprofAll...), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Go pprof endpoints can expose heap contents, goroutine stacks, command-line arguments, and operational details that may include secrets or sensitive data. This initialization enables all pprof handlers with no visible authentication or authorization guard. Same issue also flagged at:
|
||
| profiling.WithRuntimeMetrics(profiling.RuntimeMetricAll), | ||
| profiling.WithContinuousProfiler(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 SUGGESTION — Consider gating Continuous profiling adds periodic background sampling and upload work to the process. Horizon may be less CPU-critical than serving paths, but enabling it on every replica still creates recurring fleet CPU/network cost; a runtime flag or sampled deployment gives the same observability with lower steady-state overhead. Same issue also flagged at:
|
||
| ); err != nil { | ||
| log.Error().Err(err).Msg("profiling init failed") | ||
| } | ||
| httpframework.Init(middleware.NewMiddleware().GetMiddleWares()...) | ||
| workflowHandler.InitV1WorkflowHandler() | ||
| deployableRouter.Init(appConfig.Configs) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declaring only a containerPort does not make :14271 reachable via the Kubernetes Service, so service-based Prometheus scraping or operators using ServiceMonitor will not discover the new runtime metrics endpoint.
Also flagged on this line: