Skip to content

PURISTA API


PURISTA API / @purista/hono-http-server / HonoServiceClass

Class: HonoServiceClass<Bindings, Variables>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:86

A service which creates a Hono server, adds the command endpoints of given services. The webserver needs to be started programmatically, after the .start method.

Minimal example:

Example

typescript
import { serve } from '@hono/node-server'
import { DefaultEventBridge } from '@purista/core'
import { honoV1Service } from '@purista/hono-http-server'

// create and init our eventbridge
const eventBridge = new DefaultEventBridge()
await eventBridge.start()

// add your service
const pingService = await pingV1Service.getInstance(eventBridge)
await pingService.start()

const honoService = await honoV1Service.getInstance(eventBridge, {
  serviceConfig: {
    services: [pingService]
  }
})
await honoService.start()

const _serverInstance = serve({
  fetch: honoService.app.fetch,
  port: 3000,
})

Extends

Type Parameters

Bindings

Bindings extends BindingsBase = BindingsBase

Variables

Variables extends VariablesBase = VariablesBase

Constructors

Constructor

new HonoServiceClass<Bindings, Variables>(config): HonoServiceClass<Bindings, Variables>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:104

Parameters

config

ServiceConstructorInput<ServiceClassTypes<{ apiMountPath: string; enableDynamicRoutes: boolean; enableHealth: boolean; healthFunction?: any; healthPath: string; logLevel: "error" | "info" | "warn" | "debug" | "trace" | "fatal"; openApi?: { components?: any; enabled: boolean; externalDocs?: { description?: string; url: string; }; info: { contact?: { email?: string; name?: string; url?: string; }; description: string; license?: { name: string; url?: string; }; termsOfService?: string; title: string; version: string; }; openapi: string; paths?: Record<string, Record<string, any>>; security?: any[]; servers?: object[]; tags?: object[]; }; protectHandler?: any; services: Service<ServiceClassTypes>[]; traceHeaderField: string; }, EmptyObject>>

Returns

HonoServiceClass<Bindings, Variables>

Overrides

Service.constructor

Properties

activeStreamSessions

protected activeStreamSessions: Map<string, { cancelled: boolean; cancelReason?: string; onCancel: (reason?) => void[]; }>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:65

Inherited from

Service.activeStreamSessions


app

app: Hono<{ Bindings: Bindings; Variables: Variables; }, BlankSchema, "/">

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:93

The Hono instance


commandDefinitionList

commandDefinitionList: CommandDefinitionListResolved<any>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:76

Inherited from

Service.commandDefinitionList


commands

protected commands: Map<string, CommandDefinition<any, any, any, any, any, any, any, any, any, any, EmptyObject, any, any, any, any, any, any>>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:61

Inherited from

Service.commands


config

config: object

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:79

apiMountPath

apiMountPath: string

enableDynamicRoutes

enableDynamicRoutes: boolean

enableHealth

enableHealth: boolean

healthFunction?

optional healthFunction: any

healthPath

healthPath: string

logLevel

logLevel: "error" | "info" | "warn" | "debug" | "trace" | "fatal"

openApi?

optional openApi: object

openApi.components?

optional components: any

openApi.enabled

enabled: boolean

openApi.externalDocs?

optional externalDocs: object

openApi.externalDocs.description?

optional description: string

openApi.externalDocs.url

url: string

openApi.info

info: object = InfoObjectSchema

openApi.info.contact?

optional contact: object

openApi.info.contact.email?

optional email: string

openApi.info.contact.name?

optional name: string

openApi.info.contact.url?

optional url: string

openApi.info.description

description: string

openApi.info.license?

optional license: object

openApi.info.license.name

name: string

openApi.info.license.url?

optional url: string

openApi.info.termsOfService?

optional termsOfService: string

openApi.info.title

title: string

openApi.info.version

version: string

openApi.openapi

openapi: string

openApi.paths?

optional paths: Record<string, Record<string, any>>

openApi.security?

optional security: any[]

openApi.servers?

optional servers: object[]

openApi.tags?

optional tags: object[]

protectHandler?

optional protectHandler: any

services

services: Service<ServiceClassTypes>[]

traceHeaderField

traceHeaderField: string

Inherited from

Service.config


configSchema

protected configSchema: Schema | undefined

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:31

Inherited from

Service.configSchema


configStore

protected configStore: ConfigStore

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:29

Inherited from

Service.configStore


eventBridge

protected eventBridge: EventBridge

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:24

Inherited from

Service.eventBridge


info

readonly info: ServiceInfoType

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:23

Inherited from

Service.info


isStarted

isStarted: boolean

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:81

Inherited from

Service.isStarted


logger

logger: Logger

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:25

Inherited from

Service.logger


openApi

openApi: OpenApiBuilder

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:98

The OpenApiBuilder instance


queueDefinitionList

protected queueDefinitionList: QueueDefinitionListResolved<any>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:63

Inherited from

Service.queueDefinitionList


queueWorkerDefinitionList

protected queueWorkerDefinitionList: QueueWorkerDefinitionListResolved<any>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:64

Inherited from

Service.queueWorkerDefinitionList


resources

resources: EmptyObject

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:80

Inherited from

Service.resources


secretStore

protected secretStore: SecretStore

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:28

Inherited from

Service.secretStore


spanProcessor

spanProcessor: SpanProcessor | undefined

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:26

Inherited from

Service.spanProcessor


stateStore

protected stateStore: StateStore

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:30

Inherited from

Service.stateStore


streamDefinitionList

streamDefinitionList: StreamDefinitionListResolved<any>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:78

Inherited from

Service.streamDefinitionList


streams

protected streams: Map<string, StreamDefinition<any, any, any, any, any, any, any, EmptyObject, any, any, any, any, any, any>>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:62

Inherited from

Service.streams


subscriptionDefinitionList

subscriptionDefinitionList: SubscriptionDefinitionListResolved<any>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:77

Inherited from

Service.subscriptionDefinitionList


subscriptions

protected subscriptions: Map<string, SubscriptionDefinition<any, any, any, any, any, any, any, any, EmptyObject, any, any, any, any, any, any>>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:60

Inherited from

Service.subscriptions


traceProvider

traceProvider: NodeTracerProvider

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:27

Inherited from

Service.traceProvider

Accessors

name

Get Signature

get name(): string

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:83

Returns

string

Inherited from

Service.name


serviceInfo

Get Signature

get serviceInfo(): ServiceInfoType

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:45

Get service info

Returns

ServiceInfoType

Inherited from

Service.serviceInfo

Methods

addEndpoint()

addEndpoint(metadata, service): void

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:332

Adds a single service command endpoint to the Hono router

Parameters

metadata

CommandDefinitionMetadataBase

Command metadata produced by the builder

service

EBMessageAddress

Address of the service hosting the command

Returns

void


destroy()

destroy(): Promise<void>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:611

Stop and destroy the current service

Returns

Promise<void>

Overrides

Service.destroy


emit()

emit<K>(eventName, parameter?): void

Defined in: core/dist/commonjs/core/types/GenericEventEmitter.d.ts:16

Type Parameters

K

K extends EventKey<ServiceEvents>

Parameters

eventName

K

parameter?

ServiceEvents[K]

Returns

void

Inherited from

Service.emit


executeCommand()

executeCommand(message): Promise<Readonly<Omit<{ contentEncoding: "utf-8"; contentType: "application/json"; correlationId: string; eventName?: string; id: string; isHandledError: boolean; messageType: CommandErrorResponse; otp?: string; payload: { data?: unknown; message: string; status: StatusCode; }; principalId?: string; receiver: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; sender: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; tenantId?: string; timestamp: number; traceId?: string; }, "instanceId">> | { contentEncoding: string; contentType: string; correlationId: string; eventName?: string; id: string; messageType: CommandSuccessResponse; otp: string; payload: unknown; principalId?: string; receiver: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; sender: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; tenantId?: string; timestamp: number; traceId?: string; }>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:140

Called when a command is received by the service

Parameters

message

Readonly<Command>

Command envelope to execute

Returns

Promise<Readonly<Omit<{ contentEncoding: "utf-8"; contentType: "application/json"; correlationId: string; eventName?: string; id: string; isHandledError: boolean; messageType: CommandErrorResponse; otp?: string; payload: { data?: unknown; message: string; status: StatusCode; }; principalId?: string; receiver: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; sender: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; tenantId?: string; timestamp: number; traceId?: string; }, "instanceId">> | { contentEncoding: string; contentType: string; correlationId: string; eventName?: string; id: string; messageType: CommandSuccessResponse; otp: string; payload: unknown; principalId?: string; receiver: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; sender: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; tenantId?: string; timestamp: number; traceId?: string; }>

Inherited from

Service.executeCommand


executeStream()

executeStream(message): Promise<void>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:184

Parameters

message

Readonly<StreamMessage>

Returns

Promise<void>

Inherited from

Service.executeStream


executeSubscription()

executeSubscription(message, subscriptionName): Promise<Omit<{ contentEncoding: string; contentType: string; correlationId?: string; eventName: string; id: string; messageType: CustomMessage; otp?: string; payload?: unknown; principalId?: string; receiver?: EBMessageAddress; sender: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; tenantId?: string; timestamp: number; traceId?: string; }, "id" | "timestamp"> | undefined>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:186

Parameters

message

Readonly<EBMessage>

subscriptionName

string

Returns

Promise<Omit<{ contentEncoding: string; contentType: string; correlationId?: string; eventName: string; id: string; messageType: CustomMessage; otp?: string; payload?: unknown; principalId?: string; receiver?: EBMessageAddress; sender: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }; tenantId?: string; timestamp: number; traceId?: string; }, "id" | "timestamp"> | undefined>

Inherited from

Service.executeSubscription


getAgentInvokeFunction()

protected getAgentInvokeFunction<Invokes>(serviceTarget, traceId?, principalId?, tenantId?, agentInvokes?): <InvokeResponseType, PayloadType, ParameterType>(receiver, payload, parameter) => AgentInvocation<InvokeResponseType>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:100

Type Parameters

Invokes

Invokes extends AgentInvokeList

Parameters

serviceTarget

string

traceId?

string

principalId?

string

tenantId?

string

agentInvokes?

Invokes

Returns

<InvokeResponseType, PayloadType, ParameterType>(receiver, payload, parameter): AgentInvocation<InvokeResponseType>

Type Parameters
InvokeResponseType

InvokeResponseType = { history: any[]; message: any; }

PayloadType

PayloadType = {[x: string]: unknown; attachments: any[]; conversationId?: string; history: any[]; message: string; }

ParameterType

ParameterType = EmptyObject

Parameters
receiver

EBMessageAddress

payload

PayloadType

parameter

ParameterType

Returns

AgentInvocation<InvokeResponseType>

Inherited from

Service.getAgentInvokeFunction


getConsumeStreamFunction()

protected getConsumeStreamFunction<StreamInvokes>(serviceTarget, traceId?, principalId?, tenantId?, streamInvokes?): OpenStreamFunction

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:132

Type Parameters

StreamInvokes

StreamInvokes extends StreamInvokeList

Parameters

serviceTarget

string

traceId?

string

principalId?

string

tenantId?

string

streamInvokes?

StreamInvokes

Returns

OpenStreamFunction

Inherited from

Service.getConsumeStreamFunction


getContextFunctions()

getContextFunctions(logger, queueNamespace?): ContextBase

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:134

Parameters

logger

Logger

queueNamespace?

QueueContext

Returns

ContextBase

Inherited from

Service.getContextFunctions


getEmitFunction()

protected getEmitFunction<EmitList>(serviceTarget, traceId?, principalId?, tenantId?, emitList?): <K, Payload>(eventName, eventPayload?, contentType?, contentEncoding?) => Promise<void>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:133

Type Parameters

EmitList

EmitList extends Record<string, Schema> = EmptyObject

Parameters

serviceTarget

string

traceId?

string

principalId?

string

tenantId?

string

emitList?

EmitList

Returns

<K, Payload>(eventName, eventPayload?, contentType?, contentEncoding?): Promise<void>

Type Parameters
K

K extends string | number | symbol

Payload

Payload = EmitList[K]

Parameters
eventName

K

eventPayload?

Payload

contentType?

string

contentEncoding?

string

Returns

Promise<void>

Inherited from

Service.getEmitFunction


getInvokeFunction()

protected getInvokeFunction<Invokes>(serviceTarget, traceId?, principalId?, tenantId?, invokes?): <Payload, Parameter>(receiver, invokePayload, invokeparameter, contentType?, contentEncoding?) => Promise<any>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:99

Type Parameters

Invokes

Invokes extends InvokeList

Parameters

serviceTarget

string

traceId?

string

principalId?

string

tenantId?

string

invokes?

Invokes

Returns

<Payload, Parameter>(receiver, invokePayload, invokeparameter, contentType?, contentEncoding?): Promise<any>

Type Parameters
Payload

Payload

Parameter

Parameter extends EmptyObject

Parameters
receiver

EBMessageAddress

invokePayload

Payload

invokeparameter

Parameter

contentType?

string

contentEncoding?

string

Returns

Promise<any>

Inherited from

Service.getInvokeFunction


getQueueNamespace()

protected getQueueNamespace(queueInvokes?, traceId?, principalId?, tenantId?): object

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:110

Parameters

queueInvokes?

QueueInvokeList

traceId?

string

principalId?

string

tenantId?

string

Returns

object

enqueue

enqueue: QueueInvokeFunction & QueueInvokeClientMap<QueueInvokeList>

scheduleAt

scheduleAt: QueueScheduleFunction & QueueScheduleProxy<QueueInvokeClientMap<QueueInvokeList>>

Inherited from

Service.getQueueNamespace


getServiceHealth()

getServiceHealth(): Promise<ServiceHealthState>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:183

Returns

Promise<ServiceHealthState>

Inherited from

Service.getServiceHealth


getTracer()

getTracer(name?, version?): Tracer

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:51

Returns open telemetry tracer of this service

Parameters

name?

string

version?

string

Returns

Tracer

Tracer

Inherited from

Service.getTracer


initializeEventbridgeConnect()

protected initializeEventbridgeConnect(commandDefinitionList, subscriptions, streams): Promise<void>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:91

Connect service to event bridge to receive commands and command responses

Parameters

commandDefinitionList

CommandDefinitionListResolved<any>

subscriptions

SubscriptionDefinitionListResolved<any>

streams

StreamDefinitionListResolved<any>

Returns

Promise<void>

Inherited from

Service.initializeEventbridgeConnect


initializeQueues()

protected initializeQueues(): Promise<void>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:92

Returns

Promise<void>

Inherited from

Service.initializeQueues


invoke()

invoke<T>(input, endpoint): Promise<T>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:534

Type Parameters

T

T

Parameters

input

Omit<Command, "id" | "messageType" | "timestamp" | "correlationId" | "sender">

endpoint

string

Returns

Promise<T>


off()

off<K>(eventName, fn): void

Defined in: core/dist/commonjs/core/types/GenericEventEmitter.d.ts:15

Type Parameters

K

K extends EventKey<ServiceEvents>

Parameters

eventName

K

fn

EventReceiver<ServiceEvents[K]>

Returns

void

Inherited from

Service.off


on()

on<K>(eventName, fn): void

Defined in: core/dist/commonjs/core/types/GenericEventEmitter.d.ts:14

Type Parameters

K

K extends EventKey<ServiceEvents>

Parameters

eventName

K

fn

EventReceiver<ServiceEvents[K]>

Returns

void

Inherited from

Service.on


openStream()

openStream(input, endpoint): Promise<StreamHandle<unknown, unknown>>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:549

Parameters

input

Omit<Command, "id" | "messageType" | "timestamp" | "correlationId" | "sender">

endpoint

string

Returns

Promise<StreamHandle<unknown, unknown>>


prepareDestroy()

prepareDestroy(): object

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:604

Helper function to be used in gracefulShutdown. It prevents to handle new requests during shut down. Incoming requests are rejected with 503 Service Unavailable.

Returns

destroy()

destroy: () => Promise<void>

Set the service unavailable The webserver will return 503 Service Unavailable

Returns

Promise<void>

name

name: string

Example

typescript
gracefulShutdown(logger, [
honoService.prepareDestroy(),
eventbridge,
...services,
honoService
])

registerCommand()

registerCommand(commandDefinition): Promise<void>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:176

Parameters

commandDefinition

CommandDefinition<any, any, any, any, any, any, any, any, any, any, EmptyObject, any, any, any>

Returns

Promise<void>

Inherited from

Service.registerCommand


registerService()

registerService(...services): HonoServiceClass<Bindings, Variables>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:311

Register a service instance. Must be called before .start. Adds the endpoints of the service commands to the Hono router

Parameters

services

...Service<ServiceClassTypes>[]

Returns

HonoServiceClass<Bindings, Variables>


registerStream()

registerStream(streamDefinition): Promise<void>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:185

Parameters

streamDefinition

StreamDefinition<any, any, any, any, any, any, any, EmptyObject, any, any, any, any, any, any>

Returns

Promise<void>

Inherited from

Service.registerStream


registerSubscription()

registerSubscription(subscriptionDefinition): Promise<void>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:187

Parameters

subscriptionDefinition

SubscriptionDefinition<any, any, any, any, any, any, any, any, EmptyObject, any, any, any>

Returns

Promise<void>

Inherited from

Service.registerSubscription


removeAllListeners()

removeAllListeners(): void

Defined in: core/dist/commonjs/core/types/GenericEventEmitter.d.ts:17

Returns

void

Inherited from

Service.removeAllListeners


sendServiceInfo()

protected sendServiceInfo(infoType, target?, payload?): Promise<Readonly<EBMessage>>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:98

Broadcast service info message

Parameters

infoType

InfoMessageType

type of info message

target?

string

function name is need in messages like InfoServiceFunctionAdded

payload?

Record<string, unknown>

Returns

Promise<Readonly<EBMessage>>

Inherited from

Service.sendServiceInfo


setHealthFunction()

setHealthFunction(fn): HonoServiceClass<Bindings, Variables>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:141

Set a custom health function

Parameters

fn

HealthFunction<HonoServiceClass<Bindings, Variables>>

Returns

HonoServiceClass<Bindings, Variables>


setHonoTypes()

setHonoTypes<E>(): HonoServiceClass<Bindings & E["Bindings"], Variables & E["Variables"]>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:128

Set the Hono types for Variables and Bindings.

Type Parameters

E

E extends object = { Bindings: EmptyObject; Variables: EmptyObject; }

Returns

HonoServiceClass<Bindings & E["Bindings"], Variables & E["Variables"]>

The service instance with propper types


setProtectMiddleware()

setProtectMiddleware(fn): HonoServiceClass<Bindings, Variables>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:161

Set the middleware which will be executed on all endpoints which are marked as secured/protected. It can also be used to enhance input information.

Parameters

fn

EndpointProtectMiddleware<HonoServiceClass<Bindings, Variables>, Bindings, Variables>

Returns

HonoServiceClass<Bindings, Variables>

Example

typescript
honoService.setProtectHandler(async function (c, next) {
const auth = basicAuth({ username: 'user', password: 'password' })
c.set('additionalParameter', { userId: '123' })
return auth(c, next)
})

setServiceAvailable()

setServiceAvailable(): Promise<void>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:584

Set the service available Request will be processed.

Returns

Promise<void>


setServiceUnavailable()

setServiceUnavailable(): Promise<void>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:576

Set the service unavailable The webserver will return 503 Service Unavailable

Returns

Promise<void>


start()

start(): Promise<void>

Defined in: hono-http-server/src/service/hono/v1/HonoServiceClass.ts:166

It connects to the event bridge and subscribes to the topics that are in the subscription list.

Returns

Promise<void>

Overrides

Service.start


startActiveSpan()

startActiveSpan<F>(name, opts, context, fn): Promise<F>

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:60

Start a child span for opentelemetry tracking

Type Parameters

F

F

Parameters

name

string

name of span

opts

SpanOptions

span options

context

optional context

Context | undefined

fn

(span) => Promise<F>

function to be executed within the span

Returns

Promise<F>

return value of fn

Inherited from

Service.startActiveSpan


startQueueWorkers()

protected startQueueWorkers(): void

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:177

Returns

void

Inherited from

Service.startQueueWorkers


stopQueueWorkers()

protected stopQueueWorkers(): Promise<void>

Defined in: core/dist/commonjs/core/Service/Service.impl.d.ts:178

Returns

Promise<void>

Inherited from

Service.stopQueueWorkers


wrapInSpan()

wrapInSpan<F>(name, opts, fn, context?): Promise<F>

Defined in: core/dist/commonjs/core/Service/ServiceBaseClass/ServiceBaseClass.impl.d.ts:76

Start span for opentelemetry tracking on same level. The created span will not become the "active" span within opentelemetry!

This means during logging and similar the spanId of parent span is logged.

Use wrapInSpan for marking points in flow of one bigger function, but not to trace the program flow itself

Type Parameters

F

F

Parameters

name

string

name of span

opts

SpanOptions

span options

fn

(span) => Promise<F>

function te be executed in the span

context?

Context

span context

Returns

Promise<F>

return value of fn

Inherited from

Service.wrapInSpan