Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Rust at Sentry
Armin Ronacher
July 07, 2017
Programming
4
880
Rust at Sentry
An introduction to how we use Rust at Sentry.
Armin Ronacher
July 07, 2017
Tweet
Share
More Decks by Armin Ronacher
See All by Armin Ronacher
The Snowball Effect of Open Source
mitsuhiko
0
7
Mobile Games are Living Organisms, Too
mitsuhiko
0
8
We gave a Mouse an NDK
mitsuhiko
0
450
Debug is the new Release
mitsuhiko
1
410
A Future Python
mitsuhiko
0
2.2k
Failing in Rust
mitsuhiko
5
760
A Python for Future Generations
mitsuhiko
19
8.5k
My Python is Rusting
mitsuhiko
2
1.4k
Pragmantic SaaS Architecture
mitsuhiko
4
640
Other Decks in Programming
See All in Programming
iOS 16からのロック画面Widget争奪戦に備える
tsuzuki817
0
210
Jetpack Compose best practices 動画紹介 @GoogleI/O LT会
takakitojo
0
300
Independently together: better developer experience & App performance
bcinarli
0
170
競プロのすすめ
uya116
0
660
言語処理ライブラリ開発における失敗談 / NLPHacks
taishii
1
440
GitHub Actions を導入した経緯
tamago3keran
1
430
エンジニアによる事業指標計測のススメ
doyaaaaaken
1
180
IE Graduation Certificate
jxck
6
4.8k
1時間半で克服するJavaScriptの非同期処理/async_javascript_kokufuku
marchin1989
2
610
trocco® の品質を守る、とても普通な取り組み
kekekenta
0
350
BASE BANKチームの技術選定と歴史 / how to decide technology selection for startup
budougumi0617
0
240
Mobile Product Engineering
championswimmer
0
300
Featured
See All Featured
Art Directing for the Web. Five minutes with CSS Template Areas
malarkey
196
9.4k
Principles of Awesome APIs and How to Build Them.
keavy
113
15k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
236
1M
Web development in the modern age
philhawksworth
197
9.3k
Writing Fast Ruby
sferik
612
57k
Building Better People: How to give real-time feedback that sticks.
wjessup
344
17k
4 Signs Your Business is Dying
shpigford
169
20k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
655
120k
How to train your dragon (web standard)
notwaldorf
58
3.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
351
21k
Fantastic passwords and where to find them - at NoRuKo
philnash
27
1.5k
How STYLIGHT went responsive
nonsquared
85
3.9k
Transcript
Rust at Sentry Armin @mitsuhiko Ronacher
Hi, I'm Armin ... and I do Open Source, lots
of Python and SaaS Flask Sentry …
… and here is where you can find me twitter.com/@mitsuhiko
github.com/mitsuhiko lucumr.pocoo.org/
800°C 36° 2' 0.4662" N 118° 15' 38.7792" W 795°C
789°C 797°C 793°C 805°C 782°C we show you your crashes
None
None
a bit about us chapter 0
Open Source Project “sentry”
Cloud Hosted “sentry.io”
relatively flexible stack postgres, mysql, cassandra, riak, …
our general tech stack chapter 1
Lots of Python
Simple Stack Python RabbitMQ Postgres Riak Redis
Conservative Approach to Adding New Systems
prefer Internal Modularity over building More Services
how does rust fit?
why is there Rust? chapter 2
a bit of a hobby of mine
turned into sentry-cli (command line client to manage organizations /
build integration)
later reused components for Python modules
now part of our tech stack
how we started chapter 3
why we use Rust for sentry-cli
$ otool -L which sentry-cli /usr/local/bin/sentry-cli: /System/Library/Frameworks/Security.framework/Versions/A/Security /usr/lib/libiconv.2.dylib /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /usr/lib/libcurl.4.dylib
/usr/lib/libz.1.dylib /usr/lib/libSystem.B.dylib
$ curl -sL https://sentry.io/get-cli/ | bash $ npm install sentry-cli-binary
that and crates.io
rejected alternatives go JavaScript (bundled node) C / C++ Python
/ Ruby
things that work well serialization / deserialization error handling console
UX file size
from client to server chapter 4
None
sourcemap parsing
reused sentry-cli code for server
+20 sec -> < 500ms processing time
debug symbols
proguard
marrying python and rust chapter 5
github.com/mitsuhiko/snaek
from setuptools import setup, find_packages setup( name='example', version='0.0.1', packages=find_packages(), include_package_data=True,
zip_safe=False, platforms='any', install_requires=[ 'snaek', ], snaek_rust_modules=[ ('example._native', 'rust/'), ] )
build rust library expose rust -> cabi snaek to consume
#[repr(C)] pub struct Point { pub x: f32, pub y:
f32, } #[no_mangle] pub unsafe extern "C" fn example_get_origin() -> Point { Point { x: 0.0, y: 0.0 } }
from example._native import lib def get_origin(): point = lib.example_get_origin() return
(point.x, point.y)
things in rust to love chapter 6
#[derive(Serialize, Deserialize, Debug, Default)] pub struct Deploy { #[serde(rename="environment")] pub
env: String, pub name: Option<String>, pub url: Option<String>, #[serde(rename="dateStarted")] pub started: Option<DateTime<UTC>>, #[serde(rename="dateFinished")] pub finished: Option<DateTime<UTC>>, }
/// Lists all deploys for a release pub fn list_deploys(&self,
org: &str, version: &str) -> ApiResult<Vec<Deploy>> { self.get(&format!("/organizations/{}/releases/{}/deploys/", PathArg(org), PathArg(version)))? .convert() }
super flexible (de)serialization layer
crates we use / built chapter 7
if_chain lazy_static error-chain always useful
serde serde_derive serde_json serde_yaml for serialization
console indicatif dialoguer for pretty console UI ours :)
rust-curl openssl-probe HTTP stuff
elementtree XML ours :)
things we don't like chapter 8
compile times :'(
things rust needs chapter 9
“what not to do” guide
incremental compilation
higher level C ABI tools
Questions?