instrumentation talk

97
Rafael Martins Software Engineer @snit_ram http://thesn.it

Upload: rafael-martins

Post on 29-Nov-2014

1.361 views

Category:

Engineering


0 download

DESCRIPTION

Slides from my presentation about Instrumentation in React components at Yahoo!

TRANSCRIPT

Page 1: Instrumentation talk

Rafael MartinsSoftware Engineer

@snit_ramhttp://thesn.it

Page 2: Instrumentation talk

Software Engineer

@snit_ramhttp://thesn.it

Snit

Page 3: Instrumentation talk

Instrumentation and React

Page 4: Instrumentation talk

Learn

Build

Measure

Page 5: Instrumentation talk

Learn

Build

Measure

Page 6: Instrumentation talk
Page 7: Instrumentation talk
Page 8: Instrumentation talk

Click{ link: "Mail", source: "toolbar"}

Page 9: Instrumentation talk
Page 10: Instrumentation talk
Page 11: Instrumentation talk

Click{ link: "Monitoring your credit...", source: "all news"}

Page 12: Instrumentation talk

Click{ link: "Monitoring your credit...", source: "all news"}

?

Page 13: Instrumentation talk
Page 14: Instrumentation talk

ClicksPageViews

Context & Structure

Page 15: Instrumentation talk

PageViews

Page 16: Instrumentation talk

PageViews

Toolbar

Page 17: Instrumentation talk

PageViews

Menu

Page 18: Instrumentation talk

PageViewsMain

Page 19: Instrumentation talk

PageViewsSidebar

Page 20: Instrumentation talk

PageViewsMain

Page 21: Instrumentation talk

PageViewsFeatured

Page 22: Instrumentation talk

PageViews

Tabs

Page 23: Instrumentation talk

PageViews

Page 24: Instrumentation talk

PageViews

Toolbar MainMenu

Page

Sidebar

Search Link Featured TabsLink

Link Link

Link

Page 25: Instrumentation talk

Clicks

Page 26: Instrumentation talk

Clicks

Page 27: Instrumentation talk

1st link

Clicks

Page 28: Instrumentation talk

1st link 2nd news

Clicks

Page 29: Instrumentation talk

1st link 2nd news 1st tab

Clicks

Page 30: Instrumentation talk

1st link 2nd news 1st tab Tabs

Clicks

Page 31: Instrumentation talk

1st link 2nd news 1st tab Tabs Main

Clicks

Page 32: Instrumentation talk

1st link 2nd news 1st tab Tabs Main

Clicks

Page 33: Instrumentation talk

1st link

2nd news

1st tab

Tabs

Main

Clicks

Page 34: Instrumentation talk

1st link

2nd news

1st tab

Tabs

Main

Event Beacon

Page 35: Instrumentation talk

Data + state

1st link

2nd news

1st tab

Tabs

Main

Event Beacon

Data + state

Data + state

Data + state

Data + state

Page 36: Instrumentation talk

Data + state

1st link

2nd news

Tabs

Main

Event Beacon

Data + state

Data + state

Data + state

1st tab {title: "All News"}

Page 37: Instrumentation talk

React Props

DOM Tree

i13n Tree2 31

Strategies

Page 38: Instrumentation talk

DOM Tree1

Strategies

Page 39: Instrumentation talk

Dom Tree

nav

body

div

a

span b

div

a

span b

div

div div div

a aa

Page 40: Instrumentation talk

Dom Tree

nav

body

div

a

span b

div

a

span b

div

div div div

a aa

Page 41: Instrumentation talk

• Query & Traverse DOM is slow

• DOM vs React Virtual DOM

• Write i13n data to DOM

Dom Tree

Page 42: Instrumentation talk

React Props

DOM Tree

i13n Tree2 3

Strategies

Page 43: Instrumentation talk

React Props2

Strategies

Page 44: Instrumentation talk

React Props

Menu

App

Link Link

Main

Featured Tabs

Link Link ...

Page 45: Instrumentation talk

React Props

Menu

Link Link Tabs

Link ...

App

Main

Featured

Link

Page 46: Instrumentation talk

React Props

App

Main

Featured

Link

Page 47: Instrumentation talk

React Props

App

Main

Featured

Link

<App />

Page 48: Instrumentation talk

React Props

App

Main

Featured

Link

<App />

<Main level="1" pos="2" />

Page 49: Instrumentation talk

React Props

App

Main

Featured

Link

<App />

<Main level="1" pos="2" />

<Featured level="2" pos="1" l1="Main" l1Pos="2" />

Page 50: Instrumentation talk

React Props

App

Main

Featured

Link

<App />

<Main level="1" pos="2" />

<Featured level="2" pos="1" l1="Main" l1Pos="2" />

<Link level="3" pos="1" l1="Main" l1Pos="2" l2="Featured" l2Pos="1" />

Page 51: Instrumentation talk

React Props

media object

Page 52: Instrumentation talk

• Repetition in all components

• Error prone

• Visual / non-instrumented components

React Props

Page 53: Instrumentation talk

React Props

DOM Tree

i13n Tree3

Strategies

Page 54: Instrumentation talk

i13n Tree3

Strategies

Page 55: Instrumentation talk

i13n node

Page 56: Instrumentation talk

i13n node

Page 57: Instrumentation talk

i13n node

i13n node

i13n node

i13n node

children

Page 58: Instrumentation talk

i13n node

i13n node

i13n node

i13n node

childrenparent

Page 59: Instrumentation talk

Data + state

1st link

2nd news

1st tab

Tabs

Main

Event Beacon

Data + state

Data + state

Data + state

Data + state

Page 60: Instrumentation talk

i13n node

i13n node

i13n node

i13n node

childrenparent

Page 61: Instrumentation talk

i13n node

i13n node

i13n node

i13n node

childrenparent

Page 62: Instrumentation talk

i13n node

i13n node

i13n node

i13n node

childrenparent

React Component

React Component

Page 63: Instrumentation talk
Page 64: Instrumentation talk

Mixin +

Context

Page 65: Instrumentation talk
Page 66: Instrumentation talk

Menu

App

Link1 Link2

Main

Link3

Page 67: Instrumentation talk

i13n Root

Page 68: Instrumentation talk

App i13n Root

Page 69: Instrumentation talk

App i13n Root

Page 70: Instrumentation talk

App i13n Root

i13nRoot.append(this)

Page 71: Instrumentation talk

App

i13nRoot.append(this)

App i13nNode

i13n Root

Page 72: Instrumentation talk

App App i13nNode

i13n Root

Page 73: Instrumentation talk

i13n Root

App i13nNode

Menu

App

Page 74: Instrumentation talk

i13n Root

App i13nNode

Menu

appI13nNode.append(this)

App

Page 75: Instrumentation talk

i13n Root

App i13nNode

Menu

appI13nNode.append(this)

Menu i13nNode

App

Page 76: Instrumentation talk

i13n Root

App i13nNode

Menu Menu i13nNodeMain

App

Page 77: Instrumentation talk

i13n Root

App i13nNode

Menu Menu i13nNodeMain Main

i13nNode

App

Page 78: Instrumentation talk

i13n Root

App i13nNode

Menu Menu i13nNodeMain Main

i13nNode

App

Page 79: Instrumentation talk

i13n Root

App i13nNode

Menu Menu i13nNodeMain Main

i13nNode

App

Link1

Page 80: Instrumentation talk

i13n Root

App i13nNode

Menu Menu i13nNodeMain Main

i13nNode

App

Link1

menuI13nNode.append(this)

Page 81: Instrumentation talk

i13n Root

App i13nNode

Menu Menu i13nNodeMain Main

i13nNode

App

Link1 Link1 i13nNode

Page 82: Instrumentation talk

i13n Root

App i13nNode

Menu Menu i13nNodeMain Main

i13nNode

App

Link1 Link1 i13nNodeLink2 Link2

i13nNode

Page 83: Instrumentation talk

i13n Root

App i13nNode

Menu Menu i13nNodeMain Main

i13nNode

App

Link1 Link1 i13nNodeLink2 Link2

i13nNode

Page 84: Instrumentation talk

i13n Root

App i13nNode

Menu Menu i13nNodeMain Main

i13nNode

App

Link1 Link1 i13nNodeLink2 Link2

i13nNodeLink3 Link3 i13nNode

Page 85: Instrumentation talk

Visual components

media object

Page 86: Instrumentation talk

Visual components

News

Media Object

Image1 Link1

Media Object

Image2 Link2

Page 87: Instrumentation talk

Visual components

News

Media Object

Image1 Link1

Media Object

Image2 Link2

Page 88: Instrumentation talk

Visual components

News

Media Object

Image1 Link1

Media Object

Image2 Link2

News

Image1 Link1 Image2 Link2

Components Tree i13n Tree

Page 89: Instrumentation talk

• Automatic tree from mixin

• Lightweight objects. Fast to traverse

• Components customize the beacon

• Visual / non-instrumented components

I13n Tree

Page 90: Instrumentation talk
Page 91: Instrumentation talk
Page 92: Instrumentation talk
Page 93: Instrumentation talk
Page 94: Instrumentation talk
Page 95: Instrumentation talk
Page 96: Instrumentation talk

Mixin +

Contexti13n Tree

Page 97: Instrumentation talk

Questions?