Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rust at Sentry
Search
Armin Ronacher
July 07, 2017
Programming
4
1.1k
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
Rust at Sentry
mitsuhiko
0
200
Overcoming Variable Payloads to Optimize for Performance
mitsuhiko
0
98
Rust API Design Learnings
mitsuhiko
0
380
The Snowball Effect of Open Source
mitsuhiko
0
280
Mobile Games are Living Organisms, Too
mitsuhiko
0
180
We gave a Mouse an NDK
mitsuhiko
0
620
Debug is the new Release
mitsuhiko
1
510
A Future Python
mitsuhiko
0
2.6k
Failing in Rust
mitsuhiko
5
850
Other Decks in Programming
See All in Programming
Vue 3.4
kazupon
13
3.7k
ここ1~2年くらいで 使えるようになった(主要ブラウザーの最新版 がすべて対応した ) ウェブの新機能について ランダムに喋る!
myzkyy
7
5.9k
PHP8の機能を使って堅牢にコードを書く
fendo181
6
2k
Flutterアプリを GitHub Actions & Xcode Cloud で社内配布する / Distribute Flutter apps internally
takasfz
0
130
Faster, greener, and happier- why Quarkus should be your next tech stack
hollycummins
0
130
sbt-assemblyにハマってDB接続できず時間が溶けた話
wakye5815
1
660
TokyoR#111_ANOVA
kilometer
1
710
孤独のCTOグルメという やや奇抜な企画をやった目的と効果
shoheimitani
3
830
Не учите алгоритмы
hellsquirrel
1
700
Sementic Kernelのネイティブ関数について
tomokusaba
0
790
PHP 8.3で追加されたjson_validate()を徹底的に深掘りしてみよう
mashirou1234
0
630
LPIXEL×CADDi_kaerururu
kaerururu
3
270
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
57
7.1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
272
12k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
How GitHub Uses GitHub to Build GitHub
holman
467
290k
Stop Working from a Prison Cell
hatefulcrawdad
265
19k
Making the Leap to Tech Lead
cromwellryan
122
8.4k
A Tale of Four Properties
chriscoyier
150
22k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
Learning to Love Humans: Emotional Interface Design
aarron
266
39k
Principles of Awesome APIs and How to Build Them.
keavy
119
16k
Robots, Beer and Maslow
schacon
PRO
154
7.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
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?