Skip to content

Commit

Permalink
Add requestHandlerName on runtime http handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
filafb committed Mar 20, 2024
1 parent 8defd37 commit 67933b7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/service/worker/runtime/builtIn/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export const whoAmIHandler = ({
events,
routes,
}: ServiceJSON) => (ctx: ServiceContext) => {
ctx.tracing?.currentSpan?.setOperationName('builtin:whoami')
ctx.requestHandlerName = 'builtin:whoami'
ctx.tracing?.currentSpan?.setOperationName(ctx.requestHandlerName)
ctx.status = 200
ctx.body = {
events,
Expand All @@ -17,7 +18,8 @@ export const healthcheckHandler = ({
events,
routes,
}: ServiceJSON) => (ctx: ServiceContext) => {
ctx.tracing?.currentSpan?.setOperationName('builtin:healthcheck')
ctx.requestHandlerName = 'builtin:healthcheck'
ctx.tracing?.currentSpan?.setOperationName(ctx.requestHandlerName)
ctx.status = 200
ctx.body = {
events,
Expand All @@ -26,7 +28,8 @@ export const healthcheckHandler = ({
}

export const metricsLoggerHandler = (ctx: ServiceContext) => {
ctx.tracing?.currentSpan?.setOperationName('builtin:metrics-logger')
ctx.requestHandlerName = 'builtin:metrics-logger'
ctx.tracing?.currentSpan?.setOperationName(ctx.requestHandlerName)
ctx.status = 200
ctx.body = ctx.metricsLogger.getSummaries()
}

0 comments on commit 67933b7

Please sign in to comment.