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
NewRelic for Java
Search
Ran Tavory
September 29, 2012
Programming
4
520
NewRelic for Java
How to use the application performance monitoring service newrelic for java programmers
Ran Tavory
September 29, 2012
Tweet
Share
More Decks by Ran Tavory
See All by Ran Tavory
go-grpc-channelz: a Go based UI for gRPC's channelz
rantav
0
500
Code Review (Navy Hackathon)
rantav
0
49
Infrastructure Testing Using Kubernetes And Golang
rantav
0
61
Infrastructure testing using Kubernetes
rantav
0
500
Interview Workshop - Technical Questions
rantav
0
310
Code Review Best Practices
rantav
0
63
Code Review @ AppsFlyer
rantav
0
61
GraphQL at Yodas
rantav
2
170
Git for champs
rantav
0
140
Other Decks in Programming
See All in Programming
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
240
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
1.1k
混沌とした例外処理とエラー監視に秩序をもたらす
morihirok
13
2.3k
rails newと同時に型を書く
aki19035vc
5
710
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
1k
ecspresso, ecschedule, lambroll を PipeCDプラグインとして動かしてみた (プロトタイプ) / Running ecspresso, ecschedule, and lambroll as PipeCD Plugins (prototype)
tkikuc
2
1.9k
最近のVS Codeで気になるニュース 2025/01
74th
1
110
ASP.NET Core の OpenAPIサポート
h455h1
0
120
EC2からECSへ 念願のコンテナ移行と巨大レガシーPHPアプリケーションの再構築
sumiyae
3
590
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
1.4k
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
170
.NETでOBS Studio操作してみたけど…… / Operating OBS Studio by .NET
skasweb
0
120
Featured
See All Featured
Code Review Best Practice
trishagee
65
17k
The Cost Of JavaScript in 2023
addyosmani
46
7.2k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Faster Mobile Websites
deanohume
305
30k
Six Lessons from altMBA
skipperchong
27
3.6k
How STYLIGHT went responsive
nonsquared
96
5.3k
Statistics for Hackers
jakevdp
797
220k
Gamification - CAS2011
davidbonilla
80
5.1k
GitHub's CSS Performance
jonrohan
1030
460k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Designing for humans not robots
tammielis
250
25k
Transcript
NewRelic for Java @rantav Totango Saturday, 29 September 12
Server Monitoring Saturday, 29 September 12
Application Monitoring Saturday, 29 September 12
Webapps Monitoring This is automatic!!! fun fun fun... Saturday, 29
September 12
Webapps Monitoring This is automatic!!! fun fun fun... Saturday, 29
September 12
Real User Monitoring <script type="text/javascript">var NREUMQ=NREUMQ|| [];NREUMQ.push(["mark","firstbyte",new Date().getTime()])</script> Saturday, 29
September 12
Real User Monitoring <script type="text/javascript">var NREUMQ=NREUMQ|| [];NREUMQ.push(["mark","firstbyte",new Date().getTime()])</script> Saturday, 29
September 12
The Java API Maven: <repository> <id>morphia</id> <name>morphia</name> <url>http://morphia.googlecode.com/svn/mavenrepo/</url> </repository> <dependency>
<groupId>newrelic.java-agent</groupId> <artifactId>newrelic-api</artifactId> <version>2.7.0</version> </dependency> Saturday, 29 September 12
The Java API Report background as web request: NewRelic.setRequestAndResponse(Request request,
Response response) NewRelic.setTransactionName(String category, String transactionName) Custom params: NewRelic.addCustomParameter(String key, String value) NewRelic.addCustomParameter(String key, Number value) Error reporting: NewRelic.noticeError(Throwable throwable) NewRelic.noticeError(Throwable throwable, Map<String, String> params) NewRelic.noticeError(String message, Map<String, String> params) Metrics: NewRelic.recordMetric(String name, float value) NewRelic.recordResponseTimeMetric(Stri ng name, long millis) NewRelic.incrementCounter(String name) Real user monitoring: NewRelic.getBrowserTimingHeader() NewRelic.getBrowserTimingFooter() NewRelic.setUserName(String name) NewRelic.setAccountName(String name) NewRelic.setProductName(String name) Ignoring: NewRelic.ignoreTransaction() NewRelic.ignoreApdex() Saturday, 29 September 12
Background Processing @Trace(dispatcher=true) NewRelic.setRequestAndResponse() NewRelic.recordMetric() https://newrelic.com/docs/java/java-agent-api Saturday, 29 September 12
Background Processing Example 1 @Trace(dispatcher=true) private DateTimeZone getServiceTimezone(String serviceId) {
} Saturday, 29 September 12
Background Processing Example 1 @Trace(dispatcher=true) private DateTimeZone getServiceTimezone(String serviceId) {
} Saturday, 29 September 12
Background Processing Example 2 @Trace(dispatcher=true) private void insertSdr(...) { final
NewrelicResponseImpl response = new NewrelicResponseImpl(); NewRelic.setRequestAndResponse(new NewrelicRequestImpl("/ rtprocessor/insert-sdr", map("serviceId", sdr.getServiceId())), response); try { ! batchInsertSdr(sdr, serviceTimeZone); } catch (final RuntimeException e) { response.setError(e); ! ! throw e; } } Saturday, 29 September 12
Background Processing Example 2 @Trace(dispatcher=true) private void insertSdr(...) { final
NewrelicResponseImpl response = new NewrelicResponseImpl(); NewRelic.setRequestAndResponse(new NewrelicRequestImpl("/ rtprocessor/insert-sdr", map("serviceId", sdr.getServiceId())), response); try { ! batchInsertSdr(sdr, serviceTimeZone); } catch (final RuntimeException e) { response.setError(e); ! ! throw e; } } Saturday, 29 September 12
Reporting Metrics NewRelic.recordMetric("Custom/last-sdr- seconds-ago-" + sdr.getServiceId(), 5.56); Saturday, 29 September
12
Reporting Metrics NewRelic.recordMetric("Custom/last-sdr- seconds-ago-" + sdr.getServiceId(), 5.56); Saturday, 29 September
12
Database Monitoring Saturday, 29 September 12
Slow SQL Saturday, 29 September 12
Map View Saturday, 29 September 12
JVM Memory use and GC Saturday, 29 September 12
Custom Dashboards Saturday, 29 September 12
Alerting Saturday, 29 September 12
Apdex Saturday, 29 September 12
The Java agent How does it work: java -javaagent:newrelic.jar Saturday,
29 September 12
newrelic.yaml Saturday, 29 September 12
newrelic-sysmond sudo apt-get install newrelic-sysmond sudo /etc/init.d/newrelic-sysmond stop sudo /etc/init.d/newrelic-sysmond
start Saturday, 29 September 12
newrelic-sysmond sudo apt-get install newrelic-sysmond sudo /etc/init.d/newrelic-sysmond stop sudo /etc/init.d/newrelic-sysmond
start Saturday, 29 September 12
Ignoring Ignore URLs: IgnoreNewrelicFilter Ignore methods: @NewRelicIgnoreTransaction or: NewRelic.ignoreTransaction() Ignore
methods for apdex: @ NewRelicIgnoreApdex Or: NewRelic.ignoreApdex() Saturday, 29 September 12
Ignoring - using the filter Saturday, 29 September 12
The full Java API https://newrelic.com/docs/java/java-agent-api Saturday, 29 September 12
Deployment Notification curl -H x-api-key:17... -d 'deployment[app_name]=rtprocessor' -d 'deployment[revision]=r15161' -d
'deployment[user]=Ran Tavory' https://rpm.newrelic.com/deployments.xml Saturday, 29 September 12
Resources https://sites.google.com/a/totango.com/wiki/engineering/ ops/newrelic https://newrelic.com/docs/java/new-relic-for-java https://newrelic.com/docs/java/java-agent-configuration https://newrelic.com/docs/java/java-agent-api https://newrelic.com/docs/java/real-user-monitoring-in- java http://apdex.org/overview.html Saturday,
29 September 12