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

Adds missing service_id param to opsgenie plugin code #1716

Merged
merged 7 commits into from Oct 13, 2021

Conversation

mvilanova
Copy link
Contributor

@mvilanova mvilanova commented Oct 12, 2021

Closes #1653

@vikassinha2019
Copy link

vikassinha2019 commented Oct 13, 2021

It is still failing with following stacktrace.

INFO: 172.29.0.1:49326 - "POST /api/v1/default/incidents HTTP/1.0" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 208, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 26, in call
await response(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 224, in call
await run_until_first_complete(
File "/usr/local/lib/python3.9/site-packages/starlette/concurrency.py", line 24, in run_until_first_complete
[task.result() for task in done]
File "/usr/local/lib/python3.9/site-packages/starlette/concurrency.py", line 24, in
[task.result() for task in done]
File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 216, in stream_response
async for chunk in self.body_iterator:
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 56, in body_stream
task.result()
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in call
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 580, in call
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 390, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 208, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 25, in call
response = await self.dispatch_func(request, self.call_next)
File "/usr/local/lib/python3.9/site-packages/dispatch/main.py", line 184, in dispatch
response = await call_next(request)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 45, in call_next
task.result()
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 25, in call
response = await self.dispatch_func(request, self.call_next)
File "/usr/local/lib/python3.9/site-packages/dispatch/main.py", line 172, in dispatch
raise e from None
File "/usr/local/lib/python3.9/site-packages/dispatch/main.py", line 168, in dispatch
response = await call_next(request)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 45, in call_next
task.result()
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/sentry_asgi/middleware.py", line 22, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/sentry_asgi/middleware.py", line 19, in call
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 25, in call
response = await self.dispatch_func(request, self.call_next)
File "/usr/local/lib/python3.9/site-packages/dispatch/main.py", line 144, in db_session_middleware
response = await call_next(request)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 45, in call_next
task.result()
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in call
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 580, in call
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 241, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 52, in app
response = await func(request)
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 226, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 161, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/usr/local/lib/python3.9/site-packages/starlette/concurrency.py", line 40, in run_in_threadpool
return await loop.run_in_executor(None, func, *args)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/dispatch/incident/views.py", line 114, in create_incident
incident = create(db_session=db_session, incident_in=incident_in)
File "/usr/local/lib/python3.9/site-packages/dispatch/incident/service.py", line 203, in create
commander_email, commander_service_id = resolve_and_associate_role(
File "/usr/local/lib/python3.9/site-packages/dispatch/incident/service.py", line 57, in resolve_and_associate_role
oncall_plugin.instance.page(
File "/usr/local/lib/python3.9/site-packages/dispatch/decorators.py", line 122, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/dispatch/decorators.py", line 106, in wrapper
result = func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/dispatch/plugins/dispatch_opsgenie/plugin.py", line 55, in page
return page_oncall(
File "/usr/local/lib/python3.9/site-packages/dispatch/plugins/dispatch_opsgenie/service.py", line 49, in page_oncall
raise DispatchPluginException
dispatch.exceptions.DispatchPluginException
ERROR:uvicorn.error:Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in call
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 208, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 26, in call
await response(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 224, in call
await run_until_first_complete(
File "/usr/local/lib/python3.9/site-packages/starlette/concurrency.py", line 24, in run_until_first_complete
[task.result() for task in done]
File "/usr/local/lib/python3.9/site-packages/starlette/concurrency.py", line 24, in
[task.result() for task in done]
File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 216, in stream_response
async for chunk in self.body_iterator:
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 56, in body_stream
task.result()
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in call
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 580, in call
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 390, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 208, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 25, in call
response = await self.dispatch_func(request, self.call_next)
File "/usr/local/lib/python3.9/site-packages/dispatch/main.py", line 184, in dispatch
response = await call_next(request)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 45, in call_next
task.result()
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 25, in call
response = await self.dispatch_func(request, self.call_next)
File "/usr/local/lib/python3.9/site-packages/dispatch/main.py", line 172, in dispatch
raise e from None
File "/usr/local/lib/python3.9/site-packages/dispatch/main.py", line 168, in dispatch
response = await call_next(request)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 45, in call_next
task.result()
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/sentry_asgi/middleware.py", line 22, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/sentry_asgi/middleware.py", line 19, in call
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 25, in call
response = await self.dispatch_func(request, self.call_next)
File "/usr/local/lib/python3.9/site-packages/dispatch/main.py", line 144, in db_session_middleware
response = await call_next(request)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 45, in call_next
task.result()
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in call
raise exc from None
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in call
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 580, in call
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 241, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 52, in app
response = await func(request)
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 226, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 161, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/usr/local/lib/python3.9/site-packages/starlette/concurrency.py", line 40, in run_in_threadpool
return await loop.run_in_executor(None, func, *args)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/dispatch/incident/views.py", line 114, in create_incident
incident = create(db_session=db_session, incident_in=incident_in)
File "/usr/local/lib/python3.9/site-packages/dispatch/incident/service.py", line 203, in create
commander_email, commander_service_id = resolve_and_associate_role(
File "/usr/local/lib/python3.9/site-packages/dispatch/incident/service.py", line 57, in resolve_and_associate_role
oncall_plugin.instance.page(
File "/usr/local/lib/python3.9/site-packages/dispatch/decorators.py", line 122, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/dispatch/decorators.py", line 106, in wrapper
result = func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/dispatch/plugins/dispatch_opsgenie/plugin.py", line 55, in page
return page_oncall(
File "/usr/local/lib/python3.9/site-packages/dispatch/plugins/dispatch_opsgenie/service.py", line 49, in page_oncall
raise DispatchPluginException
dispatch.exceptions.DispatchPluginException

The message field is still coming up as null, and request is failing with 422 response code error.
"message": null,

@mvilanova
Copy link
Contributor Author

@vikassinha2019 how are you creating the incident, Web intake form, New button, API? Are you providing a title when you do? I merged #1718. Can you pull the changes and try again?

@vikassinha2019
Copy link

@vikassinha2019 how are you creating the incident, Web intake form, New button, API? Are you providing a title when you do? I merged #1718. Can you pull the changes and try again?

I am creating ticket from red 'Report Incident' button and then fill form like following, then Submit.
Screenshot 2021-10-13 at 11 39 12 PM

@mvilanova
Copy link
Contributor Author

Ok, I think I found the problem causing title to be None. We were passing the params to page_oncall in the wrong order. Incident title was set with incident name which was None. It won't be None anymore after changes in #1718.

@mvilanova
Copy link
Contributor Author

I'm going to merge this PR. Please pull down these and the changes in the PR mentioned above and let me know if you're still having issues.

@mvilanova mvilanova merged commit ab89ec6 into master Oct 13, 2021
@mvilanova mvilanova deleted the bug/opsgenie-plugin branch October 13, 2021 18:28
@vikassinha2019
Copy link

I'm going to merge this PR. Please pull down these and the changes in the PR mentioned above and let me know if you're still having issues.

Verified. working fine now. Thanks!

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

Successfully merging this pull request may close these issues.

Opsgenie module is always picking schedule defined in .env
2 participants