Skip to content

Commit

Permalink
serverless: add http.route tag when available
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellzy committed Nov 24, 2023
1 parent 8269452 commit 67adb80
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/serverless/trigger/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func GetTagsFromAPIGatewayEvent(event events.APIGatewayProxyRequest) map[string]
}
httpTags["http.url_details.path"] = event.RequestContext.Path
httpTags["http.method"] = event.RequestContext.HTTPMethod
httpTags["http.route"] = event.Resource
if event.Headers != nil {
if event.Headers["Referer"] != "" {
httpTags["http.referer"] = event.Headers["Referer"]
Expand All @@ -128,6 +129,7 @@ func GetTagsFromAPIGatewayV2HTTPRequest(event events.APIGatewayV2HTTPRequest) ma
httpTags["http.url"] = event.RequestContext.DomainName
httpTags["http.url_details.path"] = event.RequestContext.HTTP.Path
httpTags["http.method"] = event.RequestContext.HTTP.Method
httpTags["http.route"] = event.RouteKey
if event.Headers != nil {
if event.Headers["Referer"] != "" {
httpTags["http.referer"] = event.Headers["Referer"]
Expand Down Expand Up @@ -164,6 +166,7 @@ func GetTagsFromAPIGatewayCustomAuthorizerRequestTypeEvent(event events.APIGatew
httpTags := make(map[string]string)
httpTags["http.url_details.path"] = event.RequestContext.Path
httpTags["http.method"] = event.HTTPMethod
httpTags["http.route"] = event.Resource
if referer := event.Headers["Referer"]; referer != "" {
httpTags["http.referer"] = referer
}
Expand Down

0 comments on commit 67adb80

Please sign in to comment.