PURISTA API / Modules / @purista/core / ServiceClass
Interface: ServiceClass<ConfigType>
@purista/core.ServiceClass
The ServiceClass interface
Type parameters
Name | Type |
---|---|
ConfigType | unknown | undefined |
Implemented by
Table of contents
Properties
Methods
Properties
config
• config: ConfigType
Defined in
Methods
destroy
▸ destroy(): Promise
<void
>
Stop and destroy the current service
Returns
Promise
<void
>
Defined in
getTracer
▸ getTracer(): Tracer
get the opentelemetry tracer of the service
Returns
Tracer
Defined in
registerCommand
▸ registerCommand(commandDefinition
): Promise
<void
>
Registers a new command for the service
Parameters
Name | Type | Description |
---|---|---|
commandDefinition | CommandDefinition | the service command definition |
Returns
Promise
<void
>
Defined in
registerSubscription
▸ registerSubscription(subscriptionDefinition
): Promise
<void
>
Registers a new subscription for the service
Parameters
Name | Type | Description |
---|---|---|
subscriptionDefinition | SubscriptionDefinition | the subscription definition |
Returns
Promise
<void
>
Defined in
start
▸ start(): Promise
<void
>
Start the service
Returns
Promise
<void
>
Defined in
startActiveSpan
▸ startActiveSpan<F
>(name
, opts
, context
, fn
): Promise
<F
>
Start a new active opentelemetry span with given options. A active span will be below the current span in hierarchy
Type parameters
Name |
---|
F |
Parameters
Name | Type | Description |
---|---|---|
name | string | the name of the span |
opts | SpanOptions | the additional span options |
context | undefined | Context | the span context |
fn | (span : Span ) => Promise <F > | the function to be wrapped into the span |
Returns
Promise
<F
>
Defined in
wrapInSpan
▸ wrapInSpan<F
>(name
, opts
, fn
, context?
): Promise
<F
>
Wrap the given function in a opententelemetry span. The span will be on same hierarchy level as the current span.
Type parameters
Name |
---|
F |
Parameters
Name | Type | Description |
---|---|---|
name | string | the name of the span |
opts | SpanOptions | the additional span options |
fn | (span : Span ) => Promise <F > | the function to be wrapped in span |
context? | Context | the span context |
Returns
Promise
<F
>