Commit 9fea7c94 authored by Annie Ke's avatar Annie Ke Committed by GitHub

fix[batch-submitter]: read metrics env vars correctly (#890)

* fix[batch-submitter]: read metrics env vars correctly

* rename to metrics
parent 6d72b070
...@@ -4,9 +4,9 @@ NODE_ENV=development ...@@ -4,9 +4,9 @@ NODE_ENV=development
ETH_NETWORK_NAME= ETH_NETWORK_NAME=
# Logging & monitoring # Logging & monitoring
DEBUG=info*,error*,warn*,debug* DEBUG=info*,error*,warn*,debug*
RUN_PROMETHEUS_SERVER= RUN_METRICS_SERVER=
PROMETHEUS_PORT= METRICS_PORT=
PROMETHEUS_HOSTNAME= METRICS_HOSTNAME=
# Leave the SENTRY_DSN variable unset during local development # Leave the SENTRY_DSN variable unset during local development
SENTRY_DSN= SENTRY_DSN=
SENTRY_TRACE_RATE= SENTRY_TRACE_RATE=
......
...@@ -67,7 +67,7 @@ interface RequiredEnvVars { ...@@ -67,7 +67,7 @@ interface RequiredEnvVars {
* USE_HARDHAT * USE_HARDHAT
* DEBUG_IMPERSONATE_SEQUENCER_ADDRESS * DEBUG_IMPERSONATE_SEQUENCER_ADDRESS
* DEBUG_IMPERSONATE_PROPOSER_ADDRESS * DEBUG_IMPERSONATE_PROPOSER_ADDRESS
* RUN_PROMETHEUS_SERVER * RUN_METRICS_SERVER
*/ */
export const run = async () => { export const run = async () => {
...@@ -458,15 +458,16 @@ export const run = async () => { ...@@ -458,15 +458,16 @@ export const run = async () => {
loop(() => stateBatchSubmitter.submitNextBatch()) loop(() => stateBatchSubmitter.submitNextBatch())
} }
if ( if (config.bool('run-metrics-server', env.RUN_METRICS_SERVER === 'true')) {
config.bool('run-prometheus-server', env.RUN_PROMETHEUS_SERVER === 'true')
) {
// Initialize metrics server // Initialize metrics server
await createMetricsServer({ await createMetricsServer({
logger, logger,
registry: metrics.registry, registry: metrics.registry,
port: config.uint('prometheus-port', 7300), port: config.uint('metrics-port', parseInt(env.METRICS_PORT, 10) || 7300),
hostname: config.str('prometheus-hostname', '127.0.0.1'), hostname: config.str(
'metrics-hostname',
env.METRICS_HOSTNAME || '127.0.0.1'
),
}) })
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment