cmd/scollector: fastly status.io monitoring and status.io lib #1735

Merged
merged 1 commit into from May 16, 2016

Projects

None yet

2 participants

@kylebrandt
Member

No description provided.

@kylebrandt
Member

Build failure above doesn't have to do with PR, just a timeout when shutting down bosun - so travis thing I think.

@captncraig captncraig commented on an outdated diff May 16, 2016
cmd/scollector/collectors/fastly.go
@@ -50,8 +61,89 @@ const (
fastlyBillingBeforeDiscountDesc = "The total incurred cost plus extras cost this month."
fastlyBillingDiscountDesc = "The calculated discount rate this month."
fastlyBillingCostDesc = "The final amount to be paid this month."
+
+ fastlyStatusPrefix = "fastly.status."
+ fastlyComponentStatusDesc = "The current status of the %v. 0: Operational, 1: Degraded Performance, 2: Partial Outage, 3: Major Outage." // see iota for statusio.ComponentStatus
+ fastlyScheduledMaintDesc = "The number of currently scheduled maintenances. Does not include maintenance that is current active"
+ fastlyActiveScheduledMaintDesc = "The number of currently scheduled maintenances currently in progress. Includes the 'in_progress' and 'verifying'"
+ fastlyActiveIncidentDesc = "The number of currently active incidents. Includes the 'investingating', 'identified', and 'monitoring' states."
+)
+
+var (
+ fastlyStatusPopRegex = regexp.MustCompile(`(.*)\(([A-Z]{3})\)`)
@captncraig
captncraig May 16, 2016 Contributor

a comment describing what a regex is looking for is always useful.

@captncraig captncraig commented on the diff May 16, 2016
cmd/scollector/collectors/fastly.go
+ }
+
+ // Scheduled Maintenance
+ scheduledMaintByImpact := make(map[statusio.StatusIndicator]int)
+ activeScheduledMaintByImpact := make(map[statusio.StatusIndicator]int)
+ // Make Maps
+ for _, si := range statusio.StatusIndicatorValues {
+ scheduledMaintByImpact[si] = 0
+ activeScheduledMaintByImpact[si] = 0
+ }
+ // Group by scheduled vs inprogress/verifying
+ for _, maint := range summary.ScheduledMaintenances {
+ switch maint.Status {
+ case statusio.Scheduled:
+ scheduledMaintByImpact[maint.Impact]++
+ case statusio.InProgress, statusio.Verifying:
@captncraig
captncraig May 16, 2016 Contributor

Is it worth logging in a default case? What happens if they add a new status?

@kylebrandt
kylebrandt May 16, 2016 Member

I believe the unmarshal will err since it maps to the enum
On May 16, 2016 11:50 AM, "Craig Peterson" notifications@github.com wrote:

In cmd/scollector/collectors/fastly.go
#1735 (comment):

  • }
  • // Scheduled Maintenance
  • scheduledMaintByImpact := make(map[statusio.StatusIndicator]int)
  • activeScheduledMaintByImpact := make(map[statusio.StatusIndicator]int)
  • // Make Maps
  • for _, si := range statusio.StatusIndicatorValues {
  •   scheduledMaintByImpact[si] = 0
    
  •   activeScheduledMaintByImpact[si] = 0
    
  • }
  • // Group by scheduled vs inprogress/verifying
  • for _, maint := range summary.ScheduledMaintenances {
  •   switch maint.Status {
    
  •   case statusio.Scheduled:
    
  •       scheduledMaintByImpact[maint.Impact]++
    
  •   case statusio.InProgress, statusio.Verifying:
    

Is it worth logging in a default case? What happens if they add a new
status?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/bosun-monitor/bosun/pull/1735/files/4140b74063d86880349236feeea6458422e69be5#r63375879

@captncraig
Contributor

My only issue is the size of the "library" component compared to what we actually use. I'm feeling that one of the following should be true:

  1. It is a general purpose status.io library that should be an external repo and vendored in.
  2. It is specific to the needs of this collector and should be included in bosun, but only include the bits we use now.

If this is too pedantic, I'm ok either way.

@kylebrandt
Member

I can vendor it. Make a new repo under bosun-monitor?
On May 16, 2016 11:51 AM, "Craig Peterson" notifications@github.com wrote:

My only issue is the size of the "library" component compared to what we
actually use. I'm feeling that one of the following should be true:

  1. It is a general purpose status.io library that should be an
    external repo and vendored in.
  2. It is specific to the needs of this collector and should be
    included in bosun, but only include the bits we use now.

If this is too pedantic, I'm ok either way.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#1735 (comment)

@captncraig
Contributor

sounds good to me

@kylebrandt kylebrandt cmd/scollector: fastly status.io monitoring and status.io lib
400b210
@kylebrandt kylebrandt merged commit 32623fa into master May 16, 2016

2 checks passed

bosun All checks Passed!
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@kylebrandt kylebrandt deleted the fastly_status_io branch May 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment