server.py 131 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444
  1. """
  2. These settings act as the default (base) settings for the Sentry-provided web-server
  3. """
  4. from __future__ import annotations
  5. import os
  6. import os.path
  7. import platform
  8. import re
  9. import socket
  10. import sys
  11. import tempfile
  12. from datetime import datetime, timedelta
  13. from typing import (
  14. Any,
  15. Callable,
  16. Dict,
  17. Iterable,
  18. Mapping,
  19. Optional,
  20. Tuple,
  21. TypedDict,
  22. TypeVar,
  23. Union,
  24. overload,
  25. )
  26. from urllib.parse import urlparse
  27. import sentry
  28. from sentry.types.region import Region
  29. from sentry.utils import json
  30. from sentry.utils.celery import crontab_with_minute_jitter
  31. from sentry.utils.types import type_from_value
  32. T = TypeVar("T")
  33. def gettext_noop(s: str) -> str:
  34. return s
  35. socket.setdefaulttimeout(5)
  36. @overload
  37. def env(key: str) -> str:
  38. ...
  39. @overload
  40. def env(key: str, default: T, type: Callable[[Any], T] | None = None) -> T:
  41. ...
  42. def env(
  43. key: str,
  44. default: str | T = "",
  45. type: Optional[Callable[[Any], T]] = None,
  46. ) -> T:
  47. """
  48. Extract an environment variable for use in configuration
  49. :param key: The environment variable to be extracted.
  50. :param default: The value to be returned if `key` is not found.
  51. :param type: The type of the returned object (defaults to the type of `default`).
  52. :return: The environment variable if it exists, else `default`.
  53. """
  54. # First check an internal cache, so we can `pop` multiple times
  55. # without actually losing the value.
  56. try:
  57. rv = _env_cache[key]
  58. except KeyError:
  59. if "SENTRY_RUNNING_UWSGI" in os.environ:
  60. # We do this so when the process forks off into uwsgi
  61. # we want to actually be popping off values. This is so that
  62. # at runtime, the variables aren't actually available.
  63. fn: Callable[[str], str] = os.environ.pop
  64. else:
  65. fn = os.environ.__getitem__
  66. try:
  67. rv = fn(key)
  68. _env_cache[key] = rv
  69. except KeyError:
  70. rv = default
  71. if type is None:
  72. type = type_from_value(default)
  73. return type(rv)
  74. _env_cache: dict[str, object] = {}
  75. ENVIRONMENT = os.environ.get("SENTRY_ENVIRONMENT", "production")
  76. IS_DEV = ENVIRONMENT == "development"
  77. DEBUG = IS_DEV
  78. ADMIN_ENABLED = DEBUG
  79. ADMINS = ()
  80. # Hosts that are considered in the same network (including VPNs).
  81. INTERNAL_IPS = ()
  82. # List of IP subnets which should not be accessible
  83. SENTRY_DISALLOWED_IPS = ()
  84. # When resolving DNS for external sources (source map fetching, webhooks, etc),
  85. # ensure that domains are fully resolved first to avoid poking internal
  86. # search domains.
  87. SENTRY_ENSURE_FQDN = False
  88. SENTRY_DYNAMIC_SAMPLING_RULES_REDIS_CLUSTER = "default"
  89. SENTRY_INCIDENT_RULES_REDIS_CLUSTER = "default"
  90. SENTRY_RATE_LIMIT_REDIS_CLUSTER = "default"
  91. SENTRY_RULE_TASK_REDIS_CLUSTER = "default"
  92. SENTRY_TRANSACTION_NAMES_REDIS_CLUSTER = "default"
  93. SENTRY_WEBHOOK_LOG_REDIS_CLUSTER = "default"
  94. # Hosts that are allowed to use system token authentication.
  95. # http://en.wikipedia.org/wiki/Reserved_IP_addresses
  96. INTERNAL_SYSTEM_IPS = (
  97. "0.0.0.0/8",
  98. "10.0.0.0/8",
  99. "100.64.0.0/10",
  100. "127.0.0.0/8",
  101. "169.254.0.0/16",
  102. "172.16.0.0/12",
  103. "192.0.0.0/29",
  104. "192.0.2.0/24",
  105. "192.88.99.0/24",
  106. "192.168.0.0/16",
  107. "198.18.0.0/15",
  108. "198.51.100.0/24",
  109. "224.0.0.0/4",
  110. "240.0.0.0/4",
  111. "255.255.255.255/32",
  112. )
  113. MANAGERS = ADMINS
  114. APPEND_SLASH = True
  115. PROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), os.pardir))
  116. CONF_DIR = os.path.abspath(os.path.dirname(__file__))
  117. # XXX(dcramer): handle case when we've installed from source vs just running
  118. # this straight out of the repository
  119. if "site-packages" in __file__:
  120. NODE_MODULES_ROOT = os.path.join(PROJECT_ROOT, "node_modules")
  121. else:
  122. NODE_MODULES_ROOT = os.path.join(PROJECT_ROOT, os.pardir, os.pardir, "node_modules")
  123. NODE_MODULES_ROOT = os.path.normpath(NODE_MODULES_ROOT)
  124. DEVSERVICES_CONFIG_DIR = os.path.normpath(
  125. os.path.join(PROJECT_ROOT, os.pardir, os.pardir, "config")
  126. )
  127. SENTRY_DISTRIBUTED_CLICKHOUSE_TABLES = False
  128. RELAY_CONFIG_DIR = os.path.join(DEVSERVICES_CONFIG_DIR, "relay")
  129. SYMBOLICATOR_CONFIG_DIR = os.path.join(DEVSERVICES_CONFIG_DIR, "symbolicator")
  130. # XXX(epurkhiser): The generated chartucterie config.js file will be stored
  131. # here. This directory may not exist until that file is generated.
  132. CHARTCUTERIE_CONFIG_DIR = os.path.join(DEVSERVICES_CONFIG_DIR, "chartcuterie")
  133. CDC_CONFIG_DIR = os.path.join(DEVSERVICES_CONFIG_DIR, "cdc")
  134. sys.path.insert(0, os.path.normpath(os.path.join(PROJECT_ROOT, os.pardir)))
  135. DATABASES = {
  136. "default": {
  137. "ENGINE": "sentry.db.postgres",
  138. "NAME": "sentry",
  139. "USER": "postgres",
  140. "PASSWORD": "",
  141. "HOST": "127.0.0.1",
  142. "PORT": "",
  143. "AUTOCOMMIT": True,
  144. "ATOMIC_REQUESTS": False,
  145. }
  146. }
  147. if "DATABASE_URL" in os.environ:
  148. url = urlparse(os.environ["DATABASE_URL"])
  149. # Ensure default database exists.
  150. DATABASES["default"] = DATABASES.get("default", {})
  151. # Update with environment configuration.
  152. DATABASES["default"].update(
  153. {
  154. "NAME": url.path[1:],
  155. "USER": url.username,
  156. "PASSWORD": url.password,
  157. "HOST": url.hostname,
  158. "PORT": url.port,
  159. }
  160. )
  161. if url.scheme == "postgres":
  162. DATABASES["default"]["ENGINE"] = "sentry.db.postgres"
  163. # This should always be UTC.
  164. TIME_ZONE = "UTC"
  165. # Language code for this installation. All choices can be found here:
  166. # http://www.i18nguy.com/unicode/language-identifiers.html
  167. LANGUAGE_CODE = "en-us"
  168. LANGUAGES: tuple[tuple[str, str], ...] = (
  169. ("af", gettext_noop("Afrikaans")),
  170. ("ar", gettext_noop("Arabic")),
  171. ("az", gettext_noop("Azerbaijani")),
  172. ("bg", gettext_noop("Bulgarian")),
  173. ("be", gettext_noop("Belarusian")),
  174. ("bn", gettext_noop("Bengali")),
  175. ("br", gettext_noop("Breton")),
  176. ("bs", gettext_noop("Bosnian")),
  177. ("ca", gettext_noop("Catalan")),
  178. ("cs", gettext_noop("Czech")),
  179. ("cy", gettext_noop("Welsh")),
  180. ("da", gettext_noop("Danish")),
  181. ("de", gettext_noop("German")),
  182. ("el", gettext_noop("Greek")),
  183. ("en", gettext_noop("English")),
  184. ("eo", gettext_noop("Esperanto")),
  185. ("es", gettext_noop("Spanish")),
  186. ("et", gettext_noop("Estonian")),
  187. ("eu", gettext_noop("Basque")),
  188. ("fa", gettext_noop("Persian")),
  189. ("fi", gettext_noop("Finnish")),
  190. ("fr", gettext_noop("French")),
  191. ("ga", gettext_noop("Irish")),
  192. ("gl", gettext_noop("Galician")),
  193. ("he", gettext_noop("Hebrew")),
  194. ("hi", gettext_noop("Hindi")),
  195. ("hr", gettext_noop("Croatian")),
  196. ("hu", gettext_noop("Hungarian")),
  197. ("ia", gettext_noop("Interlingua")),
  198. ("id", gettext_noop("Indonesian")),
  199. ("is", gettext_noop("Icelandic")),
  200. ("it", gettext_noop("Italian")),
  201. ("ja", gettext_noop("Japanese")),
  202. ("ka", gettext_noop("Georgian")),
  203. ("kk", gettext_noop("Kazakh")),
  204. ("km", gettext_noop("Khmer")),
  205. ("kn", gettext_noop("Kannada")),
  206. ("ko", gettext_noop("Korean")),
  207. ("lb", gettext_noop("Luxembourgish")),
  208. ("lt", gettext_noop("Lithuanian")),
  209. ("lv", gettext_noop("Latvian")),
  210. ("mk", gettext_noop("Macedonian")),
  211. ("ml", gettext_noop("Malayalam")),
  212. ("mn", gettext_noop("Mongolian")),
  213. ("my", gettext_noop("Burmese")),
  214. ("nb", gettext_noop("Norwegian Bokmal")),
  215. ("ne", gettext_noop("Nepali")),
  216. ("nl", gettext_noop("Dutch")),
  217. ("nn", gettext_noop("Norwegian Nynorsk")),
  218. ("os", gettext_noop("Ossetic")),
  219. ("pa", gettext_noop("Punjabi")),
  220. ("pl", gettext_noop("Polish")),
  221. ("pt", gettext_noop("Portuguese")),
  222. ("pt-br", gettext_noop("Brazilian Portuguese")),
  223. ("ro", gettext_noop("Romanian")),
  224. ("ru", gettext_noop("Russian")),
  225. ("sk", gettext_noop("Slovak")),
  226. ("sl", gettext_noop("Slovenian")),
  227. ("sq", gettext_noop("Albanian")),
  228. ("sr", gettext_noop("Serbian")),
  229. ("sv-se", gettext_noop("Swedish")),
  230. ("sw", gettext_noop("Swahili")),
  231. ("ta", gettext_noop("Tamil")),
  232. ("te", gettext_noop("Telugu")),
  233. ("th", gettext_noop("Thai")),
  234. ("tr", gettext_noop("Turkish")),
  235. ("tt", gettext_noop("Tatar")),
  236. ("udm", gettext_noop("Udmurt")),
  237. ("uk", gettext_noop("Ukrainian")),
  238. ("ur", gettext_noop("Urdu")),
  239. ("vi", gettext_noop("Vietnamese")),
  240. ("zh-cn", gettext_noop("Simplified Chinese")),
  241. ("zh-tw", gettext_noop("Traditional Chinese")),
  242. )
  243. from .locale import CATALOGS
  244. LANGUAGES = tuple((code, name) for code, name in LANGUAGES if code in CATALOGS)
  245. SUPPORTED_LANGUAGES = frozenset(CATALOGS)
  246. SITE_ID = 1
  247. # If you set this to False, Django will make some optimizations so as not
  248. # to load the internationalization machinery.
  249. USE_I18N = True
  250. # If you set this to False, Django will not format dates, numbers and
  251. # calendars according to the current locale
  252. USE_L10N = True
  253. USE_TZ = True
  254. # CAVEAT: If you're adding a middleware that modifies a response's content,
  255. # and appears before CommonMiddleware, you must either reorder your middleware
  256. # so that responses aren't modified after Content-Length is set, or have the
  257. # response modifying middleware reset the Content-Length header.
  258. # This is because CommonMiddleware Sets the Content-Length header for non-streaming responses.
  259. MIDDLEWARE: tuple[str, ...] = (
  260. # Uncomment to enable Content Security Policy on this Sentry installation (experimental)
  261. # "csp.middleware.CSPMiddleware",
  262. "sentry.middleware.health.HealthCheck",
  263. "sentry.middleware.security.SecurityHeadersMiddleware",
  264. "sentry.middleware.env.SentryEnvMiddleware",
  265. "sentry.middleware.proxy.SetRemoteAddrFromForwardedFor",
  266. "sentry.middleware.stats.RequestTimingMiddleware",
  267. "sentry.middleware.access_log.access_log_middleware",
  268. "sentry.middleware.stats.ResponseCodeMiddleware",
  269. "sentry.middleware.subdomain.SubdomainMiddleware",
  270. "django.middleware.common.CommonMiddleware",
  271. "django.contrib.sessions.middleware.SessionMiddleware",
  272. "django.middleware.csrf.CsrfViewMiddleware",
  273. "sentry.middleware.auth.AuthenticationMiddleware",
  274. "sentry.middleware.integrations.IntegrationControlMiddleware",
  275. "sentry.middleware.api_gateway.ApiGatewayMiddleware",
  276. "sentry.middleware.customer_domain.CustomerDomainMiddleware",
  277. "sentry.middleware.user.UserActiveMiddleware",
  278. "sentry.middleware.sudo.SudoMiddleware",
  279. "sentry.middleware.superuser.SuperuserMiddleware",
  280. "sentry.middleware.locale.SentryLocaleMiddleware",
  281. "sentry.middleware.ratelimit.RatelimitMiddleware",
  282. "django.contrib.messages.middleware.MessageMiddleware",
  283. )
  284. ROOT_URLCONF = "sentry.conf.urls"
  285. # TODO(joshuarli): Django 1.10 introduced this option, which restricts the size of a
  286. # request body. We have some middleware in sentry.middleware.proxy that sets the
  287. # Content Length to max uint32 in certain cases related to minidump.
  288. # Once relay's fully rolled out, that can be deleted.
  289. # Until then, the safest and easiest thing to do is to disable this check
  290. # to leave things the way they were with Django <1.9.
  291. DATA_UPLOAD_MAX_MEMORY_SIZE = None
  292. TEMPLATES = [
  293. {
  294. "BACKEND": "django.template.backends.django.DjangoTemplates",
  295. "DIRS": [os.path.join(PROJECT_ROOT, "templates")],
  296. "APP_DIRS": True,
  297. "OPTIONS": {
  298. "context_processors": [
  299. "django.contrib.auth.context_processors.auth",
  300. "django.contrib.messages.context_processors.messages",
  301. "django.template.context_processors.csrf",
  302. "django.template.context_processors.request",
  303. ]
  304. },
  305. }
  306. ]
  307. INSTALLED_APPS = (
  308. "django.contrib.admin",
  309. "django.contrib.auth",
  310. "django.contrib.contenttypes",
  311. "django.contrib.messages",
  312. "django.contrib.sessions",
  313. "django.contrib.sites",
  314. "drf_spectacular",
  315. "crispy_forms",
  316. "rest_framework",
  317. "sentry",
  318. "sentry.analytics",
  319. "sentry.incidents.apps.Config",
  320. "sentry.discover",
  321. "sentry.analytics.events",
  322. "sentry.nodestore",
  323. "sentry.monitors",
  324. "sentry.replays",
  325. "sentry.release_health",
  326. "sentry.search",
  327. "sentry.sentry_metrics.indexer.postgres.apps.Config",
  328. "sentry.snuba",
  329. "sentry.lang.java.apps.Config",
  330. "sentry.lang.javascript.apps.Config",
  331. "sentry.plugins.sentry_interface_types.apps.Config",
  332. "sentry.plugins.sentry_urls.apps.Config",
  333. "sentry.plugins.sentry_useragents.apps.Config",
  334. "sentry.plugins.sentry_webhooks.apps.Config",
  335. "sentry.utils.suspect_resolutions.apps.Config",
  336. "sentry.utils.suspect_resolutions_releases.apps.Config",
  337. "social_auth",
  338. "sudo",
  339. "sentry.eventstream",
  340. "sentry.auth.providers.google.apps.Config",
  341. "django.contrib.staticfiles",
  342. "sentry.issues.apps.Config",
  343. )
  344. # Silence internal hints from Django's system checks
  345. SILENCED_SYSTEM_CHECKS = (
  346. # Django recommends to use OneToOneField over ForeignKey(unique=True)
  347. # however this changes application behavior in ways that break association
  348. # loading
  349. "fields.W342",
  350. # We have a "catch-all" react_page_view that we only want to match on URLs
  351. # ending with a `/` to allow APPEND_SLASHES to kick in for the ones lacking
  352. # the trailing slash. This confuses the warning as the regex is `/$` which
  353. # looks like it starts with a slash but it doesn't.
  354. "urls.W002",
  355. # Our own AuthenticationMiddleware suffices as a replacement for
  356. # django.contrib.auth.middleware.AuthenticationMiddleware; both add the
  357. # authenticated user to the HttpRequest which is what's needed here.
  358. "admin.E408",
  359. # This is fixed in Django@7c08f26bf0439c1ed593b51b51ad847f7e262bc1.
  360. # It's not our problem; refer to Django issue 32260.
  361. "urls.E007",
  362. )
  363. CSP_INCLUDE_NONCE_IN = [
  364. "script-src",
  365. ]
  366. CSP_DEFAULT_SRC = [
  367. "'none'",
  368. ]
  369. CSP_SCRIPT_SRC = [
  370. "'self'",
  371. "'unsafe-inline'",
  372. "'report-sample'",
  373. ]
  374. CSP_FONT_SRC = [
  375. "'self'",
  376. "data:",
  377. ]
  378. CSP_CONNECT_SRC = [
  379. "'self'",
  380. ]
  381. CSP_FRAME_ANCESTORS = [
  382. "'none'",
  383. ]
  384. CSP_OBJECT_SRC = [
  385. "'none'",
  386. ]
  387. CSP_BASE_URI = [
  388. "'none'",
  389. ]
  390. CSP_STYLE_SRC = [
  391. "'self'",
  392. "'unsafe-inline'",
  393. ]
  394. CSP_IMG_SRC = [
  395. "'self'",
  396. "blob:",
  397. "data:",
  398. "https://secure.gravatar.com",
  399. ]
  400. if ENVIRONMENT == "development":
  401. CSP_SCRIPT_SRC += [
  402. "'unsafe-eval'",
  403. ]
  404. CSP_CONNECT_SRC += [
  405. "ws://127.0.0.1:8000",
  406. ]
  407. # Before enforcing Content Security Policy, we recommend creating a separate
  408. # Sentry project and collecting CSP violations in report only mode:
  409. # https://docs.sentry.io/product/security-policy-reporting/
  410. # Point this parameter to your Sentry installation:
  411. # CSP_REPORT_URI = "https://example.com/api/{PROJECT_ID}/security/?sentry_key={SENTRY_KEY}"
  412. # To enforce CSP (block violated resources), update the following parameter to False
  413. CSP_REPORT_ONLY = True
  414. STATIC_ROOT = os.path.realpath(os.path.join(PROJECT_ROOT, "static"))
  415. STATIC_URL = "/_static/{version}/"
  416. # webpack assets live at a different URL that is unversioned
  417. # as we configure webpack to include file content based hash in the filename
  418. STATIC_FRONTEND_APP_URL = "/_static/dist/"
  419. # The webpack output directory
  420. STATICFILES_DIRS = [
  421. os.path.join(STATIC_ROOT, "sentry", "dist"),
  422. ]
  423. # various middleware will use this to identify resources which should not access
  424. # cookies
  425. ANONYMOUS_STATIC_PREFIXES = (
  426. "/_static/",
  427. "/avatar/",
  428. "/organization-avatar/",
  429. "/team-avatar/",
  430. "/project-avatar/",
  431. "/js-sdk-loader/",
  432. )
  433. STATICFILES_FINDERS = (
  434. "django.contrib.staticfiles.finders.FileSystemFinder",
  435. "django.contrib.staticfiles.finders.AppDirectoriesFinder",
  436. )
  437. ASSET_VERSION = 0
  438. # setup a default media root to somewhere useless
  439. MEDIA_ROOT = "/tmp/sentry-files"
  440. MEDIA_URL = "_media/"
  441. LOCALE_PATHS = (os.path.join(PROJECT_ROOT, "locale"),)
  442. CSRF_FAILURE_VIEW = "sentry.web.frontend.csrf_failure.view"
  443. CSRF_COOKIE_NAME = "sc"
  444. # Auth configuration
  445. from django.urls import reverse_lazy
  446. LOGIN_REDIRECT_URL = reverse_lazy("sentry-login-redirect")
  447. LOGIN_URL = reverse_lazy("sentry-login")
  448. AUTHENTICATION_BACKENDS = (
  449. "sentry.utils.auth.EmailAuthBackend",
  450. # The following authentication backends are used by social auth only.
  451. # We don't use them for user authentication.
  452. "social_auth.backends.asana.AsanaBackend",
  453. "social_auth.backends.github.GithubBackend",
  454. "social_auth.backends.bitbucket.BitbucketBackend",
  455. "social_auth.backends.visualstudio.VisualStudioBackend",
  456. )
  457. AUTH_PASSWORD_VALIDATORS = [
  458. {"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"},
  459. {
  460. "NAME": "sentry.auth.password_validation.MinimumLengthValidator",
  461. "OPTIONS": {"min_length": 8},
  462. },
  463. {
  464. "NAME": "sentry.auth.password_validation.MaximumLengthValidator",
  465. "OPTIONS": {"max_length": 256},
  466. },
  467. {
  468. "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
  469. },
  470. {
  471. "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
  472. },
  473. ]
  474. SOCIAL_AUTH_USER_MODEL = AUTH_USER_MODEL = "sentry.User"
  475. SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
  476. SESSION_COOKIE_NAME = "sentrysid"
  477. # setting SESSION_COOKIE_SAMESITE to None below for now because
  478. # Django's default in 2.1 now `Lax`.
  479. # this breaks certain IDP flows where we need cookies sent to us on a redirected POST
  480. # request, and `Lax` doesnt permit this.
  481. # See here: https://docs.djangoproject.com/en/2.1/ref/settings/#session-cookie-samesite
  482. SESSION_COOKIE_SAMESITE = None
  483. BITBUCKET_CONSUMER_KEY = ""
  484. BITBUCKET_CONSUMER_SECRET = ""
  485. ASANA_CLIENT_ID = ""
  486. ASANA_CLIENT_SECRET = ""
  487. VISUALSTUDIO_APP_ID = ""
  488. VISUALSTUDIO_APP_SECRET = ""
  489. VISUALSTUDIO_CLIENT_SECRET = ""
  490. VISUALSTUDIO_SCOPES = ["vso.work_write", "vso.project", "vso.code", "vso.release"]
  491. SOCIAL_AUTH_PIPELINE = (
  492. "social_auth.backends.pipeline.user.get_username",
  493. "social_auth.backends.pipeline.social.social_auth_user",
  494. "social_auth.backends.pipeline.associate.associate_by_email",
  495. "social_auth.backends.pipeline.misc.save_status_to_session",
  496. "social_auth.backends.pipeline.social.associate_user",
  497. "social_auth.backends.pipeline.social.load_extra_data",
  498. "social_auth.backends.pipeline.user.update_user_details",
  499. "social_auth.backends.pipeline.misc.save_status_to_session",
  500. )
  501. SOCIAL_AUTH_REVOKE_TOKENS_ON_DISCONNECT = True
  502. SOCIAL_AUTH_LOGIN_REDIRECT_URL = "/account/settings/identities/"
  503. SOCIAL_AUTH_ASSOCIATE_ERROR_URL = SOCIAL_AUTH_LOGIN_REDIRECT_URL
  504. INITIAL_CUSTOM_USER_MIGRATION = "0108_fix_user"
  505. # Auth engines and the settings required for them to be listed
  506. AUTH_PROVIDERS = {
  507. "github": ("GITHUB_APP_ID", "GITHUB_API_SECRET"),
  508. "bitbucket": ("BITBUCKET_CONSUMER_KEY", "BITBUCKET_CONSUMER_SECRET"),
  509. "asana": ("ASANA_CLIENT_ID", "ASANA_CLIENT_SECRET"),
  510. "visualstudio": (
  511. "VISUALSTUDIO_APP_ID",
  512. "VISUALSTUDIO_APP_SECRET",
  513. "VISUALSTUDIO_CLIENT_SECRET",
  514. ),
  515. }
  516. AUTH_PROVIDER_LABELS = {
  517. "github": "GitHub",
  518. "bitbucket": "Bitbucket",
  519. "asana": "Asana",
  520. "visualstudio": "Visual Studio",
  521. }
  522. import random
  523. def SOCIAL_AUTH_DEFAULT_USERNAME() -> str:
  524. return random.choice(["Darth Vader", "Obi-Wan Kenobi", "R2-D2", "C-3PO", "Yoda"])
  525. SOCIAL_AUTH_PROTECTED_USER_FIELDS = ["email"]
  526. SOCIAL_AUTH_FORCE_POST_DISCONNECT = True
  527. # Queue configuration
  528. from kombu import Queue
  529. BROKER_URL = "redis://127.0.0.1:6379"
  530. BROKER_TRANSPORT_OPTIONS: dict[str, int] = {}
  531. # Ensure workers run async by default
  532. # in Development you might want them to run in-process
  533. # though it would cause timeouts/recursions in some cases
  534. CELERY_ALWAYS_EAGER = False
  535. # Complain about bad use of pickle. See sentry.celery.SentryTask.apply_async for how
  536. # this works.
  537. CELERY_COMPLAIN_ABOUT_BAD_USE_OF_PICKLE = False
  538. # Complain about bad use of pickle in PickledObjectField
  539. PICKLED_OBJECT_FIELD_COMPLAIN_ABOUT_BAD_USE_OF_PICKLE = False
  540. # We use the old task protocol because during benchmarking we noticed that it's faster
  541. # than the new protocol. If we ever need to bump this it should be fine, there were no
  542. # compatibility issues, just need to run benchmarks and do some tests to make sure
  543. # things run ok.
  544. CELERY_TASK_PROTOCOL = 1
  545. CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
  546. CELERY_IGNORE_RESULT = True
  547. CELERY_SEND_EVENTS = False
  548. CELERY_RESULT_BACKEND = None
  549. CELERY_TASK_RESULT_EXPIRES = 1
  550. CELERY_DISABLE_RATE_LIMITS = True
  551. CELERY_DEFAULT_QUEUE = "default"
  552. CELERY_DEFAULT_EXCHANGE = "default"
  553. CELERY_DEFAULT_EXCHANGE_TYPE = "direct"
  554. CELERY_DEFAULT_ROUTING_KEY = "default"
  555. CELERY_CREATE_MISSING_QUEUES = True
  556. CELERY_REDIRECT_STDOUTS = False
  557. CELERYD_HIJACK_ROOT_LOGGER = False
  558. CELERY_TASK_SERIALIZER = "pickle"
  559. CELERY_RESULT_SERIALIZER = "pickle"
  560. CELERY_ACCEPT_CONTENT = {"pickle"}
  561. CELERY_IMPORTS = (
  562. "sentry.data_export.tasks",
  563. "sentry.discover.tasks",
  564. "sentry.incidents.tasks",
  565. "sentry.snuba.tasks",
  566. "sentry.replays.tasks",
  567. "sentry.monitors.tasks",
  568. "sentry.tasks.app_store_connect",
  569. "sentry.tasks.assemble",
  570. "sentry.tasks.auth",
  571. "sentry.tasks.auto_remove_inbox",
  572. "sentry.tasks.auto_resolve_issues",
  573. "sentry.tasks.beacon",
  574. "sentry.tasks.check_auth",
  575. "sentry.tasks.clear_expired_snoozes",
  576. "sentry.tasks.clear_expired_rulesnoozes",
  577. "sentry.tasks.codeowners.code_owners_auto_sync",
  578. "sentry.tasks.codeowners.update_code_owners_schema",
  579. "sentry.tasks.collect_project_platforms",
  580. "sentry.tasks.commits",
  581. "sentry.tasks.commit_context",
  582. "sentry.tasks.deletion",
  583. "sentry.tasks.deletion.scheduled",
  584. "sentry.tasks.deletion.groups",
  585. "sentry.tasks.deletion.hybrid_cloud",
  586. "sentry.tasks.deliver_from_outbox",
  587. "sentry.tasks.digests",
  588. "sentry.tasks.email",
  589. "sentry.tasks.files",
  590. "sentry.tasks.groupowner",
  591. "sentry.tasks.integrations",
  592. "sentry.tasks.low_priority_symbolication",
  593. "sentry.tasks.merge",
  594. "sentry.tasks.options",
  595. "sentry.tasks.organization_mapping",
  596. "sentry.tasks.ping",
  597. "sentry.tasks.post_process",
  598. "sentry.tasks.process_buffer",
  599. "sentry.tasks.relay",
  600. "sentry.tasks.release_registry",
  601. "sentry.tasks.weekly_reports",
  602. "sentry.tasks.reprocessing",
  603. "sentry.tasks.reprocessing2",
  604. "sentry.tasks.scheduler",
  605. "sentry.tasks.sentry_apps",
  606. "sentry.tasks.servicehooks",
  607. "sentry.tasks.store",
  608. "sentry.tasks.symbolication",
  609. "sentry.tasks.unmerge",
  610. "sentry.tasks.update_user_reports",
  611. "sentry.tasks.user_report",
  612. "sentry.profiles.task",
  613. "sentry.release_health.tasks",
  614. "sentry.dynamic_sampling.tasks",
  615. "sentry.utils.suspect_resolutions.get_suspect_resolutions",
  616. "sentry.utils.suspect_resolutions_releases.get_suspect_resolutions_releases",
  617. "sentry.tasks.derive_code_mappings",
  618. "sentry.ingest.transaction_clusterer.tasks",
  619. "sentry.tasks.auto_enable_codecov",
  620. "sentry.tasks.weekly_escalating_forecast",
  621. "sentry.tasks.auto_ongoing_issues",
  622. "sentry.tasks.auto_archive_issues",
  623. )
  624. CELERY_QUEUES = [
  625. Queue("activity.notify", routing_key="activity.notify"),
  626. Queue("alerts", routing_key="alerts"),
  627. Queue("app_platform", routing_key="app_platform"),
  628. Queue("appstoreconnect", routing_key="sentry.tasks.app_store_connect.#"),
  629. Queue("assemble", routing_key="assemble"),
  630. Queue("auth", routing_key="auth"),
  631. Queue("buffers.process_pending", routing_key="buffers.process_pending"),
  632. Queue("buffers.incr", routing_key="buffers.incr"),
  633. Queue("cleanup", routing_key="cleanup"),
  634. Queue("code_owners", routing_key="code_owners"),
  635. Queue("commits", routing_key="commits"),
  636. Queue("data_export", routing_key="data_export"),
  637. Queue("default", routing_key="default"),
  638. Queue("digests.delivery", routing_key="digests.delivery"),
  639. Queue("digests.scheduling", routing_key="digests.scheduling"),
  640. Queue("email", routing_key="email"),
  641. Queue("events.preprocess_event", routing_key="events.preprocess_event"),
  642. Queue("events.process_event", routing_key="events.process_event"),
  643. Queue("events.reprocess_events", routing_key="events.reprocess_events"),
  644. Queue(
  645. "events.reprocessing.preprocess_event", routing_key="events.reprocessing.preprocess_event"
  646. ),
  647. Queue("events.reprocessing.process_event", routing_key="events.reprocessing.process_event"),
  648. Queue(
  649. "events.reprocessing.symbolicate_event", routing_key="events.reprocessing.symbolicate_event"
  650. ),
  651. Queue(
  652. "events.reprocessing.symbolicate_event_low_priority",
  653. routing_key="events.reprocessing.symbolicate_event_low_priority",
  654. ),
  655. Queue("events.save_event", routing_key="events.save_event"),
  656. Queue("events.save_event_transaction", routing_key="events.save_event_transaction"),
  657. Queue("events.save_event_attachments", routing_key="events.save_event_attachments"),
  658. Queue("events.symbolicate_event", routing_key="events.symbolicate_event"),
  659. Queue(
  660. "events.symbolicate_event_low_priority", routing_key="events.symbolicate_event_low_priority"
  661. ),
  662. Queue("events.symbolicate_js_event", routing_key="events.symbolicate_js_event"),
  663. Queue(
  664. "events.symbolicate_js_event_low_priority",
  665. routing_key="events.symbolicate_js_event_low_priority",
  666. ),
  667. Queue("files.copy", routing_key="files.copy"),
  668. Queue("files.delete", routing_key="files.delete"),
  669. Queue(
  670. "group_owners.process_suspect_commits", routing_key="group_owners.process_suspect_commits"
  671. ),
  672. Queue("group_owners.process_commit_context", routing_key="group_owners.process_commit_context"),
  673. Queue(
  674. "releasemonitor",
  675. routing_key="releasemonitor",
  676. ),
  677. Queue(
  678. "dynamicsampling",
  679. routing_key="dynamicsampling",
  680. ),
  681. Queue("incidents", routing_key="incidents"),
  682. Queue("incident_snapshots", routing_key="incident_snapshots"),
  683. Queue("incidents", routing_key="incidents"),
  684. Queue("integrations", routing_key="integrations"),
  685. Queue("merge", routing_key="merge"),
  686. Queue("options", routing_key="options"),
  687. Queue("post_process_errors", routing_key="post_process_errors"),
  688. Queue("post_process_issue_platform", routing_key="post_process_issue_platform"),
  689. Queue("post_process_transactions", routing_key="post_process_transactions"),
  690. Queue("relay_config", routing_key="relay_config"),
  691. Queue("relay_config_bulk", routing_key="relay_config_bulk"),
  692. Queue("reports.deliver", routing_key="reports.deliver"),
  693. Queue("reports.prepare", routing_key="reports.prepare"),
  694. Queue("search", routing_key="search"),
  695. Queue("sentry_metrics.indexer", routing_key="sentry_metrics.indexer"),
  696. Queue("similarity.index", routing_key="similarity.index"),
  697. Queue("sleep", routing_key="sleep"),
  698. Queue("stats", routing_key="stats"),
  699. Queue("subscriptions", routing_key="subscriptions"),
  700. Queue(
  701. "symbolications.compute_low_priority_projects",
  702. routing_key="symbolications.compute_low_priority_projects",
  703. ),
  704. Queue("unmerge", routing_key="unmerge"),
  705. Queue("update", routing_key="update"),
  706. Queue("profiles.process", routing_key="profiles.process"),
  707. Queue("get_suspect_resolutions", routing_key="get_suspect_resolutions"),
  708. Queue("get_suspect_resolutions_releases", routing_key="get_suspect_resolutions_releases"),
  709. Queue("replays.ingest_replay", routing_key="replays.ingest_replay"),
  710. Queue("replays.delete_replay", routing_key="replays.delete_replay"),
  711. Queue("counters-0", routing_key="counters-0"),
  712. Queue("triggers-0", routing_key="triggers-0"),
  713. Queue("derive_code_mappings", routing_key="derive_code_mappings"),
  714. Queue("transactions.name_clusterer", routing_key="transactions.name_clusterer"),
  715. Queue("hybrid_cloud.control_repair", routing_key="hybrid_cloud.control_repair"),
  716. Queue("auto_enable_codecov", routing_key="auto_enable_codecov"),
  717. Queue("weekly_escalating_forecast", routing_key="weekly_escalating_forecast"),
  718. Queue("auto_transition_issue_states", routing_key="auto_transition_issue_states"),
  719. ]
  720. for queue in CELERY_QUEUES:
  721. queue.durable = False
  722. from celery.schedules import crontab
  723. CELERYBEAT_SCHEDULE_FILENAME = os.path.join(tempfile.gettempdir(), "sentry-celerybeat")
  724. CELERYBEAT_SCHEDULE = {
  725. "check-auth": {
  726. "task": "sentry.tasks.check_auth",
  727. # Run every 1 minute
  728. "schedule": crontab(minute="*/1"),
  729. "options": {"expires": 60, "queue": "auth"},
  730. },
  731. "enqueue-scheduled-jobs": {
  732. "task": "sentry.tasks.enqueue_scheduled_jobs",
  733. # Run every 1 minute
  734. "schedule": crontab(minute="*/1"),
  735. "options": {"expires": 60},
  736. },
  737. "send-beacon": {
  738. "task": "sentry.tasks.send_beacon",
  739. # Run every hour
  740. "schedule": crontab(minute=0, hour="*/1"),
  741. "options": {"expires": 3600},
  742. },
  743. "send-ping": {
  744. "task": "sentry.tasks.send_ping",
  745. # Run every 1 minute
  746. "schedule": crontab(minute="*/1"),
  747. "options": {"expires": 60},
  748. },
  749. "flush-buffers": {
  750. "task": "sentry.tasks.process_buffer.process_pending",
  751. "schedule": timedelta(seconds=10),
  752. "options": {"expires": 10, "queue": "buffers.process_pending"},
  753. },
  754. "sync-options": {
  755. "task": "sentry.tasks.options.sync_options",
  756. "schedule": timedelta(seconds=10),
  757. "options": {"expires": 10, "queue": "options"},
  758. },
  759. "schedule-digests": {
  760. "task": "sentry.tasks.digests.schedule_digests",
  761. "schedule": timedelta(seconds=30),
  762. "options": {"expires": 30},
  763. },
  764. "check-monitors": {
  765. "task": "sentry.monitors.tasks.check_monitors",
  766. # Run every 1 minute
  767. "schedule": crontab(minute="*/1"),
  768. "options": {"expires": 60},
  769. },
  770. "clear-expired-snoozes": {
  771. "task": "sentry.tasks.clear_expired_snoozes",
  772. # Run every 5 minutes
  773. "schedule": crontab(minute="*/5"),
  774. "options": {"expires": 300},
  775. },
  776. "clear-expired-rulesnoozes": {
  777. "task": "sentry.tasks.clear_expired_rulesnoozes",
  778. # Run every 5 minutes
  779. "schedule": crontab(minute="*/5"),
  780. "options": {"expires": 300},
  781. },
  782. "clear-expired-raw-events": {
  783. "task": "sentry.tasks.clear_expired_raw_events",
  784. # Run every 15 minutes
  785. "schedule": crontab(minute="*/15"),
  786. "options": {"expires": 300},
  787. },
  788. "collect-project-platforms": {
  789. "task": "sentry.tasks.collect_project_platforms",
  790. "schedule": crontab_with_minute_jitter(hour=3),
  791. "options": {"expires": 3600 * 24},
  792. },
  793. "deliver-from-outbox": {
  794. "task": "sentry.tasks.enqueue_outbox_jobs",
  795. # Run every 1 minute
  796. "schedule": crontab(minute="*/1"),
  797. "options": {"expires": 30},
  798. },
  799. "update-user-reports": {
  800. "task": "sentry.tasks.update_user_reports",
  801. # Run every 15 minutes
  802. "schedule": crontab(minute="*/15"),
  803. "options": {"expires": 300},
  804. },
  805. "schedule-auto-resolution": {
  806. "task": "sentry.tasks.schedule_auto_resolution",
  807. # Run every 15 minutes
  808. "schedule": crontab(minute="*/15"),
  809. "options": {"expires": 60 * 25},
  810. },
  811. "auto-remove-inbox": {
  812. "task": "sentry.tasks.auto_remove_inbox",
  813. # Run every 15 minutes
  814. "schedule": crontab(minute="*/15"),
  815. "options": {"expires": 60 * 25},
  816. },
  817. "schedule-deletions": {
  818. "task": "sentry.tasks.deletion.run_scheduled_deletions",
  819. # Run every 15 minutes
  820. "schedule": crontab(minute="*/15"),
  821. "options": {"expires": 60 * 25},
  822. },
  823. "reattempt-deletions": {
  824. "task": "sentry.tasks.deletion.reattempt_deletions",
  825. "schedule": crontab(hour=10, minute=0), # 03:00 PDT, 07:00 EDT, 10:00 UTC
  826. "options": {"expires": 60 * 25},
  827. },
  828. "schedule-weekly-organization-reports-new": {
  829. "task": "sentry.tasks.weekly_reports.schedule_organizations",
  830. "schedule": crontab(
  831. minute=0, hour=12, day_of_week="monday" # 05:00 PDT, 09:00 EDT, 12:00 UTC
  832. ),
  833. "options": {"expires": 60 * 60 * 3},
  834. },
  835. "schedule-vsts-integration-subscription-check": {
  836. "task": "sentry.tasks.integrations.kickoff_vsts_subscription_check",
  837. "schedule": crontab_with_minute_jitter(hour="*/6"),
  838. "options": {"expires": 60 * 25},
  839. },
  840. "schedule-hybrid-cloud-foreign-key-jobs": {
  841. "task": "sentry.tasks.deletion.hybrid_cloud.schedule_hybrid_cloud_foreign_key_jobs",
  842. # Run every 15 minutes
  843. "schedule": crontab(minute="*/15"),
  844. },
  845. "monitor-release-adoption": {
  846. "task": "sentry.release_health.tasks.monitor_release_adoption",
  847. "schedule": crontab(minute=0),
  848. "options": {"expires": 3600, "queue": "releasemonitor"},
  849. },
  850. "fetch-release-registry-data": {
  851. "task": "sentry.tasks.release_registry.fetch_release_registry_data",
  852. # Run every 5 minutes
  853. "schedule": crontab(minute="*/5"),
  854. "options": {"expires": 3600},
  855. },
  856. "fetch-appstore-builds": {
  857. "task": "sentry.tasks.app_store_connect.refresh_all_builds",
  858. # Run every hour
  859. "schedule": crontab(minute=0, hour="*/1"),
  860. "options": {"expires": 3600},
  861. },
  862. "snuba-subscription-checker": {
  863. "task": "sentry.snuba.tasks.subscription_checker",
  864. # Run every 20 minutes
  865. "schedule": crontab(minute="*/20"),
  866. "options": {"expires": 20 * 60},
  867. },
  868. "transaction-name-clusterer": {
  869. "task": "sentry.ingest.transaction_clusterer.tasks.spawn_clusterers",
  870. "schedule": crontab(minute=17),
  871. "options": {"expires": 3600},
  872. },
  873. "span.descs.clusterer": {
  874. "task": "sentry.ingest.span_clusterer.tasks.spawn_span_cluster_projects",
  875. "schedule": crontab(minute=42),
  876. "options": {"expires": 3600},
  877. },
  878. # TODO(HC) Remove or re-enable this once a decision is made on org mapping creation
  879. # "hybrid-cloud-repair-mappings": {
  880. # "task": "sentry.tasks.organization_mapping.repair_mappings",
  881. # # Run every hour
  882. # "schedule": crontab(minute=0, hour="*/1"),
  883. # "options": {"expires": 3600},
  884. # },
  885. "auto-enable-codecov": {
  886. "task": "sentry.tasks.auto_enable_codecov.enable_for_org",
  887. # Run job once a day at 00:30
  888. "schedule": crontab(minute=30, hour="0"),
  889. "options": {"expires": 3600},
  890. },
  891. "dynamic-sampling-prioritize-projects": {
  892. "task": "sentry.dynamic_sampling.tasks.prioritise_projects",
  893. # Run every 5 minutes
  894. "schedule": crontab(minute="*/5"),
  895. },
  896. "dynamic-sampling-prioritize-transactions": {
  897. "task": "sentry.dynamic_sampling.tasks.prioritise_transactions",
  898. # Run every 5 minutes
  899. "schedule": crontab(minute="*/5"),
  900. },
  901. "dynamic-sampling-sliding-window": {
  902. "task": "sentry.dynamic_sampling.tasks.sliding_window",
  903. # Run every 10 minutes
  904. "schedule": crontab(minute="*/10"),
  905. },
  906. "dynamic-sampling-sliding-window-org": {
  907. "task": "sentry.dynamic_sampling.tasks.sliding_window_org",
  908. # Run every 10 minutes
  909. "schedule": crontab(minute="*/10"),
  910. },
  911. "weekly-escalating-forecast": {
  912. "task": "sentry.tasks.weekly_escalating_forecast.run_escalating_forecast",
  913. # TODO: Change this to run weekly once we verify the results
  914. "schedule": crontab(minute=0, hour="*/6"),
  915. # TODO: Increase expiry time to x4 once we change this to run weekly
  916. "options": {"expires": 60 * 60 * 3},
  917. },
  918. "dynamic-sampling-recalibrate-orgs": {
  919. "task": "sentry.dynamic_sampling.tasks.recalibrate_orgs",
  920. # Run every 5 minutes
  921. "schedule": crontab(minute="*/5"),
  922. },
  923. "schedule_auto_transition_new": {
  924. "task": "sentry.tasks.schedule_auto_transition_new",
  925. # Run job every 6 hours
  926. "schedule": crontab(minute=0, hour="*/6"),
  927. "options": {"expires": 3600},
  928. },
  929. "schedule_auto_transition_regressed": {
  930. "task": "sentry.tasks.schedule_auto_transition_regressed",
  931. # Run job every 6 hours
  932. "schedule": crontab(minute=0, hour="*/6"),
  933. "options": {"expires": 3600},
  934. },
  935. "schedule_auto_archive_issues": {
  936. "task": "sentry.tasks.auto_archive_issues.run_auto_archive",
  937. # Run job every 6 hours
  938. "schedule": crontab(minute=0, hour="*/6"),
  939. "options": {"expires": 3600},
  940. },
  941. }
  942. # Queues that belong to the processing pipeline and need to be monitored
  943. # for backpressure management
  944. PROCESSING_QUEUES = [
  945. "events.preprocess_event",
  946. "events.process_event",
  947. "events.reprocess_events",
  948. "events.reprocessing.preprocess_event",
  949. "events.reprocessing.process_event",
  950. "events.reprocessing.symbolicate_event",
  951. "events.reprocessing.symbolicate_event_low_priority",
  952. "events.save_event",
  953. "events.save_event_attachments",
  954. "events.save_event_transaction",
  955. "events.symbolicate_event",
  956. "events.symbolicate_event_low_priority",
  957. "events.symbolicate_js_event",
  958. "events.symbolicate_js_event_low_priority",
  959. "post_process_errors",
  960. "post_process_issue_platform",
  961. "post_process_transactions",
  962. "profiles.process",
  963. ]
  964. # We prefer using crontab, as the time for timedelta will reset on each deployment. More information: https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html#periodic-tasks
  965. TIMEDELTA_ALLOW_LIST = {
  966. "flush-buffers",
  967. "sync-options",
  968. "schedule-digests",
  969. }
  970. BGTASKS = {
  971. "sentry.bgtasks.clean_dsymcache:clean_dsymcache": {"interval": 5 * 60, "roles": ["worker"]},
  972. "sentry.bgtasks.clean_releasefilecache:clean_releasefilecache": {
  973. "interval": 5 * 60,
  974. "roles": ["worker"],
  975. },
  976. }
  977. # Sentry logs to two major places: stdout, and it's internal project.
  978. # To disable logging to the internal project, add a logger who's only
  979. # handler is 'console' and disable propagating upwards.
  980. # Additionally, Sentry has the ability to override logger levels by
  981. # providing the cli with -l/--loglevel or the SENTRY_LOG_LEVEL env var.
  982. # The loggers that it overrides are root and any in LOGGING.overridable.
  983. # Be very careful with this in a production system, because the celery
  984. # logger can be extremely verbose when given INFO or DEBUG.
  985. LOGGING = {
  986. "default_level": "INFO",
  987. "version": 1,
  988. "disable_existing_loggers": True,
  989. "handlers": {
  990. "null": {"class": "logging.NullHandler"},
  991. "console": {"class": "sentry.logging.handlers.StructLogHandler"},
  992. # This `internal` logger is separate from the `Logging` integration in the SDK. Since
  993. # we have this to record events, in `sdk.py` we set the integration's `event_level` to
  994. # None, so that it records breadcrumbs for all log calls but doesn't send any events.
  995. "internal": {"level": "ERROR", "class": "sentry_sdk.integrations.logging.EventHandler"},
  996. "metrics": {
  997. "level": "WARNING",
  998. "filters": ["important_django_request"],
  999. "class": "sentry.logging.handlers.MetricsLogHandler",
  1000. },
  1001. "django_internal": {
  1002. "level": "WARNING",
  1003. "filters": ["important_django_request"],
  1004. "class": "sentry_sdk.integrations.logging.EventHandler",
  1005. },
  1006. },
  1007. "filters": {
  1008. "important_django_request": {
  1009. "()": "sentry.logging.handlers.MessageContainsFilter",
  1010. "contains": ["CSRF"],
  1011. }
  1012. },
  1013. "root": {"level": "NOTSET", "handlers": ["console", "internal"]},
  1014. # LOGGING.overridable is a list of loggers including root that will change
  1015. # based on the overridden level defined above.
  1016. "overridable": ["celery", "sentry"],
  1017. "loggers": {
  1018. "celery": {"level": "WARNING"},
  1019. "sentry": {"level": "INFO"},
  1020. "sentry_plugins": {"level": "INFO"},
  1021. "sentry.files": {"level": "WARNING"},
  1022. "sentry.minidumps": {"handlers": ["internal"], "propagate": False},
  1023. "sentry.reprocessing": {"handlers": ["internal"], "propagate": False},
  1024. "sentry.interfaces": {"handlers": ["internal"], "propagate": False},
  1025. # This only needs to go to Sentry for now.
  1026. "sentry.similarity": {"handlers": ["internal"], "propagate": False},
  1027. "sentry.errors": {"handlers": ["console"], "propagate": False},
  1028. "sentry_sdk.errors": {"handlers": ["console"], "level": "INFO", "propagate": False},
  1029. "sentry.rules": {"handlers": ["console"], "propagate": False},
  1030. "multiprocessing": {
  1031. "handlers": ["console"],
  1032. # https://github.com/celery/celery/commit/597a6b1f3359065ff6dbabce7237f86b866313df
  1033. # This commit has not been rolled into any release and leads to a
  1034. # large amount of errors when working with postgres.
  1035. "level": "CRITICAL",
  1036. "propagate": False,
  1037. },
  1038. "celery.worker.job": {"handlers": ["console"], "propagate": False},
  1039. "arroyo": {"level": "INFO", "handlers": ["console"], "propagate": False},
  1040. "static_compiler": {"level": "INFO"},
  1041. "django.request": {
  1042. "level": "WARNING",
  1043. "handlers": ["console", "metrics", "django_internal"],
  1044. "propagate": False,
  1045. },
  1046. "toronado": {"level": "ERROR", "handlers": ["null"], "propagate": False},
  1047. "urllib3.connectionpool": {"level": "ERROR", "handlers": ["console"], "propagate": False},
  1048. "boto3": {"level": "WARNING", "handlers": ["console"], "propagate": False},
  1049. "botocore": {"level": "WARNING", "handlers": ["console"], "propagate": False},
  1050. },
  1051. }
  1052. # django-rest-framework
  1053. REST_FRAMEWORK = {
  1054. "DEFAULT_RENDERER_CLASSES": ["rest_framework.renderers.JSONRenderer"],
  1055. "DEFAULT_PARSER_CLASSES": [
  1056. "rest_framework.parsers.JSONParser",
  1057. "rest_framework.parsers.MultiPartParser",
  1058. "rest_framework.parsers.FormParser",
  1059. ],
  1060. "TEST_REQUEST_DEFAULT_FORMAT": "json",
  1061. "DEFAULT_PERMISSION_CLASSES": ("sentry.api.permissions.NoPermission",),
  1062. "EXCEPTION_HANDLER": "sentry.api.handlers.custom_exception_handler",
  1063. "DEFAULT_SCHEMA_CLASS": "sentry.apidocs.schema.SentrySchema",
  1064. }
  1065. if os.environ.get("OPENAPIGENERATE", False):
  1066. OLD_OPENAPI_JSON_PATH = "tests/apidocs/openapi-deprecated.json"
  1067. from sentry.apidocs.build import OPENAPI_TAGS, get_old_json_components, get_old_json_paths
  1068. SPECTACULAR_SETTINGS = {
  1069. "PREPROCESSING_HOOKS": ["sentry.apidocs.hooks.custom_preprocessing_hook"],
  1070. "POSTPROCESSING_HOOKS": ["sentry.apidocs.hooks.custom_postprocessing_hook"],
  1071. "DISABLE_ERRORS_AND_WARNINGS": False,
  1072. "COMPONENT_SPLIT_REQUEST": False,
  1073. "COMPONENT_SPLIT_PATCH": False,
  1074. "AUTHENTICATION_WHITELIST": ["sentry.api.authentication.TokenAuthentication"],
  1075. "TAGS": OPENAPI_TAGS,
  1076. "TITLE": "API Reference",
  1077. "DESCRIPTION": "Sentry Public API",
  1078. "TOS": "http://sentry.io/terms/",
  1079. "CONTACT": {"email": "partners@sentry.io"},
  1080. "LICENSE": {"name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html"},
  1081. "VERSION": "v0",
  1082. "SERVERS": [{"url": "https://sentry.io/"}],
  1083. "PARSER_WHITELIST": ["rest_framework.parsers.JSONParser"],
  1084. "APPEND_PATHS": get_old_json_paths(OLD_OPENAPI_JSON_PATH),
  1085. "APPEND_COMPONENTS": get_old_json_components(OLD_OPENAPI_JSON_PATH),
  1086. "SORT_OPERATION_PARAMETERS": False,
  1087. }
  1088. CRISPY_TEMPLATE_PACK = "bootstrap3"
  1089. # Sentry and internal client configuration
  1090. SENTRY_FEATURES = {
  1091. # Enables user registration.
  1092. "auth:register": True,
  1093. # Enables alert creation on indexed events in UI (use for PoC/testing only)
  1094. "organizations:alert-allow-indexed": False,
  1095. # Enables tagging javascript errors from the browser console.
  1096. "organizations:javascript-console-error-tag": False,
  1097. # Enables the cron job to auto-enable codecov integrations.
  1098. "organizations:auto-enable-codecov": False,
  1099. # The overall flag for codecov integration, gated by plans.
  1100. "organizations:codecov-integration": False,
  1101. # Enables getting commit sha from git blame for codecov.
  1102. "organizations:codecov-commit-sha-from-git-blame": False,
  1103. # Enables automatically deriving of code mappings
  1104. "organizations:derive-code-mappings": True,
  1105. # Enable advanced search features, like negation and wildcard matching.
  1106. "organizations:advanced-search": True,
  1107. # Use metrics as the dataset for crash free metric alerts
  1108. "organizations:alert-crash-free-metrics": False,
  1109. # Enable auth provider configuration through api
  1110. "organizations:api-auth-provider": False,
  1111. "organizations:api-keys": False,
  1112. # Enable multiple Apple app-store-connect sources per project.
  1113. "organizations:app-store-connect-multiple": False,
  1114. # Enable change alerts for an org
  1115. "organizations:change-alerts": True,
  1116. # Enable alerting based on crash free sessions/users
  1117. "organizations:crash-rate-alerts": True,
  1118. # Enable the mute metric alerts feature
  1119. "organizations:mute-metric-alerts": False,
  1120. # Enable the Commit Context feature
  1121. "organizations:commit-context": False,
  1122. # Enable creating organizations within sentry (if SENTRY_SINGLE_ORGANIZATION
  1123. # is not enabled).
  1124. "organizations:create": True,
  1125. # Use issue platform for crons issues
  1126. "organizations:crons-issue-platform": False,
  1127. # Use new listing page for crons
  1128. "organizations:crons-timeline-listing-page": False,
  1129. # Enable usage of customer domains on the frontend
  1130. "organizations:customer-domains": False,
  1131. # Enable the 'discover' interface.
  1132. "organizations:discover": False,
  1133. # Enables events endpoint rate limit
  1134. "organizations:discover-events-rate-limit": False,
  1135. # Enable attaching arbitrary files to events.
  1136. "organizations:event-attachments": True,
  1137. # Allow organizations to configure all symbol sources.
  1138. "organizations:symbol-sources": True,
  1139. # Allow organizations to configure custom external symbol sources.
  1140. "organizations:custom-symbol-sources": True,
  1141. # Enable discover 2 basic functions
  1142. "organizations:discover-basic": True,
  1143. # Enable discover 2 custom queries and saved queries
  1144. "organizations:discover-query": True,
  1145. # Enable archive/escalating issue workflow
  1146. "organizations:escalating-issues": False,
  1147. # Enable archive/escalating issue workflow UI, enable everything except post processing
  1148. "organizations:escalating-issues-ui": False,
  1149. # Enable escalating forecast threshold a/b experiment
  1150. "organizations:escalating-issues-experiment-group": False,
  1151. # Enable archive/escalating issue workflow features in v2
  1152. "organizations:escalating-issues-v2": False,
  1153. # Enable the new issue states and substates
  1154. "organizations:issue-states": False,
  1155. # Enable the new issue states and substates
  1156. "organizations:remove-mark-reviewed": False,
  1157. # Allows an org to have a larger set of project ownership rules per project
  1158. "organizations:higher-ownership-limit": False,
  1159. # Enable Performance view
  1160. "organizations:performance-view": True,
  1161. # Enable profiling
  1162. "organizations:profiling": False,
  1163. # Enable ui frames in flamecharts
  1164. "organizations:profiling-ui-frames": False,
  1165. # Enable the transactions backed profiling views
  1166. "organizations:profiling-using-transactions": False,
  1167. # Enabled for those orgs who participated in the profiling Beta program
  1168. "organizations:profiling-beta": False,
  1169. # Enable profiling GA messaging (update paths from AM1 to AM2)
  1170. "organizations:profiling-ga": False,
  1171. # Enable stacktrace linking of multiple frames in profiles
  1172. "organizations:profiling-stacktrace-links": False,
  1173. # Enable global suspect functions in profiling
  1174. "organizations:profiling-global-suspect-functions": False,
  1175. # Enable multi project selection
  1176. "organizations:global-views": False,
  1177. # Enable experimental new version of Merged Issues where sub-hashes are shown
  1178. "organizations:grouping-tree-ui": False,
  1179. # Enable experimental new version of stacktrace component where additional
  1180. # data related to grouping is shown on each frame
  1181. "organizations:grouping-stacktrace-ui": False,
  1182. # Enable tweaks to group title in relation to hierarchical
  1183. # grouping.
  1184. "organizations:grouping-title-ui": False,
  1185. # Lets organizations manage grouping configs
  1186. "organizations:set-grouping-config": False,
  1187. # Enable rule page.
  1188. "organizations:rule-page": False,
  1189. # Enable incidents feature
  1190. "organizations:incidents": False,
  1191. # Enable issue platform
  1192. "organizations:issue-platform": False,
  1193. # Whether to allow issue only search on the issue list
  1194. "organizations:issue-search-allow-postgres-only-search": False,
  1195. # Flags for enabling CdcEventsDatasetSnubaSearchBackend in sentry.io. No effect in open-source
  1196. # sentry at the moment.
  1197. "organizations:issue-search-use-cdc-primary": False,
  1198. "organizations:issue-search-use-cdc-secondary": False,
  1199. # Enable metrics feature on the backend
  1200. "organizations:metrics": False,
  1201. # Enable metric alert charts in email/slack
  1202. "organizations:metric-alert-chartcuterie": False,
  1203. # Extract metrics for sessions during ingestion.
  1204. "organizations:metrics-extraction": False,
  1205. # Normalize URL transaction names during ingestion.
  1206. "organizations:transaction-name-normalize": True,
  1207. # Mark URL transactions scrubbed by regex patterns as "sanitized".
  1208. # NOTE: This flag does not concern transactions rewritten by clusterer rules.
  1209. # Those are always marked as "sanitized".
  1210. "organizations:transaction-name-mark-scrubbed-as-sanitized": True,
  1211. # Sanitize transaction names in the ingestion pipeline.
  1212. "organizations:transaction-name-sanitization": False, # DEPRECATED
  1213. # Extraction metrics for transactions during ingestion.
  1214. "organizations:transaction-metrics-extraction": False,
  1215. # True if Relay should drop raw session payloads after extracting metrics from them.
  1216. "organizations:release-health-drop-sessions": False,
  1217. # Enable threshold period in metric alert rule builder
  1218. "organizations:metric-alert-threshold-period": False,
  1219. # Enable integration functionality to create and link groups to issues on
  1220. # external services.
  1221. "organizations:integrations-issue-basic": True,
  1222. # Enable interface functionality to synchronize groups between sentry and
  1223. # issues on external services.
  1224. "organizations:integrations-issue-sync": True,
  1225. # Enable interface functionality to receive event hooks.
  1226. "organizations:integrations-event-hooks": True,
  1227. # Enable integration functionality to work with alert rules
  1228. "organizations:integrations-alert-rule": True,
  1229. # Enable integration functionality to work with alert rules (specifically chat integrations)
  1230. "organizations:integrations-chat-unfurl": True,
  1231. # Enable integration functionality to work with alert rules (specifically incident
  1232. # management integrations)
  1233. "organizations:integrations-incident-management": True,
  1234. # Enable integration functionality to work deployment integrations like Vercel
  1235. "organizations:integrations-deployment": True,
  1236. # Allow orgs to automatically create Tickets in Issue Alerts
  1237. "organizations:integrations-ticket-rules": True,
  1238. # Allow orgs to use the stacktrace linking feature
  1239. "organizations:integrations-stacktrace-link": False,
  1240. # Allow orgs to install a custom source code management integration
  1241. "organizations:integrations-custom-scm": False,
  1242. # Limit project events endpoint to only query back a certain number of days
  1243. "organizations:project-event-date-limit": False,
  1244. # Enable data forwarding functionality for organizations.
  1245. "organizations:data-forwarding": True,
  1246. # Enable readonly dashboards
  1247. "organizations:dashboards-basic": True,
  1248. # Enable custom editable dashboards
  1249. "organizations:dashboards-edit": True,
  1250. # Enable metrics enhanced performance in dashboards
  1251. "organizations:dashboards-mep": False,
  1252. # Enable release health widget in dashboards
  1253. "organizations:dashboards-rh-widget": False,
  1254. # Enable the dynamic sampling "Transaction Name" priority in the UI
  1255. "organizations:dynamic-sampling-transaction-name-priority": False,
  1256. # Enable minimap in the widget viewer modal in dashboards
  1257. "organizations:widget-viewer-modal-minimap": False,
  1258. # Enable experimental performance improvements.
  1259. "organizations:enterprise-perf": False,
  1260. # Enable the API to importing CODEOWNERS for a project
  1261. "organizations:integrations-codeowners": False,
  1262. # Enable inviting members to organizations.
  1263. "organizations:invite-members": True,
  1264. # Enable rate limits for inviting members.
  1265. "organizations:invite-members-rate-limits": True,
  1266. # Enable new issue alert "issue owners" fallback
  1267. "organizations:issue-alert-fallback-targeting": False,
  1268. # Enable SQL formatting for breadcrumb items and performance spans
  1269. "organizations:sql-format": False,
  1270. # Enable experimental replay-issue rendering on Issue Details page
  1271. "organizations:issue-details-replay-event": False,
  1272. # Enable prefetching of issues from the issue list when hovered
  1273. "organizations:issue-list-prefetch-issue-on-hover": False,
  1274. # Enable better priority sort algorithm.
  1275. "organizations:issue-list-better-priority-sort": False,
  1276. # Adds the ttid & ttfd vitals to the frontend
  1277. "organizations:mobile-vitals": False,
  1278. # Display CPU and memory metrics in transactions with profiles
  1279. "organizations:mobile-cpu-memory-in-transactions": False,
  1280. # Enable new page filter UI
  1281. "organizations:new-page-filter": False,
  1282. # Prefix host with organization ID when giving users DSNs (can be
  1283. # customized with SENTRY_ORG_SUBDOMAIN_TEMPLATE)
  1284. "organizations:org-subdomains": False,
  1285. # Enable project selection on the stats page
  1286. "organizations:project-stats": True,
  1287. # Enable interpolation of null data points in charts instead of zerofilling in performance
  1288. "organizations:performance-chart-interpolation": False,
  1289. # Enable views for anomaly detection
  1290. "organizations:performance-anomaly-detection-ui": False,
  1291. # Enable histogram view in span details
  1292. "organizations:performance-span-histogram-view": False,
  1293. # Enable performance on-boarding checklist
  1294. "organizations:performance-onboarding-checklist": False,
  1295. # Enable transaction name only search
  1296. "organizations:performance-transaction-name-only-search": False,
  1297. # Enable transaction name only search on indexed
  1298. "organizations:performance-transaction-name-only-search-indexed": False,
  1299. # Re-enable histograms for Metrics Enhanced Performance Views
  1300. "organizations:performance-mep-reintroduce-histograms": False,
  1301. # Enable showing INP web vital in default views
  1302. "organizations:performance-vitals-inp": False,
  1303. # Enables a longer stats period for the performance landing page
  1304. "organizations:performance-landing-page-stats-period": False,
  1305. # Enable internal view for bannerless MEP view
  1306. "organizations:performance-mep-bannerless-ui": False,
  1307. # Enable updated landing page widget designs
  1308. "organizations:performance-new-widget-designs": False,
  1309. # Enable metrics-backed transaction summary view
  1310. "organizations:performance-metrics-backed-transaction-summary": False,
  1311. # Enable new trends
  1312. "organizations:performance-new-trends": False,
  1313. # Enable debug views for trendsv2 to be used internally
  1314. "organizations:performance-trendsv2-dev-only": False,
  1315. # Enable consecutive db performance issue type
  1316. "organizations:performance-consecutive-db-issue": False,
  1317. # Enable consecutive http performance issue type
  1318. "organizations:performance-consecutive-http-detector": False,
  1319. # Enable consecutive http performance issue type
  1320. "organizations:performance-large-http-payload-detector": False,
  1321. # Enable slow DB performance issue type
  1322. "organizations:performance-slow-db-issue": False,
  1323. # Enable N+1 API Calls performance issue type
  1324. "organizations:performance-n-plus-one-api-calls-detector": False,
  1325. # Enable compressed assets performance issue type
  1326. "organizations:performance-issues-compressed-assets-detector": False,
  1327. # Enable render blocking assets performance issue type
  1328. "organizations:performance-issues-render-blocking-assets-detector": False,
  1329. # Enable MN+1 DB performance issue type
  1330. "organizations:performance-issues-m-n-plus-one-db-detector": False,
  1331. # Enable the new Related Events feature
  1332. "organizations:related-events": False,
  1333. # Enable usage of external relays, for use with Relay. See
  1334. # https://github.com/getsentry/relay.
  1335. "organizations:relay": True,
  1336. # Enable Sentry Functions
  1337. "organizations:sentry-functions": False,
  1338. # Enable experimental session replay backend APIs
  1339. "organizations:session-replay": False,
  1340. # Enable session replay click search banner rollout for eligible SDKs
  1341. "organizations:session-replay-click-search-banner-rollout": False,
  1342. # Enable Session Replay showing in the sidebar
  1343. "organizations:session-replay-ui": True,
  1344. # Enabled for those orgs who participated in the Replay Beta program
  1345. "organizations:session-replay-beta-grace": False,
  1346. # Enabled experimental session replay errors view, replacing issues
  1347. "organizations:session-replay-errors-tab": False,
  1348. # Enable replay GA messaging (update paths from AM1 to AM2)
  1349. "organizations:session-replay-ga": False,
  1350. # Enabled experimental session replay network data view
  1351. "organizations:session-replay-network-details": False,
  1352. # Enable experimental session replay SDK for recording on Sentry
  1353. "organizations:session-replay-sdk": False,
  1354. "organizations:session-replay-sdk-errors-only": False,
  1355. # Enable data scrubbing of replay recording payloads in Relay.
  1356. "organizations:session-replay-recording-scrubbing": False,
  1357. # Enable subquery optimizations for the replay_index page
  1358. "organizations:session-replay-index-subquery": False,
  1359. # Enable the new suggested assignees feature
  1360. "organizations:streamline-targeting-context": False,
  1361. # Enable the new experimental starfish view
  1362. "organizations:starfish-view": False,
  1363. # Enable starfish endpoint that's used for regressing testing purposes
  1364. "organizations:starfish-test-endpoint": False,
  1365. # Replace the footer Sentry logo with a Sentry pride logo
  1366. "organizations:sentry-pride-logo-footer": False,
  1367. # Enable Session Stats down to a minute resolution
  1368. "organizations:minute-resolution-sessions": True,
  1369. # Notify all project members when fallthrough is disabled, instead of just the auto-assignee
  1370. "organizations:notification-all-recipients": False,
  1371. # Enable performance issues dev options, includes changing detection thresholds and other parts of issues that we're using for development.
  1372. "organizations:performance-issues-dev": False,
  1373. # Enables updated all events tab in a performance issue
  1374. "organizations:performance-issues-all-events-tab": False,
  1375. # Temporary flag to test search performance that's running slow in S4S
  1376. "organizations:performance-issues-search": True,
  1377. # Enable version 2 of reprocessing (completely distinct from v1)
  1378. "organizations:reprocessing-v2": False,
  1379. # Enable the UI for the overage alert settings
  1380. "organizations:slack-overage-notifications": False,
  1381. # Enable basic SSO functionality, providing configurable single sign on
  1382. # using services like GitHub / Google. This is *not* the same as the signup
  1383. # and login with Github / Azure DevOps that sentry.io provides.
  1384. "organizations:sso-basic": True,
  1385. # Enable SAML2 based SSO functionality. getsentry/sentry-auth-saml2 plugin
  1386. # must be installed to use this functionality.
  1387. "organizations:sso-saml2": True,
  1388. # Enable a UI where users can see bundles and their artifacts which only have debug IDs
  1389. "organizations:source-maps-debug-ids": True,
  1390. # Enable the new opinionated dynamic sampling
  1391. "organizations:dynamic-sampling": False,
  1392. # Enable the sliding window per project
  1393. "organizations:ds-sliding-window": False,
  1394. # Enable the sliding window per org
  1395. "organizations:ds-sliding-window-org": False,
  1396. # Enable new project/org boost
  1397. "organizations:ds-boost-new-projects": False,
  1398. # Enable view hierarchies options
  1399. "organizations:view-hierarchies-options-dev": False,
  1400. # Enable anr improvements ui
  1401. "organizations:anr-improvements": False,
  1402. # Enable anr frame analysis
  1403. "organizations:anr-analyze-frames": False,
  1404. # Enable device.class as a selectable column
  1405. "organizations:device-classification": False,
  1406. # Enables synthesis of device.class in ingest
  1407. "organizations:device-class-synthesis": False,
  1408. # Enable the product selection feature in the getting started docs, regardless of the organization's strategy
  1409. "organizations:getting-started-doc-with-product-selection": False,
  1410. # Enable the onboarding heartbeat footer on the sdk setup page
  1411. "organizations:onboarding-heartbeat-footer": False,
  1412. # Enable a new behavior for deleting the freshly created project,
  1413. # if the user clicks on the back button in the onboarding for new orgs
  1414. "organizations:onboarding-project-deletion-on-back-click": False,
  1415. # Enable the SDK selection feature in the onboarding
  1416. "organizations:onboarding-sdk-selection": False,
  1417. # Enable OpenAI suggestions in the issue details page
  1418. "organizations:open-ai-suggestion": False,
  1419. # Enable ANR rates in project details page
  1420. "organizations:anr-rate": False,
  1421. # Enable tag improvements in the issue details page
  1422. "organizations:issue-details-tag-improvements": False,
  1423. # Enable the release details performance section
  1424. "organizations:release-comparison-performance": False,
  1425. # Enable team insights page
  1426. "organizations:team-insights": True,
  1427. # Enable u2f verification on superuser form
  1428. "organizations:u2f-superuser-form": False,
  1429. # Enable project creation for all
  1430. "organizations:team-project-creation-all": False,
  1431. # Enable project creation for all and puts organization into test group
  1432. "organizations:team-project-creation-all-allowlist": False,
  1433. # Enable setting team-level roles and receiving permissions from them
  1434. "organizations:team-roles": False,
  1435. # Enable team member role provisioning through scim
  1436. "organizations:scim-team-roles": False,
  1437. # Enable the setting of org roles for team
  1438. "organizations:org-roles-for-teams": False,
  1439. # Enable new JS SDK Dynamic Loader
  1440. "organizations:js-sdk-dynamic-loader": False,
  1441. # If true certain Slack messages will be escaped to prevent rendering markdown
  1442. "organizations:slack-escape-messages": False,
  1443. # If true, allow to create/use org auth tokens
  1444. "organizations:org-auth-tokens": False,
  1445. # Enables commenting on PRs from the Sentry comment bot.
  1446. "organizations:pr-comment-bot": False,
  1447. # Adds additional filters and a new section to issue alert rules.
  1448. "projects:alert-filters": True,
  1449. # Enable functionality to specify custom inbound filters on events.
  1450. "projects:custom-inbound-filters": False,
  1451. # Enable data forwarding functionality for projects.
  1452. "projects:data-forwarding": True,
  1453. # Enable functionality to discard groups.
  1454. "projects:discard-groups": False,
  1455. # DEPRECATED: pending removal
  1456. "projects:dsym": False,
  1457. # Enable functionality for attaching minidumps to events and displaying
  1458. # then in the group UI.
  1459. "projects:minidump": True,
  1460. # Enable functionality for project plugins.
  1461. "projects:plugins": True,
  1462. # Enable alternative version of group creation that is supposed to be less racy.
  1463. "projects:race-free-group-creation": True,
  1464. # Enable functionality for rate-limiting events on projects.
  1465. "projects:rate-limits": True,
  1466. # Enable functionality to trigger service hooks upon event ingestion.
  1467. "projects:servicehooks": False,
  1468. # Enable suspect resolutions feature
  1469. "projects:suspect-resolutions": False,
  1470. # Use Kafka (instead of Celery) for ingestion pipeline.
  1471. "projects:kafka-ingest": False,
  1472. # Workflow 2.0 Auto associate commits to commit sha release
  1473. "projects:auto-associate-commits-to-release": False,
  1474. # Starfish: extract metrics from the spans
  1475. "projects:span-metrics-extraction": False,
  1476. # Don't add feature defaults down here! Please add them in their associated
  1477. # group sorted alphabetically.
  1478. }
  1479. # Default time zone for localization in the UI.
  1480. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  1481. SENTRY_DEFAULT_TIME_ZONE = "UTC"
  1482. SENTRY_DEFAULT_LANGUAGE = "en"
  1483. # Enable the Sentry Debugger (Beta)
  1484. SENTRY_DEBUGGER = None
  1485. SENTRY_IGNORE_EXCEPTIONS = ("OperationalError",)
  1486. # Should we send the beacon to the upstream server?
  1487. SENTRY_BEACON = True
  1488. # Allow access to Sentry without authentication.
  1489. SENTRY_PUBLIC = False
  1490. # Instruct Sentry that this install intends to be run by a single organization
  1491. # and thus various UI optimizations should be enabled.
  1492. SENTRY_SINGLE_ORGANIZATION = False
  1493. # Login url (defaults to LOGIN_URL)
  1494. SENTRY_LOGIN_URL = None
  1495. # Default project ID (for internal errors)
  1496. SENTRY_PROJECT = 1
  1497. SENTRY_PROJECT_KEY = None
  1498. # Default organization to represent the Internal Sentry project.
  1499. # Used as a default when in SINGLE_ORGANIZATION mode.
  1500. SENTRY_ORGANIZATION = None
  1501. # Project ID for recording frontend (javascript) exceptions
  1502. SENTRY_FRONTEND_PROJECT = None
  1503. # DSN for the frontend to use explicitly, which takes priority
  1504. # over SENTRY_FRONTEND_PROJECT or SENTRY_PROJECT
  1505. SENTRY_FRONTEND_DSN = None
  1506. # DSN for tracking all client HTTP requests (which can be noisy) [experimental]
  1507. SENTRY_FRONTEND_REQUESTS_DSN = None
  1508. # Configuration for JavaScript's whitelistUrls - defaults to ALLOWED_HOSTS
  1509. SENTRY_FRONTEND_WHITELIST_URLS = None
  1510. # ----
  1511. # APM config
  1512. # ----
  1513. # sample rate for transactions initiated from the frontend
  1514. SENTRY_FRONTEND_APM_SAMPLING = 0
  1515. # sample rate for transactions in the backend
  1516. SENTRY_BACKEND_APM_SAMPLING = 0
  1517. # Sample rate for symbolicate_event task transactions
  1518. SENTRY_SYMBOLICATE_EVENT_APM_SAMPLING = 0
  1519. # Sample rate for the process_event task transactions
  1520. SENTRY_PROCESS_EVENT_APM_SAMPLING = 0
  1521. # sample rate for the relay projectconfig endpoint
  1522. SENTRY_RELAY_ENDPOINT_APM_SAMPLING = 0
  1523. # sample rate for relay's cache invalidation task
  1524. SENTRY_RELAY_TASK_APM_SAMPLING = 0
  1525. # sample rate for ingest consumer processing functions
  1526. SENTRY_INGEST_CONSUMER_APM_SAMPLING = 0
  1527. # sample rate for Apple App Store Connect tasks transactions
  1528. SENTRY_APPCONNECT_APM_SAMPLING = SENTRY_BACKEND_APM_SAMPLING
  1529. # sample rate for suspect commits task
  1530. SENTRY_SUSPECT_COMMITS_APM_SAMPLING = 0
  1531. # sample rate for post_process_group task
  1532. SENTRY_POST_PROCESS_GROUP_APM_SAMPLING = 0
  1533. # sample rate for all reprocessing tasks (except for the per-event ones)
  1534. SENTRY_REPROCESSING_APM_SAMPLING = 0
  1535. # ----
  1536. # end APM config
  1537. # ----
  1538. # DSN to use for Sentry monitors
  1539. SENTRY_MONITOR_DSN = None
  1540. SENTRY_MONITOR_API_ROOT = None
  1541. # Web Service
  1542. SENTRY_WEB_HOST = "127.0.0.1"
  1543. SENTRY_WEB_PORT = 9000
  1544. SENTRY_WEB_OPTIONS: dict[str, Any] = {}
  1545. # SMTP Service
  1546. SENTRY_SMTP_HOST = "127.0.0.1"
  1547. SENTRY_SMTP_PORT = 1025
  1548. SENTRY_INTERFACES = {
  1549. "csp": "sentry.interfaces.security.Csp",
  1550. "hpkp": "sentry.interfaces.security.Hpkp",
  1551. "expectct": "sentry.interfaces.security.ExpectCT",
  1552. "expectstaple": "sentry.interfaces.security.ExpectStaple",
  1553. "exception": "sentry.interfaces.exception.Exception",
  1554. "logentry": "sentry.interfaces.message.Message",
  1555. "request": "sentry.interfaces.http.Http",
  1556. "sdk": "sentry.interfaces.sdk.Sdk",
  1557. "stacktrace": "sentry.interfaces.stacktrace.Stacktrace",
  1558. "template": "sentry.interfaces.template.Template",
  1559. "user": "sentry.interfaces.user.User",
  1560. "breadcrumbs": "sentry.interfaces.breadcrumbs.Breadcrumbs",
  1561. "contexts": "sentry.interfaces.contexts.Contexts",
  1562. "threads": "sentry.interfaces.threads.Threads",
  1563. "debug_meta": "sentry.interfaces.debug_meta.DebugMeta",
  1564. "spans": "sentry.interfaces.spans.Spans",
  1565. }
  1566. PREFER_CANONICAL_LEGACY_KEYS = False
  1567. SENTRY_EMAIL_BACKEND_ALIASES = {
  1568. "smtp": "django.core.mail.backends.smtp.EmailBackend",
  1569. "dummy": "django.core.mail.backends.dummy.EmailBackend",
  1570. "console": "django.core.mail.backends.console.EmailBackend",
  1571. "preview": "sentry.utils.email.PreviewBackend",
  1572. }
  1573. SENTRY_FILESTORE_ALIASES = {
  1574. "filesystem": "django.core.files.storage.FileSystemStorage",
  1575. "s3": "sentry.filestore.s3.S3Boto3Storage",
  1576. "gcs": "sentry.filestore.gcs.GoogleCloudStorage",
  1577. }
  1578. SENTRY_ANALYTICS_ALIASES = {
  1579. "noop": "sentry.analytics.Analytics",
  1580. "pubsub": "sentry.analytics.pubsub.PubSubAnalytics",
  1581. }
  1582. # set of backends that do not support needing SMTP mail.* settings
  1583. # This list is a bit fragile and hardcoded, but it's unlikely that
  1584. # a user will be using a different backend that also mandates SMTP
  1585. # credentials.
  1586. SENTRY_SMTP_DISABLED_BACKENDS = frozenset(
  1587. (
  1588. "django.core.mail.backends.dummy.EmailBackend",
  1589. "django.core.mail.backends.console.EmailBackend",
  1590. "django.core.mail.backends.locmem.EmailBackend",
  1591. "django.core.mail.backends.filebased.EmailBackend",
  1592. "sentry.utils.email.PreviewBackend",
  1593. )
  1594. )
  1595. SENTRY_UPLOAD_RETRY_TIME = 60 # 1 min
  1596. # Should users without superuser permissions be allowed to
  1597. # make projects public
  1598. SENTRY_ALLOW_PUBLIC_PROJECTS = True
  1599. # Will an invite be sent when a member is added to an organization?
  1600. SENTRY_ENABLE_INVITES = True
  1601. # Origins allowed for session-based API access (via the Access-Control-Allow-Origin header)
  1602. SENTRY_ALLOW_ORIGIN = None
  1603. # Buffer backend
  1604. SENTRY_BUFFER = "sentry.buffer.Buffer"
  1605. SENTRY_BUFFER_OPTIONS: dict[str, str] = {}
  1606. # Cache backend
  1607. # XXX: We explicitly require the cache to be configured as its not optional
  1608. # and causes serious confusion with the default django cache
  1609. SENTRY_CACHE = None
  1610. SENTRY_CACHE_OPTIONS = {"is_default_cache": True}
  1611. # Attachment blob cache backend
  1612. SENTRY_ATTACHMENTS = "sentry.attachments.default.DefaultAttachmentCache"
  1613. SENTRY_ATTACHMENTS_OPTIONS: dict[str, str] = {}
  1614. # Replays blob cache backend.
  1615. #
  1616. # To ease first time setup, we default to whatever SENTRY_CACHE is configured as. If you're
  1617. # handling a large amount of replays you should consider setting up an isolated cache provider.
  1618. # To override the default configuration you need to provide the string path of a function or
  1619. # class as the `SENTRY_REPLAYS_CACHE` value and optionally provide keyword arguments on the
  1620. # `SENTRY_REPLAYS_CACHE_OPTIONS` value. Its expected that you will use one of the classes
  1621. # defined within `sentry/cache/` but it is not required.
  1622. # For reference, this cache will store binary blobs of data up to 1MB in size. This data is
  1623. # ephemeral and will be deleted as soon as the ingestion pipeline finishes processing a replay
  1624. # recording segment. You can determine the average size of the chunks being cached by running
  1625. # queries against the ReplayRecordingSegment model with the File model joined. The File model has
  1626. # a size attribute.
  1627. SENTRY_REPLAYS_CACHE: str = "sentry.replays.cache.default"
  1628. SENTRY_REPLAYS_CACHE_OPTIONS: Dict[str, Any] = {}
  1629. # Events blobs processing backend
  1630. SENTRY_EVENT_PROCESSING_STORE = "sentry.eventstore.processing.default.DefaultEventProcessingStore"
  1631. SENTRY_EVENT_PROCESSING_STORE_OPTIONS: dict[str, str] = {}
  1632. # The internal Django cache is still used in many places
  1633. # TODO(dcramer): convert uses over to Sentry's backend
  1634. CACHES = {"default": {"BACKEND": "django.core.cache.backends.dummy.DummyCache"}}
  1635. # The cache version affects both Django's internal cache (at runtime) as well
  1636. # as Sentry's cache. This automatically overrides VERSION on the default
  1637. # CACHES backend.
  1638. CACHE_VERSION = 1
  1639. # Digests backend
  1640. SENTRY_DIGESTS = "sentry.digests.backends.dummy.DummyBackend"
  1641. SENTRY_DIGESTS_OPTIONS: dict[str, Any] = {}
  1642. # Quota backend
  1643. SENTRY_QUOTAS = "sentry.quotas.Quota"
  1644. SENTRY_QUOTA_OPTIONS: dict[str, str] = {}
  1645. # Cache for Relay project configs
  1646. SENTRY_RELAY_PROJECTCONFIG_CACHE = "sentry.relay.projectconfig_cache.redis.RedisProjectConfigCache"
  1647. SENTRY_RELAY_PROJECTCONFIG_CACHE_OPTIONS: dict[str, str] = {}
  1648. # Which cache to use for debouncing cache updates to the projectconfig cache
  1649. SENTRY_RELAY_PROJECTCONFIG_DEBOUNCE_CACHE = (
  1650. "sentry.relay.projectconfig_debounce_cache.base.ProjectConfigDebounceCache"
  1651. )
  1652. SENTRY_RELAY_PROJECTCONFIG_DEBOUNCE_CACHE_OPTIONS: dict[str, str] = {}
  1653. # Rate limiting backend
  1654. SENTRY_RATELIMITER = "sentry.ratelimits.base.RateLimiter"
  1655. SENTRY_RATELIMITER_ENABLED = False
  1656. SENTRY_RATELIMITER_OPTIONS: dict[str, Any] = {}
  1657. SENTRY_RATELIMITER_DEFAULT = 999
  1658. SENTRY_CONCURRENT_RATE_LIMIT_DEFAULT = 999
  1659. ENFORCE_CONCURRENT_RATE_LIMITS = False
  1660. # Rate Limit Group Category Defaults
  1661. SENTRY_CONCURRENT_RATE_LIMIT_GROUP_CLI = 999
  1662. SENTRY_RATELIMITER_GROUP_CLI = 999
  1663. # The default value for project-level quotas
  1664. SENTRY_DEFAULT_MAX_EVENTS_PER_MINUTE = "90%"
  1665. # Snuba configuration
  1666. SENTRY_SNUBA = os.environ.get("SNUBA", "http://127.0.0.1:1218")
  1667. SENTRY_SNUBA_TIMEOUT = 30
  1668. SENTRY_SNUBA_CACHE_TTL_SECONDS = 60
  1669. # Node storage backend
  1670. SENTRY_NODESTORE = "sentry.nodestore.django.DjangoNodeStorage"
  1671. SENTRY_NODESTORE_OPTIONS: dict[str, Any] = {}
  1672. # Tag storage backend
  1673. SENTRY_TAGSTORE = os.environ.get("SENTRY_TAGSTORE", "sentry.tagstore.snuba.SnubaTagStorage")
  1674. SENTRY_TAGSTORE_OPTIONS: dict[str, Any] = {}
  1675. # Search backend
  1676. SENTRY_SEARCH = os.environ.get(
  1677. "SENTRY_SEARCH", "sentry.search.snuba.EventsDatasetSnubaSearchBackend"
  1678. )
  1679. SENTRY_SEARCH_OPTIONS: dict[str, Any] = {}
  1680. # SENTRY_SEARCH_OPTIONS = {
  1681. # 'urls': ['http://127.0.0.1:9200/'],
  1682. # 'timeout': 5,
  1683. # }
  1684. # Time-series storage backend
  1685. SENTRY_TSDB = "sentry.tsdb.dummy.DummyTSDB"
  1686. SENTRY_TSDB_OPTIONS: dict[str, Any] = {}
  1687. SENTRY_NEWSLETTER = "sentry.newsletter.base.Newsletter"
  1688. SENTRY_NEWSLETTER_OPTIONS: dict[str, Any] = {}
  1689. SENTRY_EVENTSTREAM = "sentry.eventstream.snuba.SnubaEventStream"
  1690. SENTRY_EVENTSTREAM_OPTIONS: dict[str, Any] = {}
  1691. # rollups must be ordered from highest granularity to lowest
  1692. SENTRY_TSDB_ROLLUPS = (
  1693. # (time in seconds, samples to keep)
  1694. (10, 360), # 60 minutes at 10 seconds
  1695. (3600, 24 * 7), # 7 days at 1 hour
  1696. (3600 * 24, 90), # 90 days at 1 day
  1697. )
  1698. # Internal metrics
  1699. SENTRY_METRICS_BACKEND = "sentry.metrics.dummy.DummyMetricsBackend"
  1700. SENTRY_METRICS_OPTIONS: dict[str, Any] = {}
  1701. SENTRY_METRICS_SAMPLE_RATE = 1.0
  1702. SENTRY_METRICS_PREFIX = "sentry."
  1703. SENTRY_METRICS_SKIP_INTERNAL_PREFIXES: list[str] = [] # Order this by most frequent prefixes.
  1704. SENTRY_METRICS_SKIP_ALL_INTERNAL = False
  1705. SENTRY_METRICS_DISALLOW_BAD_TAGS = IS_DEV
  1706. # Metrics product
  1707. SENTRY_METRICS_INDEXER = "sentry.sentry_metrics.indexer.postgres.postgres_v2.PostgresIndexer"
  1708. SENTRY_METRICS_INDEXER_OPTIONS: dict[str, Any] = {}
  1709. SENTRY_METRICS_INDEXER_CACHE_TTL = 3600 * 2
  1710. SENTRY_METRICS_INDEXER_TRANSACTIONS_SAMPLE_RATE = 0.1
  1711. SENTRY_METRICS_INDEXER_SPANNER_OPTIONS: dict[str, Any] = {}
  1712. # Rate limits during string indexing for our metrics product.
  1713. # Which cluster to use. Example: {"cluster": "default"}
  1714. SENTRY_METRICS_INDEXER_WRITES_LIMITER_OPTIONS: dict[str, str] = {}
  1715. SENTRY_METRICS_INDEXER_WRITES_LIMITER_OPTIONS_PERFORMANCE = (
  1716. SENTRY_METRICS_INDEXER_WRITES_LIMITER_OPTIONS
  1717. )
  1718. # Controls the sample rate with which we report errors to Sentry for metric messages
  1719. # dropped due to rate limits.
  1720. SENTRY_METRICS_INDEXER_DEBUG_LOG_SAMPLE_RATE = 0.01
  1721. # Cardinality limits during metric bucket ingestion.
  1722. # Which cluster to use. Example: {"cluster": "default"}
  1723. SENTRY_METRICS_INDEXER_CARDINALITY_LIMITER_OPTIONS: dict[str, Any] = {}
  1724. SENTRY_METRICS_INDEXER_CARDINALITY_LIMITER_OPTIONS_PERFORMANCE: dict[str, Any] = {}
  1725. SENTRY_METRICS_INDEXER_ENABLE_SLICED_PRODUCER = False
  1726. # Release Health
  1727. SENTRY_RELEASE_HEALTH = "sentry.release_health.sessions.SessionsReleaseHealthBackend"
  1728. SENTRY_RELEASE_HEALTH_OPTIONS: dict[str, Any] = {}
  1729. # Release Monitor
  1730. SENTRY_RELEASE_MONITOR = (
  1731. "sentry.release_health.release_monitor.sessions.SessionReleaseMonitorBackend"
  1732. )
  1733. SENTRY_RELEASE_MONITOR_OPTIONS: dict[str, Any] = {}
  1734. # Render charts on the backend. This uses the Chartcuterie external service.
  1735. SENTRY_CHART_RENDERER = "sentry.charts.chartcuterie.Chartcuterie"
  1736. SENTRY_CHART_RENDERER_OPTIONS: dict[str, Any] = {}
  1737. # URI Prefixes for generating DSN URLs
  1738. # (Defaults to URL_PREFIX by default)
  1739. SENTRY_ENDPOINT = None
  1740. SENTRY_PUBLIC_ENDPOINT = None
  1741. # Hostname prefix to add for organizations that are opted into the
  1742. # `organizations:org-subdomains` feature.
  1743. SENTRY_ORG_SUBDOMAIN_TEMPLATE = "o{organization_id}.ingest"
  1744. # Prevent variables (e.g. context locals, http data, etc) from exceeding this
  1745. # size in characters
  1746. SENTRY_MAX_VARIABLE_SIZE = 512
  1747. # Prevent variables within extra context from exceeding this size in
  1748. # characters
  1749. SENTRY_MAX_EXTRA_VARIABLE_SIZE = 4096 * 4 # 16kb
  1750. # For changing the amount of data seen in Http Response Body part.
  1751. SENTRY_MAX_HTTP_BODY_SIZE = 4096 * 4 # 16kb
  1752. # For various attributes we don't limit the entire attribute on size, but the
  1753. # individual item. In those cases we also want to limit the maximum number of
  1754. # keys
  1755. SENTRY_MAX_DICTIONARY_ITEMS = 50
  1756. SENTRY_MAX_MESSAGE_LENGTH = 1024 * 8
  1757. # Gravatar service base url
  1758. SENTRY_GRAVATAR_BASE_URL = "https://secure.gravatar.com"
  1759. # Timeout (in seconds) for fetching remote source files (e.g. JS)
  1760. SENTRY_SOURCE_FETCH_TIMEOUT = 5
  1761. # Timeout (in seconds) for socket operations when fetching remote source files
  1762. SENTRY_SOURCE_FETCH_SOCKET_TIMEOUT = 2
  1763. # Maximum content length for source files before we abort fetching
  1764. SENTRY_SOURCE_FETCH_MAX_SIZE = 40 * 1024 * 1024
  1765. # Maximum content length for cache value. Currently used only to avoid
  1766. # pointless compression of sourcemaps and other release files because we
  1767. # silently fail to cache the compressed result anyway. Defaults to None which
  1768. # disables the check and allows different backends for unlimited payload.
  1769. # e.g. memcached defaults to 1MB = 1024 * 1024
  1770. SENTRY_CACHE_MAX_VALUE_SIZE = None
  1771. # Fields which managed users cannot change via Sentry UI. Username and password
  1772. # cannot be changed by managed users. Optionally include 'email' and
  1773. # 'name' in SENTRY_MANAGED_USER_FIELDS.
  1774. SENTRY_MANAGED_USER_FIELDS = ()
  1775. # Secret key for OpenAI
  1776. OPENAI_API_KEY = None
  1777. SENTRY_SCOPES = {
  1778. "org:read",
  1779. "org:write",
  1780. "org:admin",
  1781. "org:integrations",
  1782. "member:read",
  1783. "member:write",
  1784. "member:admin",
  1785. "team:read",
  1786. "team:write",
  1787. "team:admin",
  1788. "project:read",
  1789. "project:write",
  1790. "project:admin",
  1791. "project:releases",
  1792. "event:read",
  1793. "event:write",
  1794. "event:admin",
  1795. "alerts:write",
  1796. "alerts:read",
  1797. }
  1798. SENTRY_SCOPE_SETS = (
  1799. (
  1800. ("org:admin", "Read, write, and admin access to organization details."),
  1801. ("org:write", "Read and write access to organization details."),
  1802. ("org:read", "Read access to organization details."),
  1803. ),
  1804. (("org:integrations", "Read, write, and admin access to organization integrations."),),
  1805. (
  1806. ("member:admin", "Read, write, and admin access to organization members."),
  1807. ("member:write", "Read and write access to organization members."),
  1808. ("member:read", "Read access to organization members."),
  1809. ),
  1810. (
  1811. ("team:admin", "Read, write, and admin access to teams."),
  1812. ("team:write", "Read and write access to teams."),
  1813. ("team:read", "Read access to teams."),
  1814. ),
  1815. (
  1816. ("project:admin", "Read, write, and admin access to projects."),
  1817. ("project:write", "Read and write access to projects."),
  1818. ("project:read", "Read access to projects."),
  1819. ),
  1820. (("project:releases", "Read, write, and admin access to project releases."),),
  1821. (
  1822. ("event:admin", "Read, write, and admin access to events."),
  1823. ("event:write", "Read and write access to events."),
  1824. ("event:read", "Read access to events."),
  1825. ),
  1826. (
  1827. ("alerts:write", "Read and write alerts"),
  1828. ("alerts:read", "Read alerts"),
  1829. ),
  1830. )
  1831. SENTRY_DEFAULT_ROLE = "member"
  1832. # Roles are ordered, which represents a sort-of hierarchy, as well as how
  1833. # they're presented in the UI. This is primarily important in that a member
  1834. # that is earlier in the chain cannot manage the settings of a member later
  1835. # in the chain (they still require the appropriate scope).
  1836. SENTRY_ROLES = (
  1837. {
  1838. "id": "member",
  1839. "name": "Member",
  1840. "desc": "Members can view and act on events, as well as view most other data within the organization.",
  1841. "scopes": {
  1842. "event:read",
  1843. "event:write",
  1844. "event:admin",
  1845. "project:releases",
  1846. "project:read",
  1847. "org:read",
  1848. "member:read",
  1849. "team:read",
  1850. "alerts:read",
  1851. "alerts:write",
  1852. },
  1853. },
  1854. {
  1855. "id": "admin",
  1856. "name": "Admin",
  1857. "desc": (
  1858. """
  1859. Admin privileges on any teams of which they're a member. They can
  1860. create new teams and projects, as well as remove teams and projects
  1861. on which they already hold membership (or all teams, if open
  1862. membership is enabled). Additionally, they can manage memberships of
  1863. teams that they are members of. They cannot invite members to the
  1864. organization.
  1865. """
  1866. ),
  1867. "scopes": {
  1868. "event:read",
  1869. "event:write",
  1870. "event:admin",
  1871. "org:read",
  1872. "member:read",
  1873. "project:read",
  1874. "project:write",
  1875. "project:admin",
  1876. "project:releases",
  1877. "team:read",
  1878. "team:write",
  1879. "team:admin",
  1880. "org:integrations",
  1881. "alerts:read",
  1882. "alerts:write",
  1883. },
  1884. "is_retired": True,
  1885. },
  1886. {
  1887. "id": "manager",
  1888. "name": "Manager",
  1889. "desc": "Gains admin access on all teams as well as the ability to add and remove members.",
  1890. "scopes": {
  1891. "event:read",
  1892. "event:write",
  1893. "event:admin",
  1894. "member:read",
  1895. "member:write",
  1896. "member:admin",
  1897. "project:read",
  1898. "project:write",
  1899. "project:admin",
  1900. "project:releases",
  1901. "team:read",
  1902. "team:write",
  1903. "team:admin",
  1904. "org:read",
  1905. "org:write",
  1906. "org:integrations",
  1907. "alerts:read",
  1908. "alerts:write",
  1909. },
  1910. "is_global": True,
  1911. },
  1912. {
  1913. "id": "owner",
  1914. "name": "Owner",
  1915. "desc": (
  1916. """
  1917. Unrestricted access to the organization, its data, and its settings.
  1918. Can add, modify, and delete projects and members, as well as make
  1919. billing and plan changes.
  1920. """
  1921. ),
  1922. "scopes": {
  1923. "org:read",
  1924. "org:write",
  1925. "org:admin",
  1926. "org:integrations",
  1927. "member:read",
  1928. "member:write",
  1929. "member:admin",
  1930. "team:read",
  1931. "team:write",
  1932. "team:admin",
  1933. "project:read",
  1934. "project:write",
  1935. "project:admin",
  1936. "project:releases",
  1937. "event:read",
  1938. "event:write",
  1939. "event:admin",
  1940. "alerts:read",
  1941. "alerts:write",
  1942. },
  1943. "is_global": True,
  1944. },
  1945. )
  1946. SENTRY_TEAM_ROLES = (
  1947. {
  1948. "id": "contributor",
  1949. "name": "Contributor",
  1950. "desc": "Contributors can view and act on events, as well as view most other data within the team's projects.",
  1951. "scopes": {
  1952. "event:read",
  1953. "event:write",
  1954. # "event:admin", # Scope granted/withdrawn by "sentry:events_member_admin" to org-level role
  1955. "project:releases",
  1956. "project:read",
  1957. "org:read",
  1958. "member:read",
  1959. "team:read",
  1960. "alerts:read",
  1961. # "alerts:write", # Scope granted/withdrawn by "sentry:alerts_member_write" to org-level role
  1962. },
  1963. },
  1964. {
  1965. "id": "admin",
  1966. "name": "Team Admin",
  1967. "desc": (
  1968. # TODO: Editing pass
  1969. """
  1970. Admin privileges on the team. They can create and remove projects,
  1971. and can manage the team's memberships. They cannot invite members to
  1972. the organization.
  1973. """
  1974. ),
  1975. "scopes": {
  1976. "event:read",
  1977. "event:write",
  1978. "event:admin",
  1979. "org:read",
  1980. "member:read",
  1981. "project:read",
  1982. "project:write",
  1983. "project:admin",
  1984. "project:releases",
  1985. "team:read",
  1986. "team:write",
  1987. "team:admin",
  1988. "org:integrations",
  1989. "alerts:read",
  1990. "alerts:write",
  1991. },
  1992. "is_minimum_role_for": "admin",
  1993. },
  1994. )
  1995. # See sentry/options/__init__.py for more information
  1996. SENTRY_OPTIONS: dict[str, Any] = {}
  1997. SENTRY_DEFAULT_OPTIONS: dict[str, Any] = {}
  1998. # You should not change this setting after your database has been created
  1999. # unless you have altered all schemas first
  2000. SENTRY_USE_BIG_INTS = False
  2001. # Delay (in ms) to induce on API responses
  2002. #
  2003. # Simulates a small amount of lag which helps uncover more obvious race
  2004. # conditions in UI interactions. It's also needed to test (or implement) any
  2005. # kind of loading scenarios. Without this we will just implicitly lower the
  2006. # overall quality of software we ship because we will not experience it in the
  2007. # same way we would in production.
  2008. #
  2009. # See discussion on https://github.com/getsentry/sentry/pull/20187
  2010. SENTRY_API_RESPONSE_DELAY = 150 if IS_DEV else None
  2011. # Watchers for various application purposes (such as compiling static media)
  2012. # XXX(dcramer): this doesn't work outside of a source distribution as the
  2013. # webpack.config.js is not part of Sentry's datafiles
  2014. SENTRY_WATCHERS = (
  2015. (
  2016. "webpack",
  2017. [
  2018. os.path.join(NODE_MODULES_ROOT, ".bin", "webpack"),
  2019. "serve",
  2020. "--color",
  2021. "--output-pathinfo=true",
  2022. "--config={}".format(
  2023. os.path.normpath(
  2024. os.path.join(PROJECT_ROOT, os.pardir, os.pardir, "webpack.config.ts")
  2025. )
  2026. ),
  2027. ],
  2028. ),
  2029. )
  2030. # Controls whether devserver spins up Relay, Kafka, and several ingest worker jobs to direct store traffic
  2031. # through the Relay ingestion pipeline. Without, ingestion is completely disabled. Use `bin/load-mocks` to
  2032. # generate fake data for local testing. You can also manually enable relay with the `--ingest` flag to `devserver`.
  2033. # XXX: This is disabled by default as typical development workflows do not require end-to-end services running
  2034. # and disabling optional services reduces resource consumption and complexity
  2035. SENTRY_USE_RELAY = False
  2036. SENTRY_RELAY_PORT = 7899
  2037. # Controls whether we'll run the snuba subscription processor. If enabled, we'll run
  2038. # it as a worker, and devservices will run Kafka.
  2039. SENTRY_DEV_PROCESS_SUBSCRIPTIONS = False
  2040. # The chunk size for attachments in blob store. Should be a power of two.
  2041. SENTRY_ATTACHMENT_BLOB_SIZE = 8 * 1024 * 1024 # 8MB
  2042. # The chunk size for files in the chunk upload. This is used for native debug
  2043. # files and source maps, and directly translates to the chunk size in blob
  2044. # store. MUST be a power of two.
  2045. SENTRY_CHUNK_UPLOAD_BLOB_SIZE = 8 * 1024 * 1024 # 8MB
  2046. # This flag tell DEVSERVICES to start the ingest-metrics-consumer in order to work on
  2047. # metrics in the development environment. Note: this is "metrics" the product
  2048. SENTRY_USE_METRICS_DEV = False
  2049. # This flags activates the Change Data Capture backend in the development environment
  2050. SENTRY_USE_CDC_DEV = False
  2051. # This flag activates profiling backend in the development environment
  2052. SENTRY_USE_PROFILING = False
  2053. # This flag activates consuming issue platform occurrence data in the development environment
  2054. SENTRY_USE_ISSUE_OCCURRENCE = False
  2055. # This flag activates code paths that are specific for customer domains
  2056. SENTRY_USE_CUSTOMER_DOMAINS = False
  2057. # SENTRY_DEVSERVICES = {
  2058. # "service-name": lambda settings, options: (
  2059. # {
  2060. # "image": "image-name:version",
  2061. # # optional ports to expose
  2062. # "ports": {"internal-port/tcp": external-port},
  2063. # # optional command
  2064. # "command": ["exit 1"],
  2065. # optional mapping of volumes
  2066. # "volumes": {"volume-name": {"bind": "/path/in/container"}},
  2067. # # optional statement to test if service should run
  2068. # "only_if": lambda settings, options: True,
  2069. # # optional environment variables
  2070. # "environment": {
  2071. # "ENV_VAR": "1",
  2072. # }
  2073. # }
  2074. # )
  2075. # }
  2076. def build_cdc_postgres_init_db_volume(settings: Any) -> dict[str, dict[str, str]]:
  2077. return (
  2078. {
  2079. os.path.join(settings.CDC_CONFIG_DIR, "init_hba.sh"): {
  2080. "bind": "/docker-entrypoint-initdb.d/init_hba.sh"
  2081. }
  2082. }
  2083. if settings.SENTRY_USE_CDC_DEV
  2084. else {}
  2085. )
  2086. # platform.processor() changed at some point between these:
  2087. # 11.2.3: arm
  2088. # 12.3.1: arm64
  2089. APPLE_ARM64 = sys.platform == "darwin" and platform.processor() in {"arm", "arm64"}
  2090. SENTRY_DEVSERVICES: dict[str, Callable[[Any, Any], dict[str, Any]]] = {
  2091. "redis": lambda settings, options: (
  2092. {
  2093. "image": "ghcr.io/getsentry/image-mirror-library-redis:5.0-alpine",
  2094. "ports": {"6379/tcp": 6379},
  2095. "command": [
  2096. "redis-server",
  2097. "--appendonly",
  2098. "yes",
  2099. "--save",
  2100. "60",
  2101. "20",
  2102. "--auto-aof-rewrite-percentage",
  2103. "100",
  2104. "--auto-aof-rewrite-min-size",
  2105. "64mb",
  2106. ],
  2107. "volumes": {"redis": {"bind": "/data"}},
  2108. }
  2109. ),
  2110. "postgres": lambda settings, options: (
  2111. {
  2112. "image": f"ghcr.io/getsentry/image-mirror-library-postgres:{PG_VERSION}-alpine",
  2113. "pull": True,
  2114. "ports": {"5432/tcp": 5432},
  2115. "environment": {"POSTGRES_DB": "sentry", "POSTGRES_HOST_AUTH_METHOD": "trust"},
  2116. "volumes": {
  2117. "postgres": {"bind": "/var/lib/postgresql/data"},
  2118. "wal2json": {"bind": "/wal2json"},
  2119. settings.CDC_CONFIG_DIR: {"bind": "/cdc"},
  2120. **build_cdc_postgres_init_db_volume(settings),
  2121. },
  2122. "command": [
  2123. "postgres",
  2124. "-c",
  2125. "wal_level=logical",
  2126. "-c",
  2127. "max_replication_slots=1",
  2128. "-c",
  2129. "max_wal_senders=1",
  2130. ],
  2131. "entrypoint": "/cdc/postgres-entrypoint.sh" if settings.SENTRY_USE_CDC_DEV else None,
  2132. }
  2133. ),
  2134. "zookeeper": lambda settings, options: (
  2135. {
  2136. # On Apple arm64, we upgrade to version 6.x to allow zookeeper to run properly on Apple's arm64
  2137. # See details https://github.com/confluentinc/kafka-images/issues/80#issuecomment-855511438
  2138. "image": "ghcr.io/getsentry/image-mirror-confluentinc-cp-zookeeper:6.2.0",
  2139. "environment": {"ZOOKEEPER_CLIENT_PORT": "2181"},
  2140. "volumes": {"zookeeper_6": {"bind": "/var/lib/zookeeper/data"}},
  2141. "only_if": "kafka" in settings.SENTRY_EVENTSTREAM or settings.SENTRY_USE_RELAY,
  2142. }
  2143. ),
  2144. "kafka": lambda settings, options: (
  2145. {
  2146. "image": "ghcr.io/getsentry/image-mirror-confluentinc-cp-kafka:6.2.0",
  2147. "ports": {"9092/tcp": 9092},
  2148. "environment": {
  2149. "KAFKA_ZOOKEEPER_CONNECT": "{containers[zookeeper][name]}:2181",
  2150. "KAFKA_LISTENERS": "INTERNAL://0.0.0.0:9093,EXTERNAL://0.0.0.0:9092",
  2151. "KAFKA_ADVERTISED_LISTENERS": "INTERNAL://{containers[kafka][name]}:9093,EXTERNAL://{containers[kafka]"
  2152. "[ports][9092/tcp][0]}:{containers[kafka][ports][9092/tcp][1]}",
  2153. "KAFKA_LISTENER_SECURITY_PROTOCOL_MAP": "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT",
  2154. "KAFKA_INTER_BROKER_LISTENER_NAME": "INTERNAL",
  2155. "KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR": "1",
  2156. "KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS": "1",
  2157. "KAFKA_LOG_RETENTION_HOURS": "24",
  2158. "KAFKA_MESSAGE_MAX_BYTES": "50000000",
  2159. "KAFKA_MAX_REQUEST_SIZE": "50000000",
  2160. },
  2161. "volumes": {"kafka_6": {"bind": "/var/lib/kafka/data"}},
  2162. "only_if": "kafka" in settings.SENTRY_EVENTSTREAM
  2163. or settings.SENTRY_USE_RELAY
  2164. or settings.SENTRY_DEV_PROCESS_SUBSCRIPTIONS
  2165. or settings.SENTRY_USE_PROFILING,
  2166. }
  2167. ),
  2168. "clickhouse": lambda settings, options: (
  2169. {
  2170. "image": "ghcr.io/getsentry/image-mirror-yandex-clickhouse-server:20.3.9.70"
  2171. if not APPLE_ARM64
  2172. # altinity provides clickhouse support to other companies
  2173. # Official support: https://github.com/ClickHouse/ClickHouse/issues/22222
  2174. # This image is build with this script https://gist.github.com/filimonov/5f9732909ff66d5d0a65b8283382590d
  2175. else "ghcr.io/getsentry/image-mirror-altinity-clickhouse-server:21.6.1.6734-testing-arm",
  2176. "pull": True,
  2177. "ports": {"9000/tcp": 9000, "9009/tcp": 9009, "8123/tcp": 8123},
  2178. "ulimits": [{"name": "nofile", "soft": 262144, "hard": 262144}],
  2179. # The arm image does not properly load the MAX_MEMORY_USAGE_RATIO
  2180. # from the environment in loc_config.xml, thus, hard-coding it there
  2181. "volumes": {
  2182. "clickhouse_dist"
  2183. if settings.SENTRY_DISTRIBUTED_CLICKHOUSE_TABLES
  2184. else "clickhouse": {"bind": "/var/lib/clickhouse"},
  2185. os.path.join(
  2186. settings.DEVSERVICES_CONFIG_DIR,
  2187. "clickhouse",
  2188. "dist_config.xml"
  2189. if settings.SENTRY_DISTRIBUTED_CLICKHOUSE_TABLES
  2190. else "loc_config.xml",
  2191. ): {"bind": "/etc/clickhouse-server/config.d/sentry.xml"},
  2192. },
  2193. }
  2194. ),
  2195. "snuba": lambda settings, options: (
  2196. {
  2197. "image": "ghcr.io/getsentry/snuba:latest",
  2198. "pull": True,
  2199. "ports": {"1218/tcp": 1218, "1219/tcp": 1219},
  2200. "command": ["devserver"]
  2201. + (["--no-workers"] if "snuba" in settings.SENTRY_EVENTSTREAM else []),
  2202. "environment": {
  2203. "PYTHONUNBUFFERED": "1",
  2204. "SNUBA_SETTINGS": "docker",
  2205. "DEBUG": "1",
  2206. "CLICKHOUSE_HOST": "{containers[clickhouse][name]}",
  2207. "CLICKHOUSE_PORT": "9000",
  2208. "CLICKHOUSE_HTTP_PORT": "8123",
  2209. "DEFAULT_BROKERS": ""
  2210. if "snuba" in settings.SENTRY_EVENTSTREAM
  2211. else "{containers[kafka][name]}:9093",
  2212. "REDIS_HOST": "{containers[redis][name]}",
  2213. "REDIS_PORT": "6379",
  2214. "REDIS_DB": "1",
  2215. "ENABLE_SENTRY_METRICS_DEV": "1" if settings.SENTRY_USE_METRICS_DEV else "",
  2216. "ENABLE_PROFILES_CONSUMER": "1" if settings.SENTRY_USE_PROFILING else "",
  2217. "ENABLE_ISSUE_OCCURRENCE_CONSUMER": "1"
  2218. if settings.SENTRY_USE_ISSUE_OCCURRENCE
  2219. else "",
  2220. "ENABLE_AUTORUN_MIGRATION_SEARCH_ISSUES": "1",
  2221. },
  2222. "only_if": "snuba" in settings.SENTRY_EVENTSTREAM
  2223. or "kafka" in settings.SENTRY_EVENTSTREAM,
  2224. }
  2225. ),
  2226. "bigtable": lambda settings, options: (
  2227. {
  2228. "image": "us.gcr.io/sentryio/cbtemulator:23c02d92c7a1747068eb1fc57dddbad23907d614",
  2229. "ports": {"8086/tcp": 8086},
  2230. # NEED_BIGTABLE is set by CI so we don't have to pass
  2231. # --skip-only-if when compiling which services to run.
  2232. "only_if": os.environ.get("NEED_BIGTABLE", False)
  2233. or "bigtable" in settings.SENTRY_NODESTORE,
  2234. }
  2235. ),
  2236. "memcached": lambda settings, options: (
  2237. {
  2238. "image": "ghcr.io/getsentry/image-mirror-library-memcached:1.5-alpine",
  2239. "ports": {"11211/tcp": 11211},
  2240. "only_if": "memcached" in settings.CACHES.get("default", {}).get("BACKEND"),
  2241. }
  2242. ),
  2243. "symbolicator": lambda settings, options: (
  2244. {
  2245. "image": "us.gcr.io/sentryio/symbolicator:nightly",
  2246. "pull": True,
  2247. "ports": {"3021/tcp": 3021},
  2248. "volumes": {settings.SYMBOLICATOR_CONFIG_DIR: {"bind": "/etc/symbolicator"}},
  2249. "command": ["run", "--config", "/etc/symbolicator/config.yml"],
  2250. "only_if": options.get("symbolicator.enabled"),
  2251. }
  2252. ),
  2253. "relay": lambda settings, options: (
  2254. {
  2255. "image": "us.gcr.io/sentryio/relay:nightly",
  2256. "pull": True,
  2257. "ports": {"7899/tcp": settings.SENTRY_RELAY_PORT},
  2258. "volumes": {settings.RELAY_CONFIG_DIR: {"bind": "/etc/relay"}},
  2259. "command": ["run", "--config", "/etc/relay"],
  2260. "only_if": bool(os.environ.get("SENTRY_USE_RELAY", settings.SENTRY_USE_RELAY)),
  2261. "with_devserver": True,
  2262. }
  2263. ),
  2264. "chartcuterie": lambda settings, options: (
  2265. {
  2266. "image": "us.gcr.io/sentryio/chartcuterie:latest",
  2267. "pull": True,
  2268. "volumes": {settings.CHARTCUTERIE_CONFIG_DIR: {"bind": "/etc/chartcuterie"}},
  2269. "environment": {
  2270. "CHARTCUTERIE_CONFIG": "/etc/chartcuterie/config.js",
  2271. "CHARTCUTERIE_CONFIG_POLLING": "true",
  2272. },
  2273. "ports": {"9090/tcp": 7901},
  2274. # NEED_CHARTCUTERIE is set by CI so we don't have to pass --skip-only-if when compiling which services to run.
  2275. "only_if": os.environ.get("NEED_CHARTCUTERIE", False)
  2276. or options.get("chart-rendering.enabled"),
  2277. }
  2278. ),
  2279. "cdc": lambda settings, options: (
  2280. {
  2281. "image": "ghcr.io/getsentry/cdc:latest",
  2282. "pull": True,
  2283. "only_if": settings.SENTRY_USE_CDC_DEV,
  2284. "command": ["cdc", "-c", "/etc/cdc/configuration.yaml", "producer"],
  2285. "volumes": {settings.CDC_CONFIG_DIR: {"bind": "/etc/cdc"}},
  2286. }
  2287. ),
  2288. "vroom": lambda settings, options: (
  2289. {
  2290. "image": "us.gcr.io/sentryio/vroom:nightly",
  2291. "pull": True,
  2292. "volumes": {"profiles": {"bind": "/var/lib/sentry-profiles"}},
  2293. "environment": {
  2294. "SENTRY_KAFKA_BROKERS_PROFILING": "{containers[kafka][name]}:9093",
  2295. "SENTRY_KAFKA_BROKERS_OCCURRENCES": "{containers[kafka][name]}:9093",
  2296. "SENTRY_SNUBA_HOST": "http://{containers[snuba][name]}:1218",
  2297. },
  2298. "ports": {"8085/tcp": 8085},
  2299. "only_if": settings.SENTRY_USE_PROFILING,
  2300. }
  2301. ),
  2302. }
  2303. # Max file size for serialized file uploads in API
  2304. SENTRY_MAX_SERIALIZED_FILE_SIZE = 5000000
  2305. # Max file size for avatar photo uploads
  2306. SENTRY_MAX_AVATAR_SIZE = 5000000
  2307. # The maximum age of raw events before they are deleted
  2308. SENTRY_RAW_EVENT_MAX_AGE_DAYS = 10
  2309. # statuspage.io support
  2310. STATUS_PAGE_ID = None
  2311. STATUS_PAGE_API_HOST = "statuspage.io"
  2312. SENTRY_SELF_HOSTED = True
  2313. # Whether we should look at X-Forwarded-For header or not
  2314. # when checking REMOTE_ADDR ip addresses
  2315. SENTRY_USE_X_FORWARDED_FOR = True
  2316. SENTRY_DEFAULT_INTEGRATIONS = (
  2317. "sentry.integrations.bitbucket.BitbucketIntegrationProvider",
  2318. "sentry.integrations.bitbucket_server.BitbucketServerIntegrationProvider",
  2319. "sentry.integrations.slack.SlackIntegrationProvider",
  2320. "sentry.integrations.github.GitHubIntegrationProvider",
  2321. "sentry.integrations.github_enterprise.GitHubEnterpriseIntegrationProvider",
  2322. "sentry.integrations.gitlab.GitlabIntegrationProvider",
  2323. "sentry.integrations.jira.JiraIntegrationProvider",
  2324. "sentry.integrations.jira_server.JiraServerIntegrationProvider",
  2325. "sentry.integrations.vsts.VstsIntegrationProvider",
  2326. "sentry.integrations.vsts_extension.VstsExtensionIntegrationProvider",
  2327. "sentry.integrations.pagerduty.integration.PagerDutyIntegrationProvider",
  2328. "sentry.integrations.vercel.VercelIntegrationProvider",
  2329. "sentry.integrations.msteams.MsTeamsIntegrationProvider",
  2330. "sentry.integrations.aws_lambda.AwsLambdaIntegrationProvider",
  2331. "sentry.integrations.custom_scm.CustomSCMIntegrationProvider",
  2332. )
  2333. SENTRY_SDK_CONFIG = {
  2334. "release": sentry.__semantic_version__,
  2335. "environment": ENVIRONMENT,
  2336. "in_app_include": ["sentry", "sentry_plugins"],
  2337. "debug": True,
  2338. "send_default_pii": True,
  2339. "auto_enabling_integrations": False,
  2340. "_experiments": {
  2341. "custom_measurements": True,
  2342. },
  2343. }
  2344. SENTRY_DEV_DSN = os.environ.get("SENTRY_DEV_DSN")
  2345. if SENTRY_DEV_DSN:
  2346. # In production, this value is *not* set via an env variable
  2347. # https://github.com/getsentry/getsentry/blob/16a07f72853104b911a368cc8ae2b4b49dbf7408/getsentry/conf/settings/prod.py#L604-L606
  2348. # This is used in case you want to report traces of your development set up to a project of your choice
  2349. SENTRY_SDK_CONFIG["dsn"] = SENTRY_DEV_DSN
  2350. # The sample rate to use for profiles. This is conditional on the usage of
  2351. # traces_sample_rate. So that means the true sample rate will be approximately
  2352. # traces_sample_rate * profiles_sample_rate
  2353. # (subject to things like the traces_sampler)
  2354. SENTRY_PROFILES_SAMPLE_RATE = 0
  2355. # We want to test a few schedulers possible in the profiler. Some are platform
  2356. # specific, and each have their own pros/cons. See the sdk for more details.
  2357. SENTRY_PROFILER_MODE = "sleep"
  2358. # To have finer control over which process will have profiling enabled, this
  2359. # environment variable will be required to enable profiling.
  2360. #
  2361. # This is because profiling requires that we run some stuff globally, and we
  2362. # are not ready to run this on the more critical parts of the codebase such as
  2363. # the ingest workers yet.
  2364. #
  2365. # This will allow us to have finer control over where we are running the
  2366. # profiler. For example, only on the web server.
  2367. SENTRY_PROFILING_ENABLED = os.environ.get("SENTRY_PROFILING_ENABLED", False)
  2368. # Callable to bind additional context for the Sentry SDK
  2369. #
  2370. # def get_org_context(scope, organization, **kwargs):
  2371. # scope.set_tag('organization.cool', '1')
  2372. #
  2373. # SENTRY_ORGANIZATION_CONTEXT_HELPER = get_org_context
  2374. SENTRY_ORGANIZATION_CONTEXT_HELPER = None
  2375. # Config options that are explicitly disabled from Django
  2376. DEAD = object()
  2377. # This will eventually get set from values in SENTRY_OPTIONS during
  2378. # sentry.runner.initializer:bootstrap_options
  2379. SECRET_KEY = DEAD
  2380. EMAIL_BACKEND = DEAD
  2381. EMAIL_HOST = DEAD
  2382. EMAIL_PORT = DEAD
  2383. EMAIL_HOST_USER = DEAD
  2384. EMAIL_HOST_PASSWORD = DEAD
  2385. EMAIL_USE_TLS = DEAD
  2386. EMAIL_USE_SSL = DEAD
  2387. SERVER_EMAIL = DEAD
  2388. EMAIL_SUBJECT_PREFIX = DEAD
  2389. # Shared btw Auth Provider and Social Auth Plugin
  2390. GITHUB_APP_ID = DEAD
  2391. GITHUB_API_SECRET = DEAD
  2392. # Used by Auth Provider
  2393. GITHUB_REQUIRE_VERIFIED_EMAIL = DEAD
  2394. GITHUB_API_DOMAIN = DEAD
  2395. GITHUB_BASE_DOMAIN = DEAD
  2396. # Used by Social Auth Plugin
  2397. GITHUB_EXTENDED_PERMISSIONS = DEAD
  2398. GITHUB_ORGANIZATION = DEAD
  2399. SUDO_URL = "sentry-sudo"
  2400. # Endpoint to https://github.com/getsentry/sentry-release-registry, used for
  2401. # alerting the user of outdated SDKs.
  2402. SENTRY_RELEASE_REGISTRY_BASEURL = None
  2403. # Hardcoded SDK versions for SDKs that do not have an entry in the release
  2404. # registry.
  2405. SDK_VERSIONS = {
  2406. "raven-js": "3.21.0",
  2407. "raven-node": "2.3.0",
  2408. "raven-python": "6.10.0",
  2409. "raven-ruby": "2.7.1",
  2410. "sentry-cocoa": "3.11.1",
  2411. "sentry-java": "1.6.4",
  2412. "sentry-laravel": "1.0.2",
  2413. "sentry-php": "2.0.1",
  2414. }
  2415. # Some of the migration links below are not ideal, but that is all migration documentation we currently have and can provide at this point
  2416. SDK_URLS = {
  2417. "sentry-java": "https://docs.sentry.io/platforms/java/legacy/migration/",
  2418. "@sentry/browser": "https://github.com/getsentry/sentry-javascript/blob/master/MIGRATION.md#migrating-from-raven-js-to-sentrybrowser",
  2419. "sentry-cocoa": "https://docs.sentry.io/platforms/apple/migration/",
  2420. "sentry-php": "https://docs.sentry.io/platforms/php/",
  2421. "sentry-python": "https://docs.sentry.io/platforms/python/migration/",
  2422. "sentry-ruby": "https://docs.sentry.io/platforms/ruby/migration/",
  2423. "sentry-dotnet": "https://docs.sentry.io/platforms/dotnet/migration/#migrating-from-sharpraven-to-sentry-sdk",
  2424. "sentry-go": "https://docs.sentry.io/platforms/go/migration/",
  2425. }
  2426. DEPRECATED_SDKS = {
  2427. # sdk name => new sdk name
  2428. "raven-java": "sentry-java",
  2429. "raven-java:android": "sentry-java",
  2430. "raven-java:log4j": "sentry-java",
  2431. "raven-java:log4j2": "sentry-java",
  2432. "raven-java:logback": "sentry-java",
  2433. "raven-js": "@sentry/browser",
  2434. "raven-node": "@sentry/browser",
  2435. "raven-objc": "sentry-cocoa",
  2436. "raven-php": "sentry-php",
  2437. "raven-python": "sentry-python",
  2438. "raven-ruby": "sentry-ruby",
  2439. "raven-swift": "sentry-cocoa",
  2440. "raven-csharp": "sentry-dotnet",
  2441. "raven-go": "sentry-go",
  2442. "sentry-android": "sentry-java",
  2443. "sentry-swift": "sentry-cocoa",
  2444. "SharpRaven": "sentry-dotnet",
  2445. # The Ruby SDK used to go by the name 'sentry-raven'...
  2446. "sentry-raven": "sentry-ruby",
  2447. }
  2448. TERMS_URL = None
  2449. PRIVACY_URL = None
  2450. # Internal sources for debug information files
  2451. #
  2452. # There are two special values in there: "microsoft" and "ios". These are
  2453. # added by default to any project created. The "ios" source is currently
  2454. # not enabled in the open source build of sentry because it points to a
  2455. # sentry internal repository and it's unclear if these can be
  2456. # redistributed under the Apple EULA. If however someone configures their
  2457. # own iOS source and name it 'ios' it will be enabled by default for all
  2458. # projects.
  2459. SENTRY_BUILTIN_SOURCES = {
  2460. "microsoft": {
  2461. "type": "http",
  2462. "id": "sentry:microsoft",
  2463. "name": "Microsoft",
  2464. "layout": {"type": "symstore"},
  2465. "filters": {"filetypes": ["pe", "pdb", "portablepdb"]},
  2466. "url": "https://msdl.microsoft.com/download/symbols/",
  2467. "is_public": True,
  2468. },
  2469. "nuget": {
  2470. "type": "http",
  2471. "id": "sentry:nuget",
  2472. "name": "NuGet.org",
  2473. "layout": {"type": "symstore"},
  2474. "filters": {"filetypes": ["portablepdb"]},
  2475. "url": "https://symbols.nuget.org/download/symbols/",
  2476. "is_public": True,
  2477. },
  2478. "citrix": {
  2479. "type": "http",
  2480. "id": "sentry:citrix",
  2481. "name": "Citrix",
  2482. "layout": {"type": "symstore"},
  2483. "filters": {"filetypes": ["pe", "pdb"]},
  2484. "url": "http://ctxsym.citrix.com/symbols/",
  2485. "is_public": True,
  2486. },
  2487. "intel": {
  2488. "type": "http",
  2489. "id": "sentry:intel",
  2490. "name": "Intel",
  2491. "layout": {"type": "symstore"},
  2492. "filters": {"filetypes": ["pe", "pdb"]},
  2493. "url": "https://software.intel.com/sites/downloads/symbols/",
  2494. "is_public": True,
  2495. },
  2496. "amd": {
  2497. "type": "http",
  2498. "id": "sentry:amd",
  2499. "name": "AMD",
  2500. "layout": {"type": "symstore"},
  2501. "filters": {"filetypes": ["pe", "pdb"]},
  2502. "url": "https://download.amd.com/dir/bin/",
  2503. "is_public": True,
  2504. },
  2505. "nvidia": {
  2506. "type": "http",
  2507. "id": "sentry:nvidia",
  2508. "name": "NVIDIA",
  2509. "layout": {"type": "symstore"},
  2510. "filters": {"filetypes": ["pe", "pdb"]},
  2511. "url": "https://driver-symbols.nvidia.com/",
  2512. "is_public": True,
  2513. },
  2514. "chromium": {
  2515. "type": "http",
  2516. "id": "sentry:chromium",
  2517. "name": "Chromium",
  2518. "layout": {"type": "symstore"},
  2519. "filters": {"filetypes": ["pe", "pdb"]},
  2520. "url": "https://chromium-browser-symsrv.commondatastorage.googleapis.com/",
  2521. "is_public": True,
  2522. },
  2523. "unity": {
  2524. "type": "http",
  2525. "id": "sentry:unity",
  2526. "name": "Unity",
  2527. "layout": {"type": "symstore"},
  2528. "filters": {"filetypes": ["pe", "pdb"]},
  2529. "url": "http://symbolserver.unity3d.com/",
  2530. "is_public": True,
  2531. },
  2532. "mozilla": {
  2533. "type": "http",
  2534. "id": "sentry:mozilla",
  2535. "name": "Mozilla",
  2536. "layout": {"type": "symstore"},
  2537. "url": "https://symbols.mozilla.org/",
  2538. "is_public": True,
  2539. },
  2540. "autodesk": {
  2541. "type": "http",
  2542. "id": "sentry:autodesk",
  2543. "name": "Autodesk",
  2544. "layout": {"type": "symstore"},
  2545. "url": "http://symbols.autodesk.com/",
  2546. "is_public": True,
  2547. },
  2548. "electron": {
  2549. "type": "http",
  2550. "id": "sentry:electron",
  2551. "name": "Electron",
  2552. "layout": {"type": "native"},
  2553. "url": "https://symbols.electronjs.org/",
  2554. "filters": {"filetypes": ["pdb", "breakpad", "sourcebundle"]},
  2555. "is_public": True,
  2556. },
  2557. # === Various Linux distributions ===
  2558. # The `https://debuginfod.elfutils.org/` symbol server is set up to federate
  2559. # to a bunch of distro-specific servers, and they explicitly state that:
  2560. # > If your distro offers a server, you may prefer to link to that one directly
  2561. # In the future, we could add the following servers as well after validating:
  2562. # - https://debuginfod.opensuse.org/
  2563. # - https://debuginfod.debian.net/
  2564. # - https://debuginfod.fedoraproject.org/
  2565. # - https://debuginfod.archlinux.org/
  2566. # - https://debuginfod.centos.org/
  2567. # A couple more servers for less widespread distros are also listed, and there
  2568. # might be even more that are not listed on that page.
  2569. # NOTE: The `debuginfod` layout in symbolicator requires the `/buildid/` prefix
  2570. # to be part of the `url`.
  2571. "ubuntu": {
  2572. "type": "http",
  2573. "id": "sentry:ubuntu",
  2574. "name": "Ubuntu",
  2575. "layout": {"type": "debuginfod"},
  2576. "url": "https://debuginfod.ubuntu.com/buildid/",
  2577. "filters": {"filetypes": ["elf_code", "elf_debug"]},
  2578. "is_public": True,
  2579. },
  2580. }
  2581. # Relay
  2582. # List of PKs explicitly allowed by Sentry. All relays here are always
  2583. # registered as internal relays.
  2584. # DEPRECATED !!! (18.May.2021) This entry has been deprecated in favour of
  2585. # ~/.sentry/conf.yml (relay.static_auth)
  2586. SENTRY_RELAY_WHITELIST_PK = [
  2587. # NOTE (RaduW) This is the relay key for the relay instance used by devservices.
  2588. # This should NOT be part of any production environment.
  2589. # This key should match the key in /sentry/config/relay/credentials.json
  2590. "SMSesqan65THCV6M4qs4kBzPai60LzuDn-xNsvYpuP8"
  2591. ]
  2592. # When open registration is not permitted then only relays in the
  2593. # list of explicitly allowed relays can register.
  2594. SENTRY_RELAY_OPEN_REGISTRATION = True
  2595. # GeoIP
  2596. # Used for looking up IP addresses.
  2597. # For example /usr/local/share/GeoIP/GeoIPCity.mmdb
  2598. GEOIP_PATH_MMDB = None
  2599. # CDN
  2600. # If this is an absolute url like e.g.: https://js.sentry-cdn.com/
  2601. # the full url will look like this: https://js.sentry-cdn.com/<public_key>.min.js
  2602. # otherwise django reverse url lookup will be used.
  2603. JS_SDK_LOADER_CDN_URL = ""
  2604. # Version of the SDK - Used in header Surrogate-Key sdk/JS_SDK_LOADER_SDK_VERSION
  2605. JS_SDK_LOADER_SDK_VERSION = ""
  2606. # This should be the url pointing to the JS SDK. It may contain up to two "%s".
  2607. # The first "%s" will be replaced with the SDK version, the second one is used
  2608. # to inject a bundle modifier in the JS SDK CDN loader. e.g:
  2609. # - 'https://browser.sentry-cdn.com/%s/bundle%s.min.js' will become
  2610. # 'https://browser.sentry-cdn.com/7.0.0/bundle.es5.min.js'
  2611. # - 'https://browser.sentry-cdn.com/%s/bundle.min.js' will become
  2612. # 'https://browser.sentry-cdn.com/7.0.0/bundle.min.js'
  2613. # - 'https://browser.sentry-cdn.com/6.19.7/bundle.min.js' will stay the same.
  2614. JS_SDK_LOADER_DEFAULT_SDK_URL = ""
  2615. # block domains which are generally used by spammers -- keep this configurable
  2616. # in case a self-hosted install wants to allow it
  2617. INVALID_EMAIL_ADDRESS_PATTERN = re.compile(r"\@qq\.com$", re.I)
  2618. # This is customizable for sentry.io, but generally should only be additive
  2619. # (currently the values not used anymore so this is more for documentation purposes)
  2620. SENTRY_USER_PERMISSIONS = ("broadcasts.admin", "users.admin", "options.admin")
  2621. # WARNING(iker): there are two different formats for KAFKA_CLUSTERS: the one we
  2622. # use below, and a legacy one still used in `getsentry`.
  2623. # Reading items from this default configuration directly might break deploys.
  2624. # To correctly read items from this dictionary and not worry about the format,
  2625. # see `sentry.utils.kafka_config.get_kafka_consumer_cluster_options`.
  2626. KAFKA_CLUSTERS = {
  2627. "default": {
  2628. "common": {"bootstrap.servers": "127.0.0.1:9092"},
  2629. "producers": {
  2630. "compression.type": "lz4",
  2631. "message.max.bytes": 50000000, # 50MB, default is 1MB
  2632. },
  2633. "consumers": {},
  2634. }
  2635. }
  2636. # These constants define kafka topic names, as well as keys into `KAFKA_TOPICS`
  2637. # which contains cluster mappings for these topics. Follow these steps to
  2638. # override a kafka topic name:
  2639. #
  2640. # 1. Change the value of the `KAFKA_*` constant (e.g. KAFKA_EVENTS).
  2641. # 2. For changes in override files, such as `sentry.conf.py` or in getsentry's
  2642. # `prod.py`, also override the entirety of `KAFKA_TOPICS` to ensure the keys
  2643. # pick up the change.
  2644. KAFKA_EVENTS = "events"
  2645. KAFKA_EVENTS_COMMIT_LOG = "snuba-commit-log"
  2646. KAFKA_TRANSACTIONS = "transactions"
  2647. KAFKA_TRANSACTIONS_COMMIT_LOG = "snuba-transactions-commit-log"
  2648. KAFKA_OUTCOMES = "outcomes"
  2649. KAFKA_OUTCOMES_BILLING = "outcomes-billing"
  2650. KAFKA_EVENTS_SUBSCRIPTIONS_RESULTS = "events-subscription-results"
  2651. KAFKA_TRANSACTIONS_SUBSCRIPTIONS_RESULTS = "transactions-subscription-results"
  2652. KAFKA_GENERIC_METRICS_SUBSCRIPTIONS_RESULTS = "generic-metrics-subscription-results"
  2653. KAFKA_SESSIONS_SUBSCRIPTIONS_RESULTS = "sessions-subscription-results"
  2654. KAFKA_METRICS_SUBSCRIPTIONS_RESULTS = "metrics-subscription-results"
  2655. KAFKA_INGEST_EVENTS = "ingest-events"
  2656. KAFKA_INGEST_ATTACHMENTS = "ingest-attachments"
  2657. KAFKA_INGEST_TRANSACTIONS = "ingest-transactions"
  2658. KAFKA_INGEST_METRICS = "ingest-metrics"
  2659. KAFKA_SNUBA_METRICS = "snuba-metrics"
  2660. KAFKA_PROFILES = "profiles"
  2661. KAFKA_INGEST_PERFORMANCE_METRICS = "ingest-performance-metrics"
  2662. KAFKA_SNUBA_GENERIC_METRICS = "snuba-generic-metrics"
  2663. KAFKA_INGEST_REPLAY_EVENTS = "ingest-replay-events"
  2664. KAFKA_INGEST_REPLAYS_RECORDINGS = "ingest-replay-recordings"
  2665. KAFKA_INGEST_OCCURRENCES = "ingest-occurrences"
  2666. KAFKA_INGEST_MONITORS = "ingest-monitors"
  2667. KAFKA_EVENTSTREAM_GENERIC = "generic-events"
  2668. KAFKA_GENERIC_EVENTS_COMMIT_LOG = "snuba-generic-events-commit-log"
  2669. KAFKA_SUBSCRIPTION_RESULT_TOPICS = {
  2670. "events": KAFKA_EVENTS_SUBSCRIPTIONS_RESULTS,
  2671. "transactions": KAFKA_TRANSACTIONS_SUBSCRIPTIONS_RESULTS,
  2672. "generic-metrics": KAFKA_GENERIC_METRICS_SUBSCRIPTIONS_RESULTS,
  2673. "sessions": KAFKA_SESSIONS_SUBSCRIPTIONS_RESULTS,
  2674. "metrics": KAFKA_METRICS_SUBSCRIPTIONS_RESULTS,
  2675. }
  2676. class TopicDefinition(TypedDict):
  2677. cluster: str
  2678. # Cluster configuration for each Kafka topic by name.
  2679. KAFKA_TOPICS: Mapping[str, Optional[TopicDefinition]] = {
  2680. KAFKA_EVENTS: {"cluster": "default"},
  2681. KAFKA_EVENTS_COMMIT_LOG: {"cluster": "default"},
  2682. KAFKA_TRANSACTIONS: {"cluster": "default"},
  2683. KAFKA_TRANSACTIONS_COMMIT_LOG: {"cluster": "default"},
  2684. KAFKA_OUTCOMES: {"cluster": "default"},
  2685. # When OUTCOMES_BILLING is None, it inherits from OUTCOMES and does not
  2686. # create a separate producer. Check ``track_outcome`` for details.
  2687. KAFKA_OUTCOMES_BILLING: None,
  2688. KAFKA_EVENTS_SUBSCRIPTIONS_RESULTS: {"cluster": "default"},
  2689. KAFKA_TRANSACTIONS_SUBSCRIPTIONS_RESULTS: {"cluster": "default"},
  2690. KAFKA_GENERIC_METRICS_SUBSCRIPTIONS_RESULTS: {"cluster": "default"},
  2691. KAFKA_SESSIONS_SUBSCRIPTIONS_RESULTS: {"cluster": "default"},
  2692. KAFKA_METRICS_SUBSCRIPTIONS_RESULTS: {"cluster": "default"},
  2693. # Topic for receiving simple events (error events without attachments) from Relay
  2694. KAFKA_INGEST_EVENTS: {"cluster": "default"},
  2695. # Topic for receiving 'complex' events (error events with attachments) from Relay
  2696. KAFKA_INGEST_ATTACHMENTS: {"cluster": "default"},
  2697. # Topic for receiving transaction events (APM events) from Relay
  2698. KAFKA_INGEST_TRANSACTIONS: {"cluster": "default"},
  2699. # Topic for receiving metrics from Relay
  2700. KAFKA_INGEST_METRICS: {"cluster": "default"},
  2701. # Topic for indexer translated metrics
  2702. KAFKA_SNUBA_METRICS: {"cluster": "default"},
  2703. # Topic for receiving profiles from Relay
  2704. KAFKA_PROFILES: {"cluster": "default"},
  2705. KAFKA_INGEST_PERFORMANCE_METRICS: {"cluster": "default"},
  2706. KAFKA_SNUBA_GENERIC_METRICS: {"cluster": "default"},
  2707. KAFKA_INGEST_REPLAY_EVENTS: {"cluster": "default"},
  2708. KAFKA_INGEST_REPLAYS_RECORDINGS: {"cluster": "default"},
  2709. KAFKA_INGEST_OCCURRENCES: {"cluster": "default"},
  2710. KAFKA_INGEST_MONITORS: {"cluster": "default"},
  2711. KAFKA_EVENTSTREAM_GENERIC: {"cluster": "default"},
  2712. KAFKA_GENERIC_EVENTS_COMMIT_LOG: {"cluster": "default"},
  2713. }
  2714. # If True, consumers will create the topics if they don't exist
  2715. KAFKA_CONSUMER_AUTO_CREATE_TOPICS = True
  2716. # If True, sentry.utils.arroyo.RunTaskWithMultiprocessing will actually be
  2717. # single-threaded under the hood for performance
  2718. KAFKA_CONSUMER_FORCE_DISABLE_MULTIPROCESSING = False
  2719. # For Jira, only approved apps can use the access_email_addresses scope
  2720. # This scope allows Sentry to use the email endpoint (https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-user-email-get)
  2721. # We use the email with Jira 2-way sync in order to match the user
  2722. JIRA_USE_EMAIL_SCOPE = False
  2723. """
  2724. Fields are:
  2725. - south_app_name: Which app to apply the conversion to
  2726. - south_migration: The south migration to map to the new name. If None, then always
  2727. apply
  2728. - django_app_name: The new app name to apply the conversion to
  2729. - django_migration: Which django migration to 'fake' as run.
  2730. - south_migration_required: Whether the south migration is required to proceed.
  2731. - south_migration_required_error: Error message explaining what is going wrong.
  2732. """
  2733. SOUTH_MIGRATION_CONVERSIONS = (
  2734. (
  2735. "sentry",
  2736. "0472_auto__add_field_sentryapp_author",
  2737. "sentry",
  2738. "0001_initial",
  2739. True,
  2740. "Please upgrade to Sentry 9.1.2 before upgrading to any later versions.",
  2741. ),
  2742. (
  2743. "sentry",
  2744. "0516_auto__del_grouptagvalue__del_unique_grouptagvalue_group_id_key_value__",
  2745. "sentry",
  2746. "0002_912_to_recent",
  2747. False,
  2748. "",
  2749. ),
  2750. (
  2751. "sentry",
  2752. "0518_auto__chg_field_sentryappwebhookerror_response_code",
  2753. "sentry",
  2754. "0003_auto_20191022_0122",
  2755. False,
  2756. "",
  2757. ),
  2758. ("sentry.nodestore", "0001_initial", "nodestore", "0001_initial", False, None),
  2759. ("nodestore", "0001_initial", "nodestore", "0001_initial", False, None),
  2760. (
  2761. "social_auth",
  2762. "0004_auto__del_unique_usersocialauth_provider_uid__add_unique_usersocialaut",
  2763. "social_auth",
  2764. "0001_initial",
  2765. True,
  2766. "Please upgrade to Sentry 9.1.2 before upgrading to any later versions.",
  2767. ),
  2768. )
  2769. # Whether to use Django migrations to create the database, or just build it based off
  2770. # of models, similar to how syncdb used to work. The former is more correct, the latter
  2771. # is much faster.
  2772. MIGRATIONS_TEST_MIGRATE = os.environ.get("MIGRATIONS_TEST_MIGRATE", "0") == "1"
  2773. # Specifies the list of django apps to include in the lockfile. If Falsey then include
  2774. # all apps with migrations
  2775. MIGRATIONS_LOCKFILE_APP_WHITELIST = (
  2776. "nodestore",
  2777. "sentry",
  2778. "social_auth",
  2779. "sentry.replays",
  2780. )
  2781. # Where to write the lockfile to.
  2782. MIGRATIONS_LOCKFILE_PATH = os.path.join(PROJECT_ROOT, os.path.pardir, os.path.pardir)
  2783. # Log error and abort processing (without dropping event) when process_event is
  2784. # taking more than n seconds to process event
  2785. SYMBOLICATOR_PROCESS_EVENT_HARD_TIMEOUT = 600
  2786. # Log warning when process_event is taking more than n seconds to process event
  2787. SYMBOLICATOR_PROCESS_EVENT_WARN_TIMEOUT = 120
  2788. # Block symbolicate_event for this many seconds to wait for a initial response
  2789. # from symbolicator after the task submission.
  2790. SYMBOLICATOR_POLL_TIMEOUT = 5
  2791. # When retrying symbolication requests or querying for the result this set the
  2792. # max number of second to wait between subsequent attempts.
  2793. SYMBOLICATOR_MAX_RETRY_AFTER = 2
  2794. # The `url` of the different Symbolicator pools.
  2795. # We want to route different workloads to a different set of Symbolicator pools.
  2796. # This can be as fine-grained as using a different pool for normal "native"
  2797. # symbolication, `js` symbolication, and for `lpq` / `lpq-js`.
  2798. # (See `SENTRY_LPQ_OPTIONS` and related settings)
  2799. # The keys here should match the `SymbolicatorPools` enum
  2800. # defined in `src/sentry/lang/native/symbolicator.py`.
  2801. # If a specific setting does not exist, this will fall back to the `default` pool.
  2802. # If that is not configured, it will fall back to the `url` configured in
  2803. # `symbolicator.options`.
  2804. # The settings here are intentionally empty and will fall back to
  2805. # `symbolicator.options` for backwards compatibility.
  2806. SYMBOLICATOR_POOL_URLS: dict[str, str] = {
  2807. # "js": "...",
  2808. # "default": "...",
  2809. # "lpq": "...",
  2810. # "lpq_js": "...",
  2811. }
  2812. SENTRY_REQUEST_METRIC_ALLOWED_PATHS = (
  2813. "sentry.web.api",
  2814. "sentry.web.frontend",
  2815. "sentry.api.endpoints",
  2816. "sentry.data_export.endpoints",
  2817. "sentry.discover.endpoints",
  2818. "sentry.incidents.endpoints",
  2819. "sentry.replays.endpoints",
  2820. "sentry.monitors.endpoints",
  2821. )
  2822. SENTRY_MAIL_ADAPTER_BACKEND = "sentry.mail.adapter.MailAdapter"
  2823. # Project ID used by synthetic monitoring
  2824. # Synthetic monitoring recurringly send events, prepared with specific
  2825. # attributes, which can be identified through the whole processing pipeline and
  2826. # observed mainly for producing stable metrics.
  2827. SENTRY_SYNTHETIC_MONITORING_PROJECT_ID = None
  2828. # Similarity cluster to use
  2829. # Similarity-v1: uses hardcoded set of event properties for diffing
  2830. SENTRY_SIMILARITY_INDEX_REDIS_CLUSTER = "default"
  2831. # Similarity-v2: uses grouping components for diffing (None = fallback to setting for v1)
  2832. SENTRY_SIMILARITY2_INDEX_REDIS_CLUSTER = None
  2833. # The grouping strategy to use for driving similarity-v2. You can add multiple
  2834. # strategies here to index them all. This is useful for transitioning a
  2835. # similarity dataset to newer grouping configurations.
  2836. #
  2837. # The dictionary value represents the redis prefix to use.
  2838. #
  2839. # Check out `test_similarity_config_migration` to understand the procedure and risks.
  2840. SENTRY_SIMILARITY_GROUPING_CONFIGURATIONS_TO_INDEX = {
  2841. "similarity:2020-07-23": "a",
  2842. }
  2843. # If this is turned on, then sentry will perform automatic grouping updates.
  2844. SENTRY_GROUPING_AUTO_UPDATE_ENABLED = False
  2845. # How long is the migration phase for grouping updates?
  2846. SENTRY_GROUPING_UPDATE_MIGRATION_PHASE = 30 * 24 * 3600 # 30 days
  2847. SENTRY_USE_UWSGI = True
  2848. # When copying attachments for to-be-reprocessed events into processing store,
  2849. # how large is an individual file chunk? Each chunk is stored as Redis key.
  2850. SENTRY_REPROCESSING_ATTACHMENT_CHUNK_SIZE = 2**20
  2851. # Which cluster is used to store auxiliary data for reprocessing. Note that
  2852. # this cluster is not used to store attachments etc, that still happens on
  2853. # rc-processing. This is just for buffering up event IDs and storing a counter
  2854. # for synchronization/progress report.
  2855. SENTRY_REPROCESSING_SYNC_REDIS_CLUSTER = "default"
  2856. # How long tombstones from reprocessing will live.
  2857. SENTRY_REPROCESSING_TOMBSTONES_TTL = 24 * 3600
  2858. # How long reprocessing counters are kept in Redis before they expire.
  2859. SENTRY_REPROCESSING_SYNC_TTL = 30 * 24 * 3600 # 30 days
  2860. # How many events to query for at once while paginating through an entire
  2861. # issue. Note that this needs to be kept in sync with the time-limits on
  2862. # `sentry.tasks.reprocessing2.reprocess_group`. That task is responsible for
  2863. # copying attachments from filestore into redis and can easily take a couple of
  2864. # seconds per event. Better play it safe!
  2865. SENTRY_REPROCESSING_PAGE_SIZE = 10
  2866. # How many event IDs to buffer up in Redis before sending them to Snuba. This
  2867. # is about "remaining events" exclusively.
  2868. SENTRY_REPROCESSING_REMAINING_EVENTS_BUF_SIZE = 500
  2869. # Which backend to use for RealtimeMetricsStore.
  2870. #
  2871. # Currently, only redis is supported.
  2872. SENTRY_REALTIME_METRICS_BACKEND = (
  2873. "sentry.processing.realtime_metrics.dummy.DummyRealtimeMetricsStore"
  2874. )
  2875. SENTRY_REALTIME_METRICS_OPTIONS = {
  2876. # The redis cluster used for the realtime store redis backend.
  2877. "cluster": "default",
  2878. # Length of the sliding symbolicate_event budgeting window, in seconds.
  2879. #
  2880. # The LPQ selection is computed based on the `SENTRY_LPQ_OPTIONS["project_budget"]`
  2881. # defined below.
  2882. "budget_time_window": 2 * 60,
  2883. # The bucket size of the project budget metric.
  2884. #
  2885. # The size (in seconds) of the buckets that events are sorted into.
  2886. "budget_bucket_size": 10,
  2887. # Number of seconds to wait after a project is made eligible or ineligible for the LPQ
  2888. # before its eligibility can be changed again.
  2889. #
  2890. # This backoff is only applied to automatic changes to project eligibility, and has zero effect
  2891. # on any manually-triggered changes to a project's presence in the LPQ.
  2892. "backoff_timer": 5 * 60,
  2893. }
  2894. # Whether badly behaving projects will be automatically
  2895. # sent to the low priority queue
  2896. SENTRY_ENABLE_AUTO_LOW_PRIORITY_QUEUE = False
  2897. # Tunable knobs for automatic LPQ eligibility.
  2898. #
  2899. # LPQ eligibility is based on the average spent budget in a sliding time window
  2900. # defined in `SENTRY_REALTIME_METRICS_OPTIONS["budget_time_window"]` above.
  2901. #
  2902. # The `project_budget` option is defined as the average per-second
  2903. # "symbolication time budget" a project can spend.
  2904. # See `RealtimeMetricsStore.record_project_duration` for an explanation of how
  2905. # this works.
  2906. # The "regular interval" at which symbolication time is submitted is defined by
  2907. # a combination of `SYMBOLICATOR_POLL_TIMEOUT` and `SYMBOLICATOR_MAX_RETRY_AFTER`.
  2908. #
  2909. # This value is already adjusted according to the
  2910. # `symbolicate-event.low-priority.metrics.submission-rate` option.
  2911. SENTRY_LPQ_OPTIONS = {
  2912. # This is the per-project budget in per-second "symbolication time budget".
  2913. #
  2914. # This has been arbitrarily chosen as `5.0` for now, which means an average of:
  2915. # - 1x 5-second event per second, or
  2916. # - 5x 1-second events per second, or
  2917. # - 10x 0.5-second events per second
  2918. #
  2919. # Cost increases quadratically with symbolication time.
  2920. "project_budget": 5.0
  2921. }
  2922. # XXX(meredith): Temporary metrics indexer
  2923. SENTRY_METRICS_INDEXER_REDIS_CLUSTER = "default"
  2924. # Timeout for the project counter statement execution.
  2925. # In case of contention on the project counter, prevent workers saturation with
  2926. # save_event tasks from single project.
  2927. # Value is in milliseconds. Set to `None` to disable.
  2928. SENTRY_PROJECT_COUNTER_STATEMENT_TIMEOUT = 1000
  2929. # Implemented in getsentry to run additional devserver workers.
  2930. SENTRY_EXTRA_WORKERS = None
  2931. SAMPLED_DEFAULT_RATE = 1.0
  2932. # A set of extra URLs to sample
  2933. ADDITIONAL_SAMPLED_URLS: dict[str, float] = {}
  2934. # A set of extra tasks to sample
  2935. ADDITIONAL_SAMPLED_TASKS: dict[str, float] = {}
  2936. # This controls whether Sentry is run in a demo mode.
  2937. # Enabling this will allow users to create accounts without an email or password.
  2938. DEMO_MODE = False
  2939. # all demo orgs are owned by the user with this email
  2940. DEMO_ORG_OWNER_EMAIL = None
  2941. # adds an extra JS to HTML template
  2942. INJECTED_SCRIPT_ASSETS: list[str] = []
  2943. PG_VERSION: str = os.getenv("PG_VERSION") or "14"
  2944. # Zero Downtime Migrations settings as defined at
  2945. # https://github.com/tbicr/django-pg-zero-downtime-migrations#settings
  2946. ZERO_DOWNTIME_MIGRATIONS_RAISE_FOR_UNSAFE = True
  2947. ZERO_DOWNTIME_MIGRATIONS_LOCK_TIMEOUT = None
  2948. ZERO_DOWNTIME_MIGRATIONS_STATEMENT_TIMEOUT = None
  2949. if int(PG_VERSION.split(".", maxsplit=1)[0]) < 12:
  2950. # In v0.6 of django-pg-zero-downtime-migrations this settings is deprecated for PostreSQLv12+
  2951. # https://github.com/tbicr/django-pg-zero-downtime-migrations/blob/7b3f5c045b40e656772859af4206acf3f11c0951/CHANGES.md#06
  2952. # Note: The docs have this backwards. We set this to False here so that we always add check
  2953. # constraints instead of setting the column to not null.
  2954. ZERO_DOWNTIME_MIGRATIONS_USE_NOT_NULL = False
  2955. ANOMALY_DETECTION_URL = "127.0.0.1:9091"
  2956. ANOMALY_DETECTION_TIMEOUT = 30
  2957. # This is the URL to the profiling service
  2958. SENTRY_VROOM = os.getenv("VROOM", "http://127.0.0.1:8085")
  2959. SENTRY_REPLAYS_SERVICE_URL = "http://localhost:8090"
  2960. SENTRY_ISSUE_ALERT_HISTORY = "sentry.rules.history.backends.postgres.PostgresRuleHistoryBackend"
  2961. SENTRY_ISSUE_ALERT_HISTORY_OPTIONS: dict[str, Any] = {}
  2962. # This is useful for testing SSO expiry flows
  2963. SENTRY_SSO_EXPIRY_SECONDS = os.environ.get("SENTRY_SSO_EXPIRY_SECONDS", None)
  2964. # Set to an iterable of strings matching services so only logs from those services show up
  2965. # eg. DEVSERVER_LOGS_ALLOWLIST = {"server", "webpack", "worker"}
  2966. DEVSERVER_LOGS_ALLOWLIST = None
  2967. LOG_API_ACCESS = not IS_DEV or os.environ.get("SENTRY_LOG_API_ACCESS")
  2968. VALIDATE_SUPERUSER_ACCESS_CATEGORY_AND_REASON = True
  2969. DISABLE_SU_FORM_U2F_CHECK_FOR_LOCAL = False
  2970. # determines if we enable analytics or not
  2971. ENABLE_ANALYTICS = False
  2972. MAX_ISSUE_ALERTS_PER_PROJECT = 100
  2973. MAX_QUERY_SUBSCRIPTIONS_PER_ORG = 1000
  2974. MAX_REDIS_SNOWFLAKE_RETRY_COUNTER = 5
  2975. SNOWFLAKE_VERSION_ID = 1
  2976. SENTRY_SNOWFLAKE_EPOCH_START = datetime(2022, 8, 8, 0, 0).timestamp()
  2977. SENTRY_USE_SNOWFLAKE = False
  2978. SENTRY_DEFAULT_LOCKS_BACKEND_OPTIONS = {
  2979. "path": "sentry.utils.locking.backends.redis.RedisLockBackend",
  2980. "options": {"cluster": "default"},
  2981. }
  2982. SENTRY_POST_PROCESS_LOCKS_BACKEND_OPTIONS = {
  2983. "path": "sentry.utils.locking.backends.redis.RedisLockBackend",
  2984. "options": {"cluster": "default"},
  2985. }
  2986. # maximum number of projects allowed to query snuba with for the organization_vitals_overview endpoint
  2987. ORGANIZATION_VITALS_OVERVIEW_PROJECT_LIMIT = 300
  2988. # Default string indexer cache options
  2989. SENTRY_STRING_INDEXER_CACHE_OPTIONS = {
  2990. "cache_name": "default",
  2991. }
  2992. SENTRY_POSTGRES_INDEXER_RETRY_COUNT = 2
  2993. SENTRY_FUNCTIONS_PROJECT_NAME = None
  2994. SENTRY_FUNCTIONS_REGION = "us-central1"
  2995. # Settings related to SiloMode
  2996. SILO_MODE = os.environ.get("SENTRY_SILO_MODE", None)
  2997. FAIL_ON_UNAVAILABLE_API_CALL = False
  2998. DEV_HYBRID_CLOUD_RPC_SENDER = os.environ.get("SENTRY_DEV_HYBRID_CLOUD_RPC_SENDER", None)
  2999. DISALLOWED_CUSTOMER_DOMAINS: list[str] = []
  3000. SENTRY_ISSUE_PLATFORM_RATE_LIMITER_OPTIONS: dict[str, str] = {}
  3001. SENTRY_ISSUE_PLATFORM_FUTURES_MAX_LIMIT = 10000
  3002. SENTRY_REGION = os.environ.get("SENTRY_REGION", None)
  3003. SENTRY_REGION_CONFIG: Union[Iterable[Region], str] = ()
  3004. SENTRY_MONOLITH_REGION: str = "--monolith--"
  3005. # Enable siloed development environment.
  3006. USE_SILOS = os.environ.get("SENTRY_USE_SILOS", None)
  3007. if USE_SILOS:
  3008. # Add connections for the region & control silo databases.
  3009. DATABASES["control"] = DATABASES["default"].copy()
  3010. DATABASES["control"]["NAME"] = "control"
  3011. DATABASES["region"] = DATABASES["default"].copy()
  3012. DATABASES["region"]["NAME"] = "region"
  3013. # Addresses are hardcoded based on the defaults
  3014. # we use in commands/devserver.
  3015. SENTRY_REGION_CONFIG = json.dumps(
  3016. [
  3017. {
  3018. "name": "us",
  3019. "snowflake_id": 1,
  3020. "category": "MULTI_TENANT",
  3021. "address": "http://localhost:8000",
  3022. "api_token": "dev-region-silo-token",
  3023. }
  3024. ]
  3025. )
  3026. control_port = os.environ.get("SENTRY_CONTROL_SILO_PORT", "8010")
  3027. DEV_HYBRID_CLOUD_RPC_SENDER = json.dumps(
  3028. {
  3029. "is_allowed": True,
  3030. "control_silo_api_token": "dev-control-silo-token",
  3031. "control_silo_address": f"http://127.0.0.1:{control_port}",
  3032. }
  3033. )
  3034. DATABASE_ROUTERS = ("sentry.db.router.SiloRouter",)
  3035. # How long we should wait for a gateway proxy request to return before giving up
  3036. GATEWAY_PROXY_TIMEOUT = None
  3037. SENTRY_SLICING_LOGICAL_PARTITION_COUNT = 256
  3038. # This maps a Sliceable for slicing by name and (lower logical partition, upper physical partition)
  3039. # to a given slice. A slice is a set of physical resources in Sentry and Snuba.
  3040. #
  3041. # For each Sliceable, the range [0, SENTRY_SLICING_LOGICAL_PARTITION_COUNT) must be mapped
  3042. # to a slice ID
  3043. SENTRY_SLICING_CONFIG: Mapping[str, Mapping[Tuple[int, int], int]] = {}
  3044. # Show banners on the login page that are defined in layout.html
  3045. SHOW_LOGIN_BANNER = False
  3046. # Mapping of (logical topic names, slice id) to physical topic names
  3047. # and kafka broker names. The kafka broker names are used to construct
  3048. # the broker config from KAFKA_CLUSTERS. This is used for slicing only.
  3049. # Example:
  3050. # SLICED_KAFKA_TOPICS = {
  3051. # ("KAFKA_SNUBA_GENERIC_METRICS", 0): {
  3052. # "topic": "generic_metrics_0",
  3053. # "cluster": "cluster_1",
  3054. # },
  3055. # ("KAFKA_SNUBA_GENERIC_METRICS", 1): {
  3056. # "topic": "generic_metrics_1",
  3057. # "cluster": "cluster_2",
  3058. # }
  3059. # And then in KAFKA_CLUSTERS:
  3060. # KAFKA_CLUSTERS = {
  3061. # "cluster_1": {
  3062. # "bootstrap.servers": "kafka1:9092",
  3063. # },
  3064. # "cluster_2": {
  3065. # "bootstrap.servers": "kafka2:9092",
  3066. # },
  3067. # }
  3068. SLICED_KAFKA_TOPICS: Mapping[Tuple[str, int], Mapping[str, Any]] = {}
  3069. # Used by silo tests -- when requests pass through decorated endpoints, switch the server silo mode to match that
  3070. # decorator.
  3071. SINGLE_SERVER_SILO_MODE = False
  3072. # Set the URL for signup page that we redirect to for the setup wizard if signup=1 is in the query params
  3073. SENTRY_SIGNUP_URL = None
  3074. SENTRY_ORGANIZATION_ONBOARDING_TASK = "sentry.onboarding_tasks.backends.organization_onboarding_task.OrganizationOnboardingTaskBackend"
  3075. # Temporary allowlist for specially configured organizations to use the direct-storage
  3076. # driver.
  3077. SENTRY_REPLAYS_STORAGE_ALLOWLIST: list[int] = []
  3078. SENTRY_REPLAYS_DOM_CLICK_SEARCH_ALLOWLIST: list[int] = []
  3079. SENTRY_FEATURE_ADOPTION_CACHE_OPTIONS = {
  3080. "path": "sentry.models.featureadoption.FeatureAdoptionRedisBackend",
  3081. "options": {"cluster": "default"},
  3082. }
  3083. # Monitor limits to prevent abuse
  3084. MAX_MONITORS_PER_ORG = 10000
  3085. MAX_ENVIRONMENTS_PER_MONITOR = 1000
  3086. # Raise schema validation errors and make the indexer crash (only useful in
  3087. # tests)
  3088. SENTRY_METRICS_INDEXER_RAISE_VALIDATION_ERRORS = False
  3089. SENTRY_FILE_COPY_ROLLOUT_RATE = 0.3
  3090. # The Redis cluster to use for monitoring the health of
  3091. # Celery queues.
  3092. SENTRY_QUEUE_MONITORING_REDIS_CLUSTER = "default"