Skip to content

Instantly share code, notes, and snippets.

View AliBakerSartawi's full-sized avatar

Ali Baker Sartawi AliBakerSartawi

View GitHub Profile
@AliBakerSartawi
AliBakerSartawi / attr.decorator.ts
Created November 11, 2023 06:22
OTEL Attribute Decorator
import { ATTR_METADATA_KEY } from './constants';
import { AttrKey, AttrMetadata } from './types';
/**
* Sets a custom attribute key on a parameter so that it can be picked up
* by the Span decorator and mapped to the args values.
*/
export function Attr(key: AttrKey): ParameterDecorator {
return function (
target: NonNullable<unknown>,