Skip to content

Commit

Permalink
Add some rudimentary telemetry.
Browse files Browse the repository at this point in the history
  • Loading branch information
patfair committed May 29, 2024
1 parent 0a13bc1 commit d1c63e9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion partner/tba.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,15 @@ func (client *TbaClient) postRequest(resource string, action string, body []byte
}
request.Header.Add("X-TBA-Auth-Id", client.secretId)
request.Header.Add("X-TBA-Auth-Sig", signature)
return httpClient.Do(request)
response, err := httpClient.Do(request)
if client.BaseUrl == tbaBaseUrl && err == nil && response.StatusCode == 200 {
// Send a non-blocking ping to track usage.
pingRequest, _ := http.NewRequest(
"POST", fmt.Sprintf("https://cheesyarena.com/events/%s/%s", client.eventCode, resource), nil,
)
_, _ = httpClient.Do(pingRequest)
}
return response, err
}

func createTbaAlliance(teamIds [3]int, surrogates [3]bool, score *int, cards map[string]string) *TbaAlliance {
Expand Down

0 comments on commit d1c63e9

Please sign in to comment.