Commit 5c89c45f authored by Ben Wilson's avatar Ben Wilson Committed by GitHub

Move the metric prefix string to a label (#1047)

Added changeset and fixes
Changeset to patch
parent b74b0520
---
'@eth-optimism/batch-submitter': patch
'@eth-optimism/common-ts': patch
'@eth-optimism/data-transport-layer': patch
---
Move the metric prefix string to a label #1047
...@@ -84,6 +84,7 @@ export const run = async () => { ...@@ -84,6 +84,7 @@ export const run = async () => {
const env = process.env const env = process.env
const environment = config.str('node-env', env.NODE_ENV) const environment = config.str('node-env', env.NODE_ENV)
const network = config.str('eth-network-name', env.ETH_NETWORK_NAME) const network = config.str('eth-network-name', env.ETH_NETWORK_NAME)
const service = `batch-submitter`
const release = `batch-submitter@${env.npm_package_version}` const release = `batch-submitter@${env.npm_package_version}`
const sentryDsn = config.str('sentry-dsn', env.SENTRY_DSN) const sentryDsn = config.str('sentry-dsn', env.SENTRY_DSN)
const sentryTraceRate = config.ufloat( const sentryTraceRate = config.ufloat(
...@@ -181,8 +182,7 @@ export const run = async () => { ...@@ -181,8 +182,7 @@ export const run = async () => {
/* Metrics */ /* Metrics */
const metrics = new Metrics({ const metrics = new Metrics({
prefix: name, labels: { environment, release, network, service },
labels: { environment, release, network },
}) })
const FRAUD_SUBMISSION_ADDRESS = config.str( const FRAUD_SUBMISSION_ADDRESS = config.str(
......
...@@ -9,7 +9,7 @@ import { Server } from 'net' ...@@ -9,7 +9,7 @@ import { Server } from 'net'
import { Logger } from './logger' import { Logger } from './logger'
export interface MetricsOptions { export interface MetricsOptions {
prefix: string prefix?: string
labels?: Object labels?: Object
} }
......
...@@ -153,11 +153,11 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> { ...@@ -153,11 +153,11 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
*/ */
private _initMetrics() { private _initMetrics() {
this.metrics = new Metrics({ this.metrics = new Metrics({
prefix: this.name,
labels: { labels: {
environment: this.options.nodeEnv, environment: this.options.nodeEnv,
network: this.options.ethNetworkName, network: this.options.ethNetworkName,
release: this.options.release, release: this.options.release,
service: this.name,
}, },
}) })
const metricsMiddleware = promBundle({ const metricsMiddleware = promBundle({
......
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