Skip to content

Commit

Permalink
adding deployment metadata to stream-metadata logs in preparation of …
Browse files Browse the repository at this point in the history
…auto-scale (#1016)
  • Loading branch information
mechanical-turk authored Sep 9, 2024
1 parent 5bf2919 commit 8bbec46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/stream-metadata/src/environment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as dotenv from 'dotenv'
import { getWeb3Deployment } from '@river-build/web3'
import { z } from 'zod'
import { v4 } from 'uuid'

dotenv.config({
path: ['.env', '.env.local'],
Expand Down Expand Up @@ -52,6 +53,10 @@ function makeConfig() {
pretty: envMain.LOG_PRETTY,
},
aws: envAws?.success ? envAws.data : undefined,
instance: {
id: v4(),
deployedAt: new Date().toISOString(),
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/stream-metadata/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ const pinoOptions: LoggerOptions = {
const baseLogger = pino(pinoOptions)

export function getLogger(name: string, meta: Record<string, unknown> = {}) {
return baseLogger.child({ name, ...meta })
return baseLogger.child({ name, instance: config.instance, ...meta })
}

0 comments on commit 8bbec46

Please sign in to comment.