ocket8888 opened a new pull request #3758: Rewrote deliveryservice_stats to Go
URL: https://github.com/apache/trafficcontrol/pull/3758
 
 
   ## What does this PR (Pull Request) do?
   
   - [x] This PR fixes #3416 
   Rewrote the `/deliveryservice_stats` endpoint in Go. Also adds a set of 
functionality to the go-tc library for dealing with MIME Types, hopefully to 
aid with content negotiation in other endpoints.
   
   This has some differences in behavior with the old Perl route, however the 
things that changed were mainly undocumented.
   
   ### Differences
   - `deliveryServiceName` is no longer a required parameter. Instead, it is 
required that the client submit *either* `deliveryServiceName` - which must be 
an XMLID - *or* `deliveryService` - which may be either an integral, unique 
identifier or an XMLID.
   - The `interval` query parameter is now restricted to one of:
       - 1m
       - 5m
       - 1h
       - 6h
       - 1d
       - 1w
       - 4w
   - The `startDate` and `endDate` query parameters now accept their inputs 
strictly in RFC3339 format (with optional sub-second precision) or as a number 
of nanoseconds since the Unix Epoch. Previously they accepted anything 
compliant with ISO 8601 - which included RFC3339 format (but **only** without 
sub-second precision, which was a bug) - and the `endDate` parameter could 
accept the special value `now`. It no longer does.
   - Timestamps in data series as output can now be in one of two formats, as 
specified by the client. By default, the output is in RFC3339 format (without 
sub-second precision), but optionally they can be presented as the number of 
nanoseconds since the Unix Epoch. The distinction is made by adding a 
non-standard parameter to the `application/json` media type in the `Accept` 
header. The parameter is `timestamp`, and it can have one of two values:
       - `rfc` - indicates that the timestamps should be returned in RFC3339 
format. This isn't required, since it matches the default behavior.
       - `unix` - indicates that the timestamps should be returned as a number 
of nanoseconds since the Unix Epoch.
   - Previously, `metricType` values could include the undocumented 
`out_bytes`, `status_4xx`, and `status_5xx`. These didn't actually work, but 
they returned a success. They are no longer allowed.
   - The undocumented response field `language` is no longer returned.
   - The endpoint now respects tenancy, and will feign ignorance of a Delivery 
Service to which the client is forbidden access.
   
   ## Which Traffic Control components are affected by this PR?
   - CDN in a Box
   - Documentation
   - Traffic Ops
   - Traffic Portal
   
   ## What is the best way to verify this PR?
   Check the output of the `deliveryservice_stats` endpoint against the old 
Perl version. It won't match exactly even for the same requested range, since 
I've made an attempt to fix an issue with Influx where it will return data 
points outside of said range. It doesn't always work, but should improve the 
reliability.
   
   ## The following criteria are ALL met by this PR
   
   - [x] This PR includes tests
   - [x] This PR includes documentation
   - [x] This PR includes an update to CHANGELOG.md
   - [x] This PR includes any and all required license headers
   - [x] This PR does not include a database migration
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY**

----------------------------------------------------------------
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

Reply via email to