Skip to content

Commit

Permalink
Move the metric prefix string to a label (#1047)
Browse files Browse the repository at this point in the history
Added changeset and fixes
Changeset to patch
  • Loading branch information
optimisticben authored Jun 17, 2021
1 parent b74b052 commit 5c89c45
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changeset/sour-adults-worry.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions packages/batch-submitter/src/exec/run-batch-submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion packages/common-ts/src/common/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Server } from 'net'
import { Logger } from './logger'

export interface MetricsOptions {
prefix: string
prefix?: string
labels?: Object
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
*/
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({
Expand Down

0 comments on commit 5c89c45

Please sign in to comment.