Skip to content

Commit

Permalink
fix: better trace names
Browse files Browse the repository at this point in the history
  • Loading branch information
ahom committed Mar 6, 2022
1 parent d0fe47e commit 0f28582
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export interface HttpEvent {
pathParameters?: Parameters,
queryStringParameters?: Parameters,
rawPath?: string,
rawQueryString?: string
rawQueryString?: string,
routeKey?: string
}

interface ErrorMessage {
Expand Down Expand Up @@ -140,11 +141,14 @@ export class HttpRequest {
if (!segment) {
await exec();
} else {
const subSegment = segment?.addNewSubsegment(`Toaztr-${segment.name}`);
const subSegment = segment?.addNewSubsegment(`Toaztr-${this.event.routeKey?.replace(' ', '-')}`);
subSegment.addAttribute('namespace', 'remote');
subSegment.addAttribute('origin', 'Toaztr::HTTP');
await getNamespace().runPromise(async function() {
setSegment(subSegment);
await exec();
}).finally(() => {
setSegment(segment);
});
subSegment.addAttribute('http', {
request: {
Expand Down

0 comments on commit 0f28582

Please sign in to comment.