Skip to main content
Module

x/observability/mod.ts>Resource

WIP module for instrumenting Deno programs with OpenTelemetry, transmitting traces and metrics in a standard way.
Go to Latest
class Resource
implements IResource
import { Resource } from "https://deno.land/x/observability@v0.5.1/mod.ts";

A Resource describes the entity for which a signals (metrics or trace) are collected.

Constructors

new
Resource(attributes: ResourceAttributes, asyncAttributesPromise?: Promise<ResourceAttributes>)

Properties

private
optional
_asyncAttributesPromise
private
optional
_attributes
private
optional
_syncAttributes
optional
asyncAttributesPending: boolean

Check if async attributes have resolved. This is useful to avoid awaiting waitForAsyncAttributes (which will introduce asynchronous behavior) when not necessary.

readonly
attributes: ResourceAttributes

Methods

merge(other: IResource | null): IResource

Returns a new, merged Resource by merging the current Resource with the other Resource. In case of a collision, other Resource takes precedence.

optional
waitForAsyncAttributes(): Promise<void>

Returns a promise that will never be rejected. Resolves when all async attributes have finished being added to this Resource's attributes. This is useful in exporters to block until resource detection has finished.

Static Methods

default(): IResource

Returns a Resource that identifies the SDK in use.

empty(): IResource

Returns an empty Resource