Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo committed Feb 29, 2024
1 parent f166f56 commit 943dab0
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions server/server/src/apm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MeasureContext, MeasureLogger, ParamType } from '@hcengineering/core'
import { MeasureContext, MeasureLogger, ParamType, ParamsType } from '@hcengineering/core'
import apm, { Agent, Span, Transaction } from 'elastic-apm-node'

/**
Expand Down Expand Up @@ -65,8 +65,9 @@ export class APMMeasureContext implements MeasureContext {

async with<T>(
name: string,
params: Record<string, ParamType>,
op: (ctx: MeasureContext) => T | Promise<T>
params: ParamsType,
op: (ctx: MeasureContext) => T | Promise<T>,
fullParams?: ParamsType
): Promise<T> {
const c = this.newChild(name, params)
try {
Expand All @@ -82,6 +83,18 @@ export class APMMeasureContext implements MeasureContext {
}
}

async withLog<T>(
name: string,
params: ParamsType,
op: (ctx: MeasureContext) => T | Promise<T>,
fullParams?: ParamsType
): Promise<T> {
const st = Date.now()
const r = await this.with(name, params, op, fullParams)
this.logger.logOperation(name, Date.now() - st, { ...params, ...fullParams })
return r
}

async error (message: string, ...args: any[]): Promise<void> {
this.logger.error(message, args)

Expand Down

0 comments on commit 943dab0

Please sign in to comment.