Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/cdns/capacity returns 500 error: capacity was zero #4848

Closed
2 of 16 tasks
zrhoffman opened this issue Jul 1, 2020 · 3 comments · Fixed by #4892
Closed
2 of 16 tasks

/cdns/capacity returns 500 error: capacity was zero #4848

zrhoffman opened this issue Jul 1, 2020 · 3 comments · Fixed by #4892
Labels
bug something isn't working as intended Traffic Ops related to Traffic Ops

Comments

@zrhoffman
Copy link
Member

I'm submitting a ...

  • bug report
  • new feature / enhancement request
  • improvement request (usability, performance, tech debt, etc.)
  • other

Traffic Control components affected ...

  • CDN in a Box
  • Documentation
  • Grove
  • Traffic Control Client
  • Traffic Monitor
  • Traffic Ops
  • Traffic Ops ORT
  • Traffic Portal
  • Traffic Router
  • Traffic Stats
  • Traffic Vault
  • unknown

Current behavior:

Visiting /api/3.0/cdns/capacity returns a 500 error:

{
	"alerts": [
		{
			"text": "Internal Server Error",
			"level": "error"
		}
	]
}

Expected / new behavior:

Should return a response like

{
	"response": {
		"availablePercent": 89.0939840205533,
		"unavailablePercent": 0,
		"utilizedPercent": 10.9060020300395,
		"maintenancePercent": 1.39494071146245e-05
	}
}

Minimal reproduction of the problem with instructions:

  1. Start CDN-in-a-Box
  2. Log into Traffic Ops
  3. Visit https://trafficops.infra.ciab.test/api/3.0/cdns/capacity

Anything else:

From the error log:

ERROR: api.go:201: 2020-07-01T17:32:06.388024754Z: 192.168.48.10:55050 capacity was zero!
@ocket8888
Copy link
Contributor

I think the reason it does that currently is to avoid dividing by zero. I don't remember the specifics of how it works, but it might be permissible to instead return zero values in that case.

@zrhoffman
Copy link
Member Author

Do all of the structs in traffic_ops/traffic_ops_golang/cdn/capacity.go (last modified in February in c3c313f) accommodate the new interface-specific structure coming from TM? If it's not unmarshalling correctly, there won't be any data there.

@ocket8888
Copy link
Contributor

Hm. Not sure. That'll need some looking-into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working as intended Traffic Ops related to Traffic Ops
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants