-
Notifications
You must be signed in to change notification settings - Fork 491
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
cmd/scollector: Added Azure Enterprise Agreement billing collector #1903
Conversation
"bosun.org/opentsdb" | ||
) | ||
|
||
var azureeabillingconfig = azureEABillingConfig{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
casing
There was a problem hiding this comment.
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
There was a problem hiding this 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) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
569fa2b
to
5f46c13
Compare
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. |
Added Azure Enterprise Agreement billing collector into scollector.