server.py 160 KB

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