Skip to content

Commit

Permalink
0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ovx committed Feb 12, 2024
1 parent 775bc67 commit e704bfa
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions dist/instruments/traces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { TraceSpan } from '@exotjs/trace/types';
export declare class TracesInstrument extends BaseInstrument {
readonly tracer: Tracer;
constructor(store: Store, init?: BaseInstrumentInit);
get addAttribute(): (span: TraceSpan, name: string, value: unknown) => void;
get addEvent(): (span: TraceSpan, text: string, attributes?: import("@exotjs/trace/types").Attributes | undefined) => void;
get endSpan(): (span: TraceSpan) => TraceSpan | undefined;
get startSpan(): (name: string, parent?: TraceSpan | undefined) => TraceSpan;
get trace(): <T>(name: string, fn: (ctx: import("@exotjs/trace/types").TraceContext) => T | Promise<T>, options?: import("@exotjs/trace/types").TraceOptions | undefined) => T | Promise<T>;
Expand Down
6 changes: 6 additions & 0 deletions dist/instruments/traces.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export class TracesInstrument extends BaseInstrument {
}
});
}
get addAttribute() {
return this.tracer.addAttribute;
}
get addEvent() {
return this.tracer.addEvent;
}
get endSpan() {
return this.tracer.endSpan;
}
Expand Down
6 changes: 2 additions & 4 deletions example/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ server.on('request', async (req, res) => {

case '/trace':
const span = inspector.instruments.traces.startSpan('request');
span.attributes = {
method: req.method,
path: req.url || '/',
};
inspector.instruments.traces.addAttribute(span, 'method', req.method);
inspector.instruments.traces.addAttribute(span, 'path', req.url || '/');
await inspector.instruments.traces.trace('db:select',
() => {
return delay(250);
Expand Down
8 changes: 8 additions & 0 deletions lib/instruments/traces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ export class TracesInstrument extends BaseInstrument {
});
}

get addAttribute() {
return this.tracer.addAttribute;
}

get addEvent() {
return this.tracer.addEvent;
}

get endSpan() {
return this.tracer.endSpan;
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@exotjs/inspector",
"version": "0.1.6",
"version": "0.1.7",
"description": "Exot application inspector",
"author": "Daniel Regeci",
"license": "MIT",
Expand Down Expand Up @@ -57,7 +57,7 @@
},
"dependencies": {
"@exotjs/measurements": "0.1.4",
"@exotjs/trace": "0.1.2"
"@exotjs/trace": "0.1.3"
},
"devDependencies": {
"@types/node": "^20.9.0",
Expand Down

0 comments on commit e704bfa

Please sign in to comment.