rob05c commented on a change in pull request #3758: Rewrote
deliveryservice_stats to Go
URL: https://github.com/apache/trafficcontrol/pull/3758#discussion_r329158147
##########
File path: traffic_ops/traffic_ops_golang/api/api.go
##########
@@ -369,6 +382,78 @@ func (inf *APIInfo) Close() {
}
}
+// CreateInfluxClient onstructs and returns an InfluxDB HTTP client, if
enabled and when possible.
+// The error this returns should not be exposed to the user; it's for logging
purposes only.
+//
+// If Influx connections are not enabled, this will return `nil` - but also no
error. It is expected
+// that the caller will handle this situation appropriately.
+func (inf *APIInfo) CreateInfluxClient() (c *influx.Client, e error) {
+ if !inf.Config.InfluxEnabled {
+ return
+ }
+
+ var fqdn string
+ var TCPPort uint
Review comment:
>That section indicates initialisms and abbreviations can be uppercased.
I'll change fqdn to match.
They can, but local variables should always start with lowercase, hence
public and global symbols starting with initialisms should be e.g. `URLFoo`,
and private and local should be `urlFoo`.
Local variables should always start with lowercase, because Go exports
symbols starting with uppercase, and does not export lowercase. Of course, a
local variable in a function can't be viewed from an outside scope. So it makes
it very odd and confusing for a local var to be uppercase="exported." If
nothing else, if a future reader sees that symbol uses further down in the
func, and doesn't notice it's local, they're going to assume it's an exported
global variable and be confused.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services