Skip to content

Commit

Permalink
Merge pull request #157 from ahom/tr
Browse files Browse the repository at this point in the history
fix: better trace names
  • Loading branch information
ahom authored Mar 6, 2022
2 parents d0fe47e + 0f28582 commit 01f7f50
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 01f7f50

Please sign in to comment.