Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas747 committed May 6, 2021
2 parents e9a2368 + 78d42ec commit f126afd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
9 changes: 9 additions & 0 deletions common/loghooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ var (
Help: "Number of http requests to the discord API",
}, []string{"path"})

metrics429Path = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "yagpdb_discord_http_429_path_total",
Help: "Number of http requests to the discord API",
}, []string{"path"})

metricsNumRequestsResponseCode = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "yagpdb_discord_http_requests_response_code_total",
Help: "Number of http requests to the discord API",
Expand Down Expand Up @@ -201,6 +206,10 @@ func (t *LoggingTransport) RoundTrip(request *http.Request) (*http.Response, err
path = numberRemover.Replace(path)

metricsHTTPLatency.Observe(since)

if code == 429 {
metrics429Path.With(prometheus.Labels{"path": path}).Inc()
}
// metricsNumRequests.With(prometheus.Labels{"path": path})
metricsNumRequestsResponseCode.With(prometheus.Labels{"response_code": strconv.Itoa(code)}).Inc()

Expand Down
2 changes: 1 addition & 1 deletion common/patreon/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (p *Poller) Poll() {
patron.Name = user.FirstName
}

if user.SocialConnections.Discord != nil && user.SocialConnections.Discord.UserID != "" {
if user.SocialConnections != nil && user.SocialConnections.Discord != nil && user.SocialConnections.Discord.UserID != "" {
discordID, _ := strconv.ParseInt(user.SocialConnections.Discord.UserID, 10, 64)
patron.DiscordID = discordID
}
Expand Down
4 changes: 3 additions & 1 deletion premium/premium.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ func (p *Plugin) UpdateFeatureFlags(guildID int64) ([]string, error) {
return nil, errors.WithMessage(err, "GuildPremiumTier")
}

if tier > highestTier {
if tier == PremiumTierPremium {
highestTier = tier
} else if highestTier == PremiumTierNone {
highestTier = tier
}
}
Expand Down
6 changes: 6 additions & 0 deletions yagpdb_docker/app.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ YAGPDB_BOTLEAVESJOINS=
YAGPDB_AYLIENAPPID=aylien app id here
YAGPDB_AYLIENAPPKEY=aylien app key here

#Twitter
YAGPDB_TWITTER_ACCESS_TOKEN=Twitter Access Token
YAGPDB_TWITTER_ACCESS_TOKEN_SECRET=Twitter Access Token Secret
YAGPDB_TWITTER_CONSUMER_KEY=Twitter Consumer Key
YAGPDB_TWITTER_CONSUMER_SECRET=Twitter Consumer Secret

# Reddit
YAGPDB_REDDIT_CLIENTID=Reddit application clientid here
YAGPDB_REDDIT_CLIENTSECRET=Reddit application client secret here
Expand Down

0 comments on commit f126afd

Please sign in to comment.