Skip to content

Commit

Permalink
deploy: 1899b76
Browse files Browse the repository at this point in the history
  • Loading branch information
jjbayer committed Jul 4, 2023
1 parent 03d0ad9 commit e93e8de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 142 deletions.
2 changes: 1 addition & 1 deletion relay/setup/static.META.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `META` static in crate `relay`."><title>META in relay::setup - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ba5701c5741a7b69.css" id="mainThemeStyle"><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.70.0 (90c541806 2023-05-31)" data-search-js="search-e077946657036a58.js" data-settings-js="settings-298e1ea74db45b39.js" data-settings-css="settings-7bfb4c59cc6bc502.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ></div><script src="../../static.files/storage-62ce34ea385b278a.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-f61008743c98d196.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png"></head><body class="rustdoc static"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="logo-container" href="../../relay/index.html"><img src="https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../relay/index.html"><img src="https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png" alt="logo"></a><div class="sidebar-elems"><h2><a href="index.html">In relay::setup</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Static <a href="../index.html">relay</a>::<wbr><a href="index.html">setup</a>::<wbr><a class="static" href="#">META</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/relay/setup.rs.html#18">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>static META: <a class="struct" href="https://docs.rs/tracing-core/0.1.22/tracing_core/metadata/struct.Metadata.html" title="struct tracing_core::metadata::Metadata">Metadata</a>&lt;'static&gt;</code></pre></section></div></main></body></html>ml>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `META` static in crate `relay`."><title>META in relay::setup - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ba5701c5741a7b69.css" id="mainThemeStyle"><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.70.0 (90c541806 2023-05-31)" data-search-js="search-e077946657036a58.js" data-settings-js="settings-298e1ea74db45b39.js" data-settings-css="settings-7bfb4c59cc6bc502.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ></div><script src="../../static.files/storage-62ce34ea385b278a.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-f61008743c98d196.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png"></head><body class="rustdoc static"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="logo-container" href="../../relay/index.html"><img src="https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../relay/index.html"><img src="https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png" alt="logo"></a><div class="sidebar-elems"><h2><a href="index.html">In relay::setup</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Static <a href="../index.html">relay</a>::<wbr><a href="index.html">setup</a>::<wbr><a class="static" href="#">META</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/relay/setup.rs.html#18">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>static META: <a class="struct" href="https://docs.rs/tracing-core/0.1.22/tracing_core/metadata/struct.Metadata.html" title="struct tracing_core::metadata::Metadata">Metadata</a>&lt;'static&gt;</code></pre></section></div></main></body></html>
120 changes: 5 additions & 115 deletions src/relay_server/actors/project_cache.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -1107,65 +1107,9 @@
<a href="#1107" id="1107">1107</a>
<a href="#1108" id="1108">1108</a>
<a href="#1109" id="1109">1109</a>
<a href="#1110" id="1110">1110</a>
<a href="#1111" id="1111">1111</a>
<a href="#1112" id="1112">1112</a>
<a href="#1113" id="1113">1113</a>
<a href="#1114" id="1114">1114</a>
<a href="#1115" id="1115">1115</a>
<a href="#1116" id="1116">1116</a>
<a href="#1117" id="1117">1117</a>
<a href="#1118" id="1118">1118</a>
<a href="#1119" id="1119">1119</a>
<a href="#1120" id="1120">1120</a>
<a href="#1121" id="1121">1121</a>
<a href="#1122" id="1122">1122</a>
<a href="#1123" id="1123">1123</a>
<a href="#1124" id="1124">1124</a>
<a href="#1125" id="1125">1125</a>
<a href="#1126" id="1126">1126</a>
<a href="#1127" id="1127">1127</a>
<a href="#1128" id="1128">1128</a>
<a href="#1129" id="1129">1129</a>
<a href="#1130" id="1130">1130</a>
<a href="#1131" id="1131">1131</a>
<a href="#1132" id="1132">1132</a>
<a href="#1133" id="1133">1133</a>
<a href="#1134" id="1134">1134</a>
<a href="#1135" id="1135">1135</a>
<a href="#1136" id="1136">1136</a>
<a href="#1137" id="1137">1137</a>
<a href="#1138" id="1138">1138</a>
<a href="#1139" id="1139">1139</a>
<a href="#1140" id="1140">1140</a>
<a href="#1141" id="1141">1141</a>
<a href="#1142" id="1142">1142</a>
<a href="#1143" id="1143">1143</a>
<a href="#1144" id="1144">1144</a>
<a href="#1145" id="1145">1145</a>
<a href="#1146" id="1146">1146</a>
<a href="#1147" id="1147">1147</a>
<a href="#1148" id="1148">1148</a>
<a href="#1149" id="1149">1149</a>
<a href="#1150" id="1150">1150</a>
<a href="#1151" id="1151">1151</a>
<a href="#1152" id="1152">1152</a>
<a href="#1153" id="1153">1153</a>
<a href="#1154" id="1154">1154</a>
<a href="#1155" id="1155">1155</a>
<a href="#1156" id="1156">1156</a>
<a href="#1157" id="1157">1157</a>
<a href="#1158" id="1158">1158</a>
<a href="#1159" id="1159">1159</a>
<a href="#1160" id="1160">1160</a>
<a href="#1161" id="1161">1161</a>
<a href="#1162" id="1162">1162</a>
<a href="#1163" id="1163">1163</a>
<a href="#1164" id="1164">1164</a>
</pre></div><pre class="rust"><code><span class="kw">use </span>std::collections::{BTreeMap, BTreeSet, HashSet};
</pre></div><pre class="rust"><code><span class="kw">use </span>std::collections::{BTreeMap, BTreeSet};
<span class="kw">use </span>std::error::Error;
<span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::time::Duration;

<span class="kw">use </span>relay_common::ProjectKey;
<span class="kw">use </span>relay_config::{Config, RelayMode};
Expand Down Expand Up @@ -1611,34 +1555,6 @@
}
}

<span class="doccomment">/// Tracks how many projects are accessed every second.
</span><span class="attr">#[derive(Debug)]
</span><span class="kw">struct </span>AccessTracker {
keys: HashSet&lt;ProjectKey&gt;,
last_reset: Instant,
}

<span class="kw">impl </span>AccessTracker {
<span class="kw">fn </span>new() -&gt; <span class="self">Self </span>{
<span class="self">Self </span>{
keys: Default::default(),
last_reset: Instant::now(),
}
}

<span class="kw">fn </span>track(<span class="kw-2">&amp;mut </span><span class="self">self</span>, project_key: ProjectKey) {
<span class="kw">if </span><span class="self">self</span>.last_reset.elapsed() &gt; Duration::from_secs(<span class="number">1</span>) {
<span class="kw">let </span>count = <span class="self">self</span>.keys.len();
<span class="comment">// When we get &lt; 1 access per second, this will log results from the past.
// Does not matter for our use case though.
</span><span class="macro">metric!</span>(gauge(RelayGauges::ProjectCacheKeysAccessed) = count <span class="kw">as </span>u64);
<span class="self">self</span>.keys.clear();
<span class="self">self</span>.last_reset = Instant::now();
}
<span class="self">self</span>.keys.insert(project_key);
}
}

<span class="doccomment">/// Main broker of the [`ProjectCacheService`].
///
/// This handles incoming public messages, merges resolved project states, and maintains the actual
Expand All @@ -1649,7 +1565,6 @@
services: Services,
<span class="comment">// Need hashbrown because drain_filter is not stable in std yet.
</span>projects: hashbrown::HashMap&lt;ProjectKey, Project&gt;,
access: AccessTracker,
garbage_disposal: GarbageDisposal&lt;Project&gt;,
source: ProjectSource,
state_tx: mpsc::UnboundedSender&lt;UpdateProjectState&gt;,
Expand Down Expand Up @@ -1722,18 +1637,9 @@
<span class="kw">let </span>eviction_start = Instant::now();
<span class="kw">let </span>delta = <span class="number">2 </span>* <span class="self">self</span>.config.project_cache_expiry() + <span class="self">self</span>.config.project_grace_period();

<span class="comment">// Count org and project IDs for stats.
</span><span class="kw">let </span>project_keys = <span class="self">self</span>.projects.len();
<span class="kw">let </span><span class="kw-2">mut </span>project_ids = HashSet::new();
<span class="kw">let </span><span class="kw-2">mut </span>org_ids = HashSet::new();

<span class="kw">let </span>expired = <span class="self">self</span>.projects.drain_filter(|<span class="kw">_</span>, entry| {
<span class="kw">if let </span><span class="prelude-val">Some</span>(scoping) = entry.scoping() {
project_ids.insert(scoping.project_id);
org_ids.insert(scoping.organization_id);
}
entry.last_updated_at() + delta &lt;= eviction_start
});
<span class="kw">let </span>expired = <span class="self">self
</span>.projects
.drain_filter(|<span class="kw">_</span>, entry| entry.last_updated_at() + delta &lt;= eviction_start);

<span class="comment">// Defer dropping the projects to a dedicated thread:
</span><span class="kw">let </span><span class="kw-2">mut </span>count = <span class="number">0</span>;
Expand All @@ -1747,15 +1653,6 @@
}
<span class="macro">metric!</span>(counter(RelayCounters::EvictingStaleProjectCaches) += count);

<span class="macro">metric!</span>(
gauge(RelayGauges::ProjectCacheKeysPerProject) =
project_keys <span class="kw">as </span>f64 / project_ids.len() <span class="kw">as </span>f64
);
<span class="macro">metric!</span>(
gauge(RelayGauges::ProjectCacheProjectsPerOrg) =
project_ids.len() <span class="kw">as </span>f64 / org_ids.len() <span class="kw">as </span>f64
);

<span class="comment">// Log garbage queue size:
</span><span class="kw">let </span>queue_size = <span class="self">self</span>.garbage_disposal.queue_size() <span class="kw">as </span>f64;
<span class="macro">metric!</span>(gauge(RelayGauges::ProjectCacheGarbageQueueSize) = queue_size);
Expand All @@ -1765,7 +1662,6 @@

<span class="kw">fn </span>get_or_create_project(<span class="kw-2">&amp;mut </span><span class="self">self</span>, project_key: ProjectKey) -&gt; <span class="kw-2">&amp;mut </span>Project {
<span class="macro">metric!</span>(histogram(RelayHistograms::ProjectStateCacheSize) = <span class="self">self</span>.projects.len() <span class="kw">as </span>u64);
<span class="self">self</span>.access.track(project_key);

<span class="kw">let </span>config = <span class="self">self</span>.config.clone();

Expand Down Expand Up @@ -1879,7 +1775,6 @@
</span><span class="kw">fn </span>handle_processing(<span class="kw-2">&amp;mut </span><span class="self">self</span>, managed_envelope: ManagedEnvelope) {
<span class="kw">let </span>project_key = managed_envelope.envelope().meta().public_key();

<span class="self">self</span>.access.track(project_key);
<span class="kw">let </span><span class="prelude-val">Some</span>(project) = <span class="self">self</span>.projects.get_mut(<span class="kw-2">&amp;</span>project_key) <span class="kw">else </span>{
<span class="macro">relay_log::error!</span>(
tags.project_key = %project_key,
Expand All @@ -1904,10 +1799,7 @@
}) = project.check_envelope(managed_envelope, <span class="self">self</span>.services.outcome_aggregator.clone())
{
<span class="kw">let </span>sampling_state = utils::get_sampling_key(managed_envelope.envelope())
.and_then(|key| {
<span class="self">self</span>.access.track(project_key);
<span class="self">self</span>.projects.get(<span class="kw-2">&amp;</span>key)
})
.and_then(|key| <span class="self">self</span>.projects.get(<span class="kw-2">&amp;</span>key))
.and_then(|p| p.valid_state());

<span class="kw">let </span><span class="kw-2">mut </span>process = ProcessEnvelope {
Expand Down Expand Up @@ -2103,7 +1995,6 @@
</span><span class="kw">let </span><span class="kw-2">mut </span>broker = ProjectCacheBroker {
config: config.clone(),
projects: hashbrown::HashMap::new(),
access: AccessTracker::new(),
garbage_disposal: GarbageDisposal::new(),
source: ProjectSource::start(config, services.upstream_relay.clone(), redis),
services,
Expand Down Expand Up @@ -2225,7 +2116,6 @@
ProjectCacheBroker {
config: config.clone(),
projects: hashbrown::HashMap::new(),
access: AccessTracker::new(),
garbage_disposal: GarbageDisposal::new(),
source: ProjectSource::start(config, services.upstream_relay.clone(), <span class="prelude-val">None</span>),
services,
Expand Down
Loading

0 comments on commit e93e8de

Please sign in to comment.