cmd/scollector: Added Azure Enterprise Agreement billing collector #1903

Merged
merged 2 commits into from Nov 18, 2016

Conversation

Projects
None yet
2 participants
@mhenderson-so
Contributor

mhenderson-so commented Sep 8, 2016

Added Azure Enterprise Agreement billing collector into scollector.

+ "bosun.org/opentsdb"
+)
+
+var azureeabillingconfig = azureEABillingConfig{}

This comment has been minimized.

@kylebrandt

kylebrandt Sep 20, 2016

Member

casing

This comment has been minimized.

@kylebrandt

kylebrandt Sep 20, 2016

Member

Also since it is used a a lot I would make it shorter. AzBillConf maybe .. or something better

@kylebrandt

kylebrandt Sep 20, 2016

Member

Also since it is used a a lot I would make it shorter. AzBillConf maybe .. or something better

@kylebrandt

style comments mostly, haven't got into logic yet. Is the CSV helper lib really helping that much or would it be simple to use the standard encoding?

+ }
+
+ //Process the report list
+ err = processAzureEAReports(reports, &md)

This comment has been minimized.

@kylebrandt

kylebrandt Sep 20, 2016

Member

if err ...; err != nil { sytax is better here

@kylebrandt

kylebrandt Sep 20, 2016

Member

if err ...; err != nil { sytax is better here

+ thisMonth := baseTime.Format("2006-01")
+ lastMonth := time.Date(baseTime.Year(), baseTime.Month()-1, 1, 0, 0, 0, 0, time.UTC).Format("2006-01")
+ for _, r := range reports.AvailableMonths {
+ if thisMonth == r.Month || lastMonth == r.Month {

This comment has been minimized.

@kylebrandt

kylebrandt Sep 20, 2016

Member

inverse condition to and continue so rest of code is not indented

@kylebrandt

kylebrandt Sep 20, 2016

Member

inverse condition to and continue so rest of code is not indented

+ for _, r := range reports.AvailableMonths {
+ if thisMonth == r.Month || lastMonth == r.Month {
+ csv := azureeabillingconfig.AZEABillingConfig.GetMonthReportsCSV(r, azureeabilling.DownloadForStructs)
+ ioutil.WriteFile("c:\\temp\\ea-price.csv", []byte(csv.PriceSheetReport), 0755)

This comment has been minimized.

@kylebrandt

kylebrandt Sep 20, 2016

Member

whaaaa... c:\ ???

@kylebrandt

kylebrandt Sep 20, 2016

Member

whaaaa... c:\ ???

+ resourceString = fmt.Sprintf("%s-%s", strings.ToLower(p.ResourceGroup), resourceString)
+ }
+
+ resourceString, _ = opentsdb.Clean(resourceString)

This comment has been minimized.

@kylebrandt

kylebrandt Sep 20, 2016

Member

ignoring err intentional, if so comment maybe

@kylebrandt

kylebrandt Sep 20, 2016

Member

ignoring err intentional, if so comment maybe

@mhenderson-so

This comment has been minimized.

Show comment
Hide comment
@mhenderson-so

mhenderson-so Nov 18, 2016

Contributor

The CSV library was very helpful - the standard library choked because the Azure CSV is formatted stupidly. This new library also allows the fields to potentially be re-ordered in the future, as it uses the header titles from the first line in the CSV to match them to their correct field in the struct tags when unmarshalling.

Contributor

mhenderson-so commented Nov 18, 2016

The CSV library was very helpful - the standard library choked because the Azure CSV is formatted stupidly. This new library also allows the fields to potentially be re-ordered in the future, as it uses the header titles from the first line in the CSV to match them to their correct field in the struct tags when unmarshalling.

@kylebrandt kylebrandt merged commit 746bddc into bosun-monitor:master Nov 18, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@mhenderson-so mhenderson-so deleted the mhenderson-so:AzureADBilling branch Dec 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment