You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by "srijeet0406 (via GitHub)" <gi...@apache.org> on 2023/08/15 21:14:07 UTC
[GitHub] [trafficcontrol] srijeet0406 opened a new pull request, #7720: Api v5 should return RFC3339 timestamps for Delivery Service Servers
srijeet0406 opened a new pull request, #7720:
URL: https://github.com/apache/trafficcontrol/pull/7720
<!--
Thank you for contributing! Please be sure to read our contribution guidelines: https://github.com/apache/trafficcontrol/blob/master/CONTRIBUTING.md
If this closes or relates to an existing issue, please reference it using one of the following:
Closes: #ISSUE
Related: #ISSUE
If this PR fixes a security vulnerability, DO NOT submit! Instead, contact
the Apache Traffic Control Security Team at security@trafficcontrol.apache.org and follow the
guidelines at https://apache.org/security regarding vulnerability disclosure.
-->
This PR is not related to any issue. It changes the timestamps returned in api v5 for deliveryserviceservers to be in RFC3339 format.
<!-- **^ Add meaningful description above** --><hr/>
## Which Traffic Control components are affected by this PR?
<!-- Please delete all components from this list that are NOT affected by this PR.
Feel free to add the name of a tool or script that is affected but not on the list.
-->
- Documentation
- Traffic Ops
## What is the best way to verify this PR?
<!-- Please include here ALL the steps necessary to test your PR.
If your PR has tests (and most should), provide the steps needed to run the tests.
If not, please provide step-by-step instructions to test the PR manually and explain why your PR does not need tests. -->
Make sure all the tests pass.
Hit the `deliveryserviceservers` endpoint for v5 and verify that the timestamps returned are in RFC3339 format.
## If this is a bugfix, which Traffic Control versions contained the bug?
<!-- Delete this section if the PR is not a bugfix, or if the bug is only in the master branch.
Examples:
- 5.1.2
- 5.1.3 (RC1)
-->
- master
## PR submission checklist
- [ ] This PR has tests <!-- If not, please delete this text and explain why this PR does not need tests. -->
- [x] This PR has documentation <!-- If not, please delete this text and explain why this PR does not need documentation. -->
- [x] This PR has a CHANGELOG.md entry <!-- A fix for a bug from an ATC release, an improvement, or a new feature should have a changelog entry. -->
- [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://apache.org/security) for details)
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] gbkannan89 commented on a diff in pull request #7720: Api v5 should return RFC3339 timestamps for Delivery Service Servers
Posted by "gbkannan89 (via GitHub)" <gi...@apache.org>.
gbkannan89 commented on code in PR #7720:
URL: https://github.com/apache/trafficcontrol/pull/7720#discussion_r1298706272
##########
CHANGELOG.md:
##########
Review Comment:
Commenting to add me in reviewers group.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] codecov[bot] commented on pull request #7720: Api v5 should return RFC3339 timestamps for Delivery Service Servers
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #7720:
URL: https://github.com/apache/trafficcontrol/pull/7720#issuecomment-1679617521
## [Codecov](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#7720](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (c38a369) into [master](https://app.codecov.io/gh/apache/trafficcontrol/commit/75ec56fa1bc4cf9c9e9ba54bde92197d4381649d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (75ec56f) will **decrease** coverage by `35.77%`.
> Report is 67 commits behind head on master.
> The diff coverage is `9.39%`.
> :exclamation: Current head c38a369 differs from pull request most recent head 87d2555. Consider uploading reports for the commit 87d2555 to get more accurate results
```diff
@@ Coverage Diff @@
## master #7720 +/- ##
=============================================
- Coverage 65.05% 29.29% -35.77%
Complexity 98 98
=============================================
Files 314 593 +279
Lines 12365 74415 +62050
Branches 907 90 -817
=============================================
+ Hits 8044 21799 +13755
- Misses 3968 50540 +46572
- Partials 353 2076 +1723
```
| Flag | Coverage Δ | |
|---|---|---|
| traffic_portal_v2 | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Files Changed](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [cache-config/t3c-apply/config/config.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y2FjaGUtY29uZmlnL3QzYy1hcHBseS9jb25maWcvY29uZmlnLmdv) | `0.00% <0.00%> (ø)` | |
| [cache-config/t3c-apply/torequest/cmd.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y2FjaGUtY29uZmlnL3QzYy1hcHBseS90b3JlcXVlc3QvY21kLmdv) | `0.00% <0.00%> (ø)` | |
| [cache-config/t3c-check-refs/t3c-check-refs.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y2FjaGUtY29uZmlnL3QzYy1jaGVjay1yZWZzL3QzYy1jaGVjay1yZWZzLmdv) | `1.78% <0.00%> (ø)` | |
| [cache-config/t3c-generate/cfgfile/varnish.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y2FjaGUtY29uZmlnL3QzYy1nZW5lcmF0ZS9jZmdmaWxlL3Zhcm5pc2guZ28=) | `0.00% <0.00%> (ø)` | |
| [cache-config/t3c-generate/config/config.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y2FjaGUtY29uZmlnL3QzYy1nZW5lcmF0ZS9jb25maWcvY29uZmlnLmdv) | `0.81% <0.00%> (-0.08%)` | :arrow_down: |
| [cache-config/t3c-generate/t3c-generate.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y2FjaGUtY29uZmlnL3QzYy1nZW5lcmF0ZS90M2MtZ2VuZXJhdGUuZ28=) | `0.00% <ø> (ø)` | |
| [lib/go-atscfg/parentabstraction.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-bGliL2dvLWF0c2NmZy9wYXJlbnRhYnN0cmFjdGlvbi5nbw==) | `79.47% <ø> (ø)` | |
| [lib/go-tc/cdns.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-bGliL2dvLXRjL2NkbnMuZ28=) | `0.00% <ø> (ø)` | |
| [lib/go-tc/deliveryservice\_servers.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-bGliL2dvLXRjL2RlbGl2ZXJ5c2VydmljZV9zZXJ2ZXJzLmdv) | `0.00% <0.00%> (ø)` | |
| [lib/go-tc/federation\_resolver.go](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-bGliL2dvLXRjL2ZlZGVyYXRpb25fcmVzb2x2ZXIuZ28=) | `45.45% <0.00%> (ø)` | |
| ... and [35 more](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
... and [458 files with indirect coverage changes](https://app.codecov.io/gh/apache/trafficcontrol/pull/7720/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] srijeet0406 commented on a diff in pull request #7720: Api v5 should return RFC3339 timestamps for Delivery Service Servers
Posted by "srijeet0406 (via GitHub)" <gi...@apache.org>.
srijeet0406 commented on code in PR #7720:
URL: https://github.com/apache/trafficcontrol/pull/7720#discussion_r1302052996
##########
traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go:
##########
@@ -170,7 +170,30 @@ func ReadDSSHandler(w http.ResponseWriter, r *http.Request) {
if err == nil && results == nil {
w.WriteHeader(http.StatusNotModified)
}
- api.WriteRespRaw(w, r, results)
+ if inf.Version.GreaterThanOrEqualTo(&api.Version{
+ Major: 5,
+ Minor: 0,
+ }) {
+ var resultsV5 tc.DeliveryServiceServerResponseV5
+ resultsV5.Limit = results.Limit
+ resultsV5.Orderby = results.Orderby
+ resultsV5.Size = results.Size
+ resultsV5.Alerts = results.Alerts
+ resultsV5.Response = *upgrade(results.Response)
+ api.WriteRespRaw(w, r, resultsV5)
+ } else {
+ api.WriteRespRaw(w, r, results)
+ }
+}
+
+func upgrade(dsServers []tc.DeliveryServiceServer) *[]tc.DeliveryServiceServerV5 {
Review Comment:
This is a private function, and we don't really put comments on those.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] srijeet0406 commented on a diff in pull request #7720: Api v5 should return RFC3339 timestamps for Delivery Service Servers
Posted by "srijeet0406 (via GitHub)" <gi...@apache.org>.
srijeet0406 commented on code in PR #7720:
URL: https://github.com/apache/trafficcontrol/pull/7720#discussion_r1302067054
##########
traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go:
##########
@@ -170,7 +170,30 @@ func ReadDSSHandler(w http.ResponseWriter, r *http.Request) {
if err == nil && results == nil {
w.WriteHeader(http.StatusNotModified)
}
- api.WriteRespRaw(w, r, results)
+ if inf.Version.GreaterThanOrEqualTo(&api.Version{
+ Major: 5,
+ Minor: 0,
+ }) {
+ var resultsV5 tc.DeliveryServiceServerResponseV5
+ resultsV5.Limit = results.Limit
+ resultsV5.Orderby = results.Orderby
+ resultsV5.Size = results.Size
+ resultsV5.Alerts = results.Alerts
+ resultsV5.Response = *upgrade(results.Response)
+ api.WriteRespRaw(w, r, resultsV5)
+ } else {
+ api.WriteRespRaw(w, r, results)
+ }
+}
+
+func upgrade(dsServers []tc.DeliveryServiceServer) *[]tc.DeliveryServiceServerV5 {
+ dsServersV5 := make([]tc.DeliveryServiceServerV5, len(dsServers))
+ for i, s := range dsServers {
+ dsServersV5[i].Server = s.Server
+ dsServersV5[i].DeliveryService = s.DeliveryService
+ dsServersV5[i].LastUpdated, _ = util.ConvertTimeFormat(s.LastUpdated.Time, time.RFC3339)
Review Comment:
In my latest commit, I have ensured that if there is an error, the time will just be set to `s.LastUpdated.Time`.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] gbkannan89 commented on a diff in pull request #7720: Api v5 should return RFC3339 timestamps for Delivery Service Servers
Posted by "gbkannan89 (via GitHub)" <gi...@apache.org>.
gbkannan89 commented on code in PR #7720:
URL: https://github.com/apache/trafficcontrol/pull/7720#discussion_r1300518023
##########
traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go:
##########
@@ -170,7 +170,30 @@ func ReadDSSHandler(w http.ResponseWriter, r *http.Request) {
if err == nil && results == nil {
w.WriteHeader(http.StatusNotModified)
}
- api.WriteRespRaw(w, r, results)
+ if inf.Version.GreaterThanOrEqualTo(&api.Version{
+ Major: 5,
+ Minor: 0,
+ }) {
+ var resultsV5 tc.DeliveryServiceServerResponseV5
+ resultsV5.Limit = results.Limit
+ resultsV5.Orderby = results.Orderby
+ resultsV5.Size = results.Size
+ resultsV5.Alerts = results.Alerts
+ resultsV5.Response = *upgrade(results.Response)
+ api.WriteRespRaw(w, r, resultsV5)
+ } else {
+ api.WriteRespRaw(w, r, results)
+ }
+}
+
+func upgrade(dsServers []tc.DeliveryServiceServer) *[]tc.DeliveryServiceServerV5 {
Review Comment:
Add a comment to the upgrade function explaining its purpose and what it does might help others.
##########
traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go:
##########
@@ -170,7 +170,30 @@ func ReadDSSHandler(w http.ResponseWriter, r *http.Request) {
if err == nil && results == nil {
w.WriteHeader(http.StatusNotModified)
}
- api.WriteRespRaw(w, r, results)
+ if inf.Version.GreaterThanOrEqualTo(&api.Version{
+ Major: 5,
+ Minor: 0,
+ }) {
+ var resultsV5 tc.DeliveryServiceServerResponseV5
+ resultsV5.Limit = results.Limit
+ resultsV5.Orderby = results.Orderby
+ resultsV5.Size = results.Size
+ resultsV5.Alerts = results.Alerts
+ resultsV5.Response = *upgrade(results.Response)
+ api.WriteRespRaw(w, r, resultsV5)
+ } else {
+ api.WriteRespRaw(w, r, results)
+ }
+}
+
+func upgrade(dsServers []tc.DeliveryServiceServer) *[]tc.DeliveryServiceServerV5 {
+ dsServersV5 := make([]tc.DeliveryServiceServerV5, len(dsServers))
+ for i, s := range dsServers {
+ dsServersV5[i].Server = s.Server
+ dsServersV5[i].DeliveryService = s.DeliveryService
+ dsServersV5[i].LastUpdated, _ = util.ConvertTimeFormat(s.LastUpdated.Time, time.RFC3339)
Review Comment:
will there be any possibility of error in this conversion ? if yes, can we consider returning an error if the conversion fails.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] shamrickus merged pull request #7720: Api v5 should return RFC3339 timestamps for Delivery Service Servers
Posted by "shamrickus (via GitHub)" <gi...@apache.org>.
shamrickus merged PR #7720:
URL: https://github.com/apache/trafficcontrol/pull/7720
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org