From 5c89c45fe0cabfc2dd61a462482f8601fe926e8b Mon Sep 17 00:00:00 2001 From: Ben Wilson <82120899+optimisticben@users.noreply.github.com> Date: Thu, 17 Jun 2021 11:38:32 -0400 Subject: [PATCH] Move the metric prefix string to a label (#1047) Added changeset and fixes Changeset to patch --- .changeset/sour-adults-worry.md | 7 +++++++ packages/batch-submitter/src/exec/run-batch-submitter.ts | 4 ++-- packages/common-ts/src/common/metrics.ts | 2 +- .../data-transport-layer/src/services/server/service.ts | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .changeset/sour-adults-worry.md diff --git a/.changeset/sour-adults-worry.md b/.changeset/sour-adults-worry.md new file mode 100644 index 000000000000..bd3031690f86 --- /dev/null +++ b/.changeset/sour-adults-worry.md @@ -0,0 +1,7 @@ +--- +'@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 diff --git a/packages/batch-submitter/src/exec/run-batch-submitter.ts b/packages/batch-submitter/src/exec/run-batch-submitter.ts index 627b63e9647c..3eda27d655dc 100644 --- a/packages/batch-submitter/src/exec/run-batch-submitter.ts +++ b/packages/batch-submitter/src/exec/run-batch-submitter.ts @@ -84,6 +84,7 @@ export const run = async () => { const env = process.env const environment = config.str('node-env', env.NODE_ENV) const network = config.str('eth-network-name', env.ETH_NETWORK_NAME) + const service = `batch-submitter` const release = `batch-submitter@${env.npm_package_version}` const sentryDsn = config.str('sentry-dsn', env.SENTRY_DSN) const sentryTraceRate = config.ufloat( @@ -181,8 +182,7 @@ export const run = async () => { /* Metrics */ const metrics = new Metrics({ - prefix: name, - labels: { environment, release, network }, + labels: { environment, release, network, service }, }) const FRAUD_SUBMISSION_ADDRESS = config.str( diff --git a/packages/common-ts/src/common/metrics.ts b/packages/common-ts/src/common/metrics.ts index d8ac45bfd0df..99082dd7c5b8 100644 --- a/packages/common-ts/src/common/metrics.ts +++ b/packages/common-ts/src/common/metrics.ts @@ -9,7 +9,7 @@ import { Server } from 'net' import { Logger } from './logger' export interface MetricsOptions { - prefix: string + prefix?: string labels?: Object } diff --git a/packages/data-transport-layer/src/services/server/service.ts b/packages/data-transport-layer/src/services/server/service.ts index 202c3e2454d9..8abdc6ce156e 100644 --- a/packages/data-transport-layer/src/services/server/service.ts +++ b/packages/data-transport-layer/src/services/server/service.ts @@ -153,11 +153,11 @@ export class L1TransportServer extends BaseService { */ private _initMetrics() { this.metrics = new Metrics({ - prefix: this.name, labels: { environment: this.options.nodeEnv, network: this.options.ethNetworkName, release: this.options.release, + service: this.name, }, }) const metricsMiddleware = promBundle({