Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 18, 2016

Conversation

mhenderson-so
Copy link
Contributor

Added Azure Enterprise Agreement billing collector into scollector.

"bosun.org/opentsdb"
)

var azureeabillingconfig = azureEABillingConfig{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

casing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

@kylebrandt kylebrandt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whaaaa... c:\ ???

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

resourceString, _ = opentsdb.Clean(resourceString)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignoring err intentional, if so comment maybe

@mhenderson-so
Copy link
Contributor Author

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
@mhenderson-so mhenderson-so deleted the AzureADBilling branch December 14, 2016 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants