Skip to content
Snippets Groups Projects

Hotfix for error when missing SENTRY_DSN

Merged Laurian Gridinoc requested to merge gitlab-ci into main
3 files
+ 34
24
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 25
24
@@ -38,30 +38,31 @@ config = {
for key, value in config.items():
os.environ[key] = value or ""
sentry_sdk.init(
dsn=os.environ["SENTRY_DSN", None],
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
send_default_pii=False, # send personally-identifiable information like LLM responses to sentry
integrations=[
StarletteIntegration(
transaction_style="url",
failed_request_status_codes=[403, range(500, 599)],
),
FastApiIntegration(
transaction_style="url",
failed_request_status_codes=[403, range(500, 599)],
),
LangchainIntegration(
include_prompts=False,
),
],
)
if "SENTRY_DSN" in os.environ:
sentry_sdk.init(
dsn=os.environ["SENTRY_DSN"],
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
send_default_pii=False, # send personally-identifiable information like LLM responses to sentry
integrations=[
StarletteIntegration(
transaction_style="url",
failed_request_status_codes=[403, range(500, 599)],
),
FastApiIntegration(
transaction_style="url",
failed_request_status_codes=[403, range(500, 599)],
),
LangchainIntegration(
include_prompts=False,
),
],
)
class UnauthorizedMessage(BaseModel):
Loading