Skip to content
Snippets Groups Projects
Commit c52ea579 authored by Francé Wilke's avatar Francé Wilke
Browse files

Api logs webhook types

parent f41e4cfe
Branches
Tags
No related merge requests found
package api_logs
import (
"github.com/thoas/go-funk"
"net/url"
"strconv"
"strings"
......@@ -43,11 +44,17 @@ func GenerateIncomingAPILog(startTime time.Time, requestID *string, claim map[st
}
}
}
typeString := "api-incoming"
if funk.Contains(req.Path, "webhook") {
typeString = "webhook-incoming"
}
apiLog := ApiLog{
StartTime: startTime,
EndTime: endTime,
DurMs: endTime.Sub(startTime).Milliseconds(),
Type: "api-incoming",
Type: typeString,
Method: req.HTTPMethod,
Address: req.RequestContext.DomainName,
Path: req.Path,
......@@ -100,11 +107,16 @@ func GenerateOutgoingAPILog(startTime time.Time, requestID *string, claim map[st
}
}
typeString := "api-outgoing"
if funk.Contains(method, "webhook") {
typeString = "webhook-outgoing"
}
apiLog := ApiLog{
StartTime: startTime,
EndTime: endTime,
DurMs: endTime.Sub(startTime).Milliseconds(),
Type: "api-outgoing",
Type: typeString,
Method: method,
Path: parsedURL.Path,
Address: parsedURL.Host,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment