Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Rewrite GET stats_summary from Perl to Golang#4127

Merged
ocket8888 merged 19 commits into
apache:masterfrom
mhoppa:feature/rewrite_stats_summary
Jan 3, 2020
Merged

Rewrite GET stats_summary from Perl to Golang#4127
ocket8888 merged 19 commits into
apache:masterfrom
mhoppa:feature/rewrite_stats_summary

Conversation

@mhoppa

@mhoppa mhoppa commented Nov 19, 2019

Copy link
Copy Markdown
Contributor

What does this PR (Pull Request) do?

Which Traffic Control components are affected by this PR?

  • Documentation
  • Traffic Control Golang Client
  • Traffic Ops
  • Traffic Stats

What is the best way to verify this PR?

Run API tests (once added to PR) or pull down and manually test to ensure stats summary matches parity with perl implementation

If this is a bug fix, what versions of Traffic Control are affected?

The following criteria are ALL met by this PR

  • This PR includes tests OR I have explained why tests are unnecessary
  • This PR includes documentation OR I have explained why documentation is unnecessary
  • This PR includes an update to CHANGELOG.md OR such an update is not necessary
  • This PR includes any and all required license headers
  • This PR ensures that database migration sequence is correct OR this PR does not include a database migration
  • This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY (see the Apache Software Foundation's security guidelines for details)

Additional Information

@asf-ci

asf-ci commented Nov 19, 2019

Copy link
Copy Markdown
Contributor

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4795/

@mhoppa
mhoppa marked this pull request as ready for review December 3, 2019 00:03
@mhoppa mhoppa changed the title WIP - Rewrite GET stats_summary from Perl to Golang Rewrite GET stats_summary from Perl to Golang Dec 3, 2019
@asf-ci

asf-ci commented Dec 3, 2019

Copy link
Copy Markdown
Contributor

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4851/

@asf-ci

asf-ci commented Dec 3, 2019

Copy link
Copy Markdown
Contributor

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4852/

@ocket8888 ocket8888 added this to the Go Rewrite milestone Dec 3, 2019
@ocket8888 ocket8888 added documentation related to documentation TO Client (Go) related to the Go implementation of a TC client Traffic Ops related to Traffic Ops Traffic Stats related to Traffic Stats labels Dec 3, 2019
@asf-ci

asf-ci commented Dec 3, 2019

Copy link
Copy Markdown
Contributor

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4856/

@asf-ci

asf-ci commented Dec 3, 2019

Copy link
Copy Markdown
Contributor

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4858/

@ocket8888 ocket8888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that we vendored ourselves there

Comment thread docs/source/api/stats_summary.rst Outdated
Comment thread docs/source/api/stats_summary.rst Outdated
Comment thread docs/source/api/stats_summary.rst Outdated
Comment thread traffic_ops/traffic_ops_golang/trafficstats/stats_summary.go
Comment thread traffic_ops/client/stats_summary.go
Comment thread traffic_ops/client/stats_summary.go
Comment thread traffic_ops/client/stats_summary.go Outdated
Comment thread traffic_ops/testing/api/v14/stats_summary_test.go Outdated
Comment thread traffic_ops/testing/api/v14/stats_summary_test.go Outdated
Comment thread traffic_ops/testing/api/v14/stats_summary_test.go Outdated
@ocket8888 ocket8888 self-assigned this Dec 4, 2019

@mhoppa mhoppa left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will reach out to the mailing list on client changes

Comment thread traffic_ops/traffic_ops_golang/trafficstats/stats_summary.go
@asf-ci

asf-ci commented Dec 5, 2019

Copy link
Copy Markdown
Contributor

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4876/

@mhoppa mhoppa mentioned this pull request Dec 6, 2019
7 tasks
@mitchell852

Copy link
Copy Markdown
Member

I tried testing this out with ciab but only got an empty response for the call to GET /api/1.4/stats_summary. Since @ocket8888 has done the review, I'll leave it to him to test it as maybe he knows a better way than me.

@mhoppa

mhoppa commented Dec 12, 2019

Copy link
Copy Markdown
Contributor Author

@mitchell852 yeah the stats_summary is done daily from TS so you would either have to POST to /stats_summary/create or have TS up for a day.

@ocket8888 ocket8888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I POSTed some data to stats_summary/create and tried to GET it, got an Internal Server Error:

trafficops_1       | ERROR: api.go:136: 2019-12-17T16:51:56.838201203Z: 172.19.0.1:34626 scanning stats summary: sql: Scan error on column index 6, name "stat_date": unsupported Scan, storing driver.Value type <nil> into type *time.Time

(which seems weird to me because I think nil is a valid pointer value? maybe it means *time.Time cannot be a reference to a pointer value?)

The data I POSTed:

{
	"cdnName": "CDN-in-a-Box",
	"deliveryserviceName": "demo1",
	"statName": "test",
	"statValue": "100",
	"summaryTime": "2016-01-01"
}

@mhoppa

mhoppa commented Jan 2, 2020

Copy link
Copy Markdown
Contributor Author

@ocket8888 fixed

@ocket8888 ocket8888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual code looks to be fine, tests pass and all that. Docs have some small problems though.

Comment thread docs/source/api/stats_summary.rst Outdated

@ocket8888 ocket8888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit tests and API/integration tests all pass, manual test confirms it works, docs build without warnings and look good/accurate

@ocket8888
ocket8888 merged commit 7da5af9 into apache:master Jan 3, 2020
@mhoppa
mhoppa deleted the feature/rewrite_stats_summary branch January 10, 2020 16:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

documentation related to documentation TO Client (Go) related to the Go implementation of a TC client Traffic Ops related to Traffic Ops Traffic Stats related to Traffic Stats

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite /stats_summary to Go

4 participants