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

alerta heartbeats --alert broken #204

Closed
skob opened this issue Mar 10, 2020 · 4 comments · Fixed by #205
Closed

alerta heartbeats --alert broken #204

skob opened this issue Mar 10, 2020 · 4 comments · Fixed by #205

Comments

@skob
Copy link

skob commented Mar 10, 2020

Issue Summary
after last update got exception on alerta heartbeats --alert

Environment

  • OS: linux ubuntu 16.04

  • API version: 7.4.4

  • Deployment: self-hosted

  • For self-hosted, WSGI environment: nginx/uwsgi

  • Database: postgresql

  • Server config:
    Auth enabled? Yes
    Auth provider? Basic
    Customer views? No

To Reproduce
Steps to reproduce the behavior:

  1. pip install alerta==7.4.4
  2. ALERTA_ENDPOINT=http://localhost/api ALERTA_API_KEY= alerta heartbeats --timeout 600 --alert
Traceback (most recent call last):
  File "/srv/projects/venv3/bin/alerta", line 11, in <module>
    sys.exit(cli())
  File "/srv/projects/venv3/lib/python3.5/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/srv/projects/venv3/lib/python3.5/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/srv/projects/venv3/lib/python3.5/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/srv/projects/venv3/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/srv/projects/venv3/lib/python3.5/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/srv/projects/venv3/lib/python3.5/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/srv/projects/venv3/lib/python3.5/site-packages/alertaclient/commands/cmd_heartbeats.py", line 100, in cli
    customer=b.customer
  File "/srv/projects/venv3/lib/python3.5/site-packages/alertaclient/api.py", line 65, in send_alert
    r = self.http.post('/alert', data)
  File "/srv/projects/venv3/lib/python3.5/site-packages/alertaclient/api.py", line 519, in post
    response = self.session.post(url, data=json.dumps(data, cls=CustomJsonEncoder),
  File "/usr/lib/python3.5/json/__init__.py", line 237, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
    return _iterencode(o, 0)
  File "/srv/projects/venv3/lib/python3.5/site-packages/alertaclient/utils.py", line 18, in default
    return json.JSONEncoder.default(self, o)
  File "/usr/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <function origin at 0x7f5cba65ad90> is not JSON serializable

Expected behavior

Alerting heartbeats  [####################################]  100%

Additional context
temporary workaround:

  1. pip install alerta==7.4.0
@satterly
Copy link
Member

satterly commented Mar 10, 2020

I can't reproduce this error without know what the heartbeats were. Can you narrow it down to a particular heartbeat or heartbeats that generate this error? An actual alerta command line that generates the heartbeat would be useful. Thanks.

@satterly
Copy link
Member

This issue is blocked waiting on more information. The description or subsequent comments do not provide enough information to triage, investigate or resolve the issue. Please review the description against the issue template and ensure all relevant information is included. If you do not know what is expected you can ask on Gitter chat.

@skob
Copy link
Author

skob commented Mar 10, 2020

{"heartbeats":[{"attributes":{},"createTime":"2020-03-10T20:25:54.541Z","customer":null,"href":"http://127.0.0.1/heartbeat/52c202e8-d949-45ed-91e0-cdad4f37de73","id":"52c202e8-d949-45ed-91e0-cdad4f37de73","latency":0,"maxLatency":2000,"origin":"monitoring-01","receiveTime":"2020-03-10T20:25:54.541Z","since":204,"status":"expired","tags":["environment:infrastructure"],"timeout":90,"type":"Heartbeat"}],"status":"ok","total":1}

@satterly satterly transferred this issue from alerta/alerta Mar 10, 2020
@satterly
Copy link
Member

Thanks. I've used that output in the test case to ensure the fix worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants