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

Adding Sentry Support via Neon Utils #101

Open
wants to merge 1 commit into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion chat_server/blueprints/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ async def update_profile(
)
return respond(msg="OK")
except Exception as ex:
LOG.error(ex)
LOG.exception(
"Unable to update user data", update_data=update_dict, exc_info=ex
)
return respond(
msg="Unable to update user data at the moment",
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
Expand Down
7 changes: 4 additions & 3 deletions chat_server/sio/handlers/user_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from time import time

from utils.common import generate_uuid
Expand Down Expand Up @@ -168,7 +167,9 @@ async def user_message(sid, data):
await sio.emit("new_message", data=data, skip_sid=[sid])
PopularityCounter.increment_cid_popularity(new_shout_data["cid"])
except Exception as ex:
LOG.error(f"Exception on sio processing: {ex}")
LOG.exception(
f"Socket IO failed to process user message", data=data, exc_info=ex
)
await emit_error(
sids=[sid],
message=f'Unable to process request "user_message" with data: {data}',
Expand All @@ -188,4 +189,4 @@ async def broadcast(sid, data):
to=msg_receivers,
)
else:
LOG.error(f'data={data} skipped - no "msg_type" provided')
LOG.error("Missing message type attribute", data=data)
3 changes: 3 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from abc import ABC, abstractmethod

from os.path import isfile, join, dirname

from neon_utils.log_aggregators import init_log_aggregators
from ovos_config.config import Configuration as OVOSConfiguration

from utils.exceptions import MalformedConfigurationException
Expand All @@ -51,6 +53,7 @@ def __init__(self):
self._init_legacy_config()
self._config_data = self._config_data[self.config_key]
self.validate_provided_configuration()
init_log_aggregators(config=self.config_data)

def _init_ovos_config(self):
ovos_config = _load_ovos_config()
Expand Down
3 changes: 1 addition & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cachetools==5.3.3
ovos_config==0.0.12
ovos_utils==0.0.38
neon_utils==1.11.1a5
pre-commit==3.7.0
pydantic==2.7.0
python-socketio==5.11.2
Expand Down
3 changes: 1 addition & 2 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ jsbeautifier==1.15.1
kubernetes==29.0.0
neon-mq-connector~=0.7
neon-sftp~=0.1
ovos_config==0.0.12
ovos_utils==0.0.38
neon_utils==1.11.1a5
pre-commit==3.7.0
pydantic==2.7.0
PyJWT==2.8.0
Expand Down
4 changes: 2 additions & 2 deletions utils/logging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
import logging
import os

from ovos_utils.log import LOG as ovos_default_logger
from neon_utils.logger import LOG as neon_default_logger

combo_lock_logger = logging.getLogger("combo_lock")
combo_lock_logger.disabled = True


def _init_app_logger():
logger = ovos_default_logger
logger = neon_default_logger
logger.name = os.environ.get("LOG_NAME", "klat_server_log")
logger.base_path = os.environ.get("LOG_BASE_PATH", ".")
logger.init(
Expand Down