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

Sentry SDK configuration support #80

Merged
merged 1 commit into from
Oct 31, 2024
Merged
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
56 changes: 42 additions & 14 deletions neon_diana_utils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
from typing import Optional, Set
from os import makedirs, listdir
from os.path import expanduser, join, abspath, isfile, isdir, dirname

from click import Choice
from ovos_utils.xdg_utils import xdg_config_home
from ovos_utils.log import LOG

Expand Down Expand Up @@ -296,20 +298,46 @@ def make_keys_config(write_config: bool,
config_confirmed = \
click.confirm("Is this configuration correct?")

config = {"keys": {"api_services": api_services,
"emails": email_config,
"track_my_brands": brands_config},
"LLM_CHAT_GPT": chatgpt_config,
"LLM_FASTCHAT": fastchat_config,
"LLM_PALM2": palm2_config,
"LLM_GEMINI": gemini_config,
"LLM_CLAUDE": claude_config,
"FastChat": fastchat_config, # TODO: Backwards-compat. only
"hana": {
"access_token_secret": secrets.token_hex(32),
"refresh_token_secret": secrets.token_hex(32)
}
}
sentry_sdk_config = {
"enabled": False,
}
if click.confirm("Configure Sentry SDK?"):
config_confirmed = False
while not config_confirmed:
sentry_dsn = click.prompt("Sentry DSN", type=str)

should_enable_sentry = click.prompt("Enable Sentry by default?",
type=Choice(choices=["y", "n"],
case_sensitive=False,),
default="y")
sentry_sdk_config = {
"enabled": should_enable_sentry,
"dsn": sentry_dsn,
}
click.echo(pformat(sentry_sdk_config))
config_confirmed = \
click.confirm("Is this configuration correct?")

config = {
"keys": {"api_services": api_services,
"emails": email_config,
"track_my_brands": brands_config},
"LLM_CHAT_GPT": chatgpt_config,
"LLM_FASTCHAT": fastchat_config,
"LLM_PALM2": palm2_config,
"LLM_GEMINI": gemini_config,
"LLM_CLAUDE": claude_config,
"FastChat": fastchat_config, # TODO: Backwards-compat. only
"hana": {
"access_token_secret": secrets.token_hex(32),
"refresh_token_secret": secrets.token_hex(32)
},
"logs": {
"aggregators": {
"sentry": sentry_sdk_config,
}
}
}
if write_config:
click.echo(f"Writing configuration to {output_file}")
with open(output_file, 'w+') as f:
Expand Down
Loading