You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2020/04/20 16:00:47 UTC
[trafficcontrol] branch master updated: Dsstats math fix (#4642)
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new a8077c1 Dsstats math fix (#4642)
a8077c1 is described below
commit a8077c18c71fb59e81bf01ac69dddf84708d735b
Author: ocket8888 <oc...@apache.org>
AuthorDate: Mon Apr 20 10:00:37 2020 -0600
Dsstats math fix (#4642)
* Fixed ds stats logic to properly calculate a weird value
* Fixed docs to more accurately describe payload
---
docs/source/api/v1/deliveryservice_stats.rst | 2 +-
traffic_ops/traffic_ops_golang/trafficstats/deliveryservice.go | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/docs/source/api/v1/deliveryservice_stats.rst b/docs/source/api/v1/deliveryservice_stats.rst
index a5d59b4..464a85a 100644
--- a/docs/source/api/v1/deliveryservice_stats.rst
+++ b/docs/source/api/v1/deliveryservice_stats.rst
@@ -143,7 +143,7 @@ Response Structure
:min: The minimum value that can be found in the requested data set
:ninetyEighthPercentile: Data points with values greater than or equal to this number constitute the "top" 2% of the data set
:ninetyFifthPercentile: Data points with values greater than or equal to this number constitute the "top" 5% of the data set
- :totalBytes: When the ``metricType`` requested is ``kbps``, this will contain the total number of bytes transferred by the :term:`Delivery Service` within the requested time window. Note that fractional amounts are possible, as the data transfer rate will almost certainly not be cleanly divided by the requested time range.
+ :totalBytes: When the ``metricType`` requested is ``kbps``, this will contain the total number of *kilobytes* - **not** *bytes* - transferred by the :term:`Delivery Service` within the requested time window. Note that fractional amounts are possible, as the data transfer rate will almost certainly not be cleanly divided by the requested time range.
:totalTransactions: When the ``metricType`` requested is **not** ``kbps``, this will contain the total number of transactions completed by the :term:`Delivery Service` within the requested time window. Note that fractional amounts are possible, as the transaction rate will almost certainly not be cleanly divided by the requested time range.
:version: A legacy field that seems to have been meant to indicate the API version used. Will always be "1.2"
diff --git a/traffic_ops/traffic_ops_golang/trafficstats/deliveryservice.go b/traffic_ops/traffic_ops_golang/trafficstats/deliveryservice.go
index 0bb3bd6..82d547d 100644
--- a/traffic_ops/traffic_ops_golang/trafficstats/deliveryservice.go
+++ b/traffic_ops/traffic_ops_golang/trafficstats/deliveryservice.go
@@ -277,7 +277,8 @@ func getDSSummary(client *influx.Client, conf *tc.TrafficDSStatsConfig, db strin
value := float64(s.Count*60) * s.Average
if conf.MetricType == "kbps" {
- value /= 1000
+ // TotalBytes is actually in units of kB....
+ value /= 8
s.TotalBytes = &value
} else {
s.TotalTransactions = &value