Documentation ¶
Overview ¶
Package activitylog handles the logging of user actions performed within the app for diagnostic and auditing purposes. The activity log records each page view and each api endpoint hit. The request data is saved but the response data is not (because we would need to write our own http response writer interface). Activity logging also works for public api calls.
Index ¶
- func Clear(w http.ResponseWriter, r *http.Request)
- func DurationByEndpoint(w http.ResponseWriter, r *http.Request)
- func GetLatest(w http.ResponseWriter, r *http.Request)
- func GetLatestEndpoints(w http.ResponseWriter, r *http.Request)
- func LatestRequestsDuration(w http.ResponseWriter, r *http.Request)
- func MaxAndAvgMonthlyDuration(w http.ResponseWriter, r *http.Request)
- func OverTimeOfDay(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clear ¶
func Clear(w http.ResponseWriter, r *http.Request)
Clear handles deleting rows from the activity log table. This is only done from the admin tools page and is done to clean up the database since the activity log table can get very big.
The user provides a starting date to delete from, this way you can delete very old activity log rows but keep newer history.
func DurationByEndpoint ¶
func DurationByEndpoint(w http.ResponseWriter, r *http.Request)
DurationByEndpoint gets the duration it took the server/app the response grouped by endpoint. This is useful for identifying the slowest/most latent endpoints.
func GetLatest ¶
func GetLatest(w http.ResponseWriter, r *http.Request)
GetLatest retrieves the data of the latest user and API actions within the app. This is useful for auditing user activity and for diagnnostics (seeing what data a user provided versus what they say when an error occurs). You can filter the results by a specific user, a specific API key, a specific endpoint, and/or a search string. Using a search string performs a sql LIKE query with starting & ending wildcards on the request data (post form values).
func GetLatestEndpoints ¶
func GetLatestEndpoints(w http.ResponseWriter, r *http.Request)
GetLatestEndpoints looks up the list of a user can pick from to filter the list of latest activites by (see GetLatest). This simply looks up the list of endpoints "hit" over the last 30 days.
func LatestRequestsDuration ¶
func LatestRequestsDuration(w http.ResponseWriter, r *http.Request)
LatestRequestsDuration gets the duration it took the app/server to respond to the latest HTTP requests.
func MaxAndAvgMonthlyDuration ¶
func MaxAndAvgMonthlyDuration(w http.ResponseWriter, r *http.Request)
MaxAndAvgMonthlyDuration retrieves the maximum and average duration of times it took the app/server to respond to an HTTP request. This measures app/server latency in handling requests and is useful to see if latency is increasing for some reason.
func OverTimeOfDay ¶
func OverTimeOfDay(w http.ResponseWriter, r *http.Request)
OverTimeOfDay gets the number of requests per time of day. This is used to tell you when the app is most used (when your users are most active in the app).
Types ¶
This section is empty.