Introscope agent extensions case studies - introscope user group meeting - 18 oct 2011 (pub)

4,175 views
3,981 views

Published on

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,175
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
62
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Introscope agent extensions case studies - introscope user group meeting - 18 oct 2011 (pub)

  1. 1. INTROCSOPE AGENT EXTENSIONS - CASE STUDIES INTROSCOPE USER GROUP MEETING 18 OCT 2011 STOCKHOLM Jens Riboe18 Oct 2011 jens.riboe@ribomation.com
  2. 2. Jens Riboe, Ribomation2 Introscope Hacks ValtechSICS KTH Ribomation ERA London Goyada Wily (San Francisco) VzB OW RM 1990 1995 2000 2005 2010
  3. 3. Introscope3 Introscope Hacks  Wily Technology  Professional Services  2005 - 2007  London  CA-Wily  Independent Consultant  2009 - …  Engagements  Crit-sits  Installations and customizations  Developed numerous extensions  Contributed to the core product
  4. 4. Introscope Experience4 Introscope Hacks  Agent Extensions  EPA Extensions  Expression Tracer  MySQL Monitor  Dual Methods Tracer  Large Logs Reader  Large Interval Counter Tracer  Introscope Solutions  Smart Metrics (SunJVM)  SIP Monitor  EH Cache Tracer  DataPower Monitor  Certificate Status Tracer  Agent Metrics Router  JMX Agent  Distributed JMS Message  Auth PKI Tracker  JMX Metrics RE Filter  Iscope Feature Originator  Agent Blocker  Introscope clustering  EM Extensions  DoS Preventions  MM Replicator  XML TypeViews  Shell Command Alert Handler  EM/Agent Socket Factories
  5. 5. Introscope Customers5 Introscope Hacks  UK  Europe  HSBC, Sheffield  Dekabank, Frankfurt  Barclays, Manchester  Air France, Nice  Bank of America, Chester  Sparebank1, Oslo  Legal & General, London  Eripol, Krakow  Catlin, London  ...  Royal Bank of Scotland, Edinburgh  Sweden  British Telecom, Hemel Hempstead  Försäkringskassan, Sundsvall  Atos Origin, Bristol  Sandvik, Sandviken  Vodafone, Stoke-on-Trent  Telia IPTV, Göteborg  ...  Telia, Luleå  Systeam, Stockholm  Tieto, Stockholm  Bilprovningen, Stockholm
  6. 6. Besides Introscope…6 Introscope Hacks  Training  C++ and Threads Programming  Linux Systema Programming  Android Programming  Java Programming  Groovy and Grails Programming  Erlang Programming  Seminars  Android Programming  Cloud Computing  Distributed computation with Hadoop  The Future of Java  Groovy & Grails
  7. 7. Android Development7 Introscope Hacks  Launched Drive-Journal Android app  Open-Source Droid@Screen (GitHub)
  8. 8. Agenda8 Introscope Hacks  Ways to extend the Agent JVM  Developing new Tracer Types PBD  Expression Tracer  Large Interval Counter Tracer JMX  Dual Method Tracer  MM Replicator GC
  9. 9. Extending the Agent
  10. 10. Many ways to extend an Agent10 Introscope Hacks  Out-of-the-box  Changing the standard PBD configuration  Writing new PBDs  Adding supported extensions  Own development  Usage of the Introscope Metrics API  Implementation of a Tracer Type  Implementation of an Agent Extensions
  11. 11. Introscope Metrics API11 Introscope Hacks  For different kinds of non-standard metrics  The agent contains a metric factory you can use in your own application to emit metrics based on application oriented data Classes using the Metrics API should not be instrumented via PBD
  12. 12. Sample usage of the Metrics API12 Introscope Hacksclass CacheReporter extends TimerTask { private IntAverageDataRecorder metric; { String name = "Fibonacci|Cache:Current Size"; try { metric = DataRecorderFactory.createIntAverageDataRecorder(name); } catch (IllegalMetricNameException x) { System.err.println(x); System.exit(1); } } public void run() { metric.recordDataPoint( cache.size() ); }}
  13. 13. Implementation of a Tracer Type
  14. 14. Tracer Type14 Introscope Hacks  Java code that runs before and after an instrumentation point  Used to add different kind of metrics, than BlamePointTracer and other standard tracer types  Steps  Inheritfrom a tracer factory  Create metrics accumulator(s)  Do something before and/or after an instrumentation point  Pack into JAR
  15. 15. Tracer type class skeleton15 Introscope Hacks public class MyTracer extends ASingleInstanceTracerFactory { private IntegerAverageDataAccumulator metric; public MyTracer(IAgent agent, AttributeListing params, ProbeIdentification id, Object sample) { super(agent, params, id, sample); metric = getDataAccumulatorFactory().safeGetIntegerAverageDataAccumulator(name); . . . } public void ITracer_startTrace(int i, InvocationData data) { . . . } public void ITracer_finishTrace(int i, InvocationData data) { . . . int value = …; metric. IIntegerAggregatingDataAccumulator_recordDataPoint(value); } }
  16. 16. InvocationData16 Introscope Hacks  Contains all data about the instrumentation point  Retrieve the target  Object  Method  Method argument objects  Return value object
  17. 17. JAR Manifest17 Introscope Hacks Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Created-By: Apache Maven Built-By: jens Build-Jdk: 1.6.0_23 com-wily-Name: Large IntervalCounter Tracer com-wily-Release: 7.0 com-wily-Build: 202011 com-wily-Extension-Name: Large IntervalCounter Tracer com-wily-Extension-Type: Introscope-Agent com-wily-Extension-Version: 1 com-wily-Extension-Plugins-List: xyz com-wily-Extension-Plugin-xyz-Name: Large IntervalCounter Tracer com-wily-Extension-Plugin-xyz-Type: tracer com-wily-Extension-Plugin-xyz-Version: 1 com-wily-Extension-Plugin-xyz-Entry-Point-Class: com.ribomation.large_in terval_counter.LargeIntervalCounterTracer
  18. 18. Some Agent/EM Extensions18 Introscope Hacks  Expression Tracer  Large Interval Counter Tracer  MM Replicator
  19. 19. Availability19 Introscope Hacks  Open Source  http://blog.ribomation.com/introscope/  https://github.com/ribomation
  20. 20. Expression Tracer
  21. 21. ExpressionTracer21 Introscope Hacks  Make the result of a reflective call into a metric stream  Built upon OGNL  Can invoke a Java expression on  Any method of a target object  Any parameter of a target method  The returned value of a target method
  22. 22. Sample22 Introscope Hacks SetTracerClassMapping: ET com.wily.ps.expressiontracer.ExpressionTracer ... TraceOneMethodWithParametersOfClass: target.Application bizMethod ET "Tst:Number=this.getNumber()" TraceOneMethodWithParametersOfClass: target.Application bizMethid ET "Tst:Size=$1.size()"
  23. 23. Abilities23 Introscope Hacks  Target  this = instrumented object itself  $0 = returned object from the method  $n = n:th argument object of the method  Metric types  average  sum Retained values  counter  last  text  Retained last value  External OGNL expressions
  24. 24. PBD Sample24 Introscope Hacks SetTracerClassMapping: ET_avg com.ribomation.expression_tracer.ExpressionTracer com.wily.introscope.probebuilder.validate.MetricNameValidator SetTracerParameter: ET_avg metricType average SetTracerClassMapping: ET_sum com.ribomation.expression_tracer.ExpressionTracer com.wily…. SetTracerParameter: ET_sum metricType sum SetTracerClassMapping: ET_last com.ribomation.expression_tracer.ExpressionTracer com.wily…. SetTracerParameter: ET_last metricType last SetTracerClassMapping: ET_text com.ribomation.expression_tracer.ExpressionTracer com.wily…. SetTracerParameter: ET_text metricType text SetTracerClassMapping: ET_no_retain com.ribomation.expression_tracer.ExpressionTracer com.wily…. SetTracerParameter: ET_no_retain metricType average SetTracerClassMapping: ET_retain com.ribomation.expression_tracer.ExpressionTracer com.wily…. SetTracerParameter: ET_retain metricType average SetTracerParameter: ET_retain retainLastValue true TraceOneMethodWithParametersOfClass: target.Application compute ET_avg "ExpressionTracer|Number:Average=this.getNumber()" TraceOneMethodWithParametersOfClass: target.Application compute ET_sum "ExpressionTracer|Number:Sum=this.getNumber()" TraceOneMethodWithParametersOfClass: target.Application compute ET_last "ExpressionTracer|Number:Last=this.getNumber()" TraceOneMethodWithParametersOfClass: target.Application compute ET_avg "ExpressionTracer:List size (avg)=$1.size()" TraceOneMethodWithParametersOfClass: target.Application print ET_text "ExpressionTracer:Message=$1" TraceOneMethodWithParametersOfClass: target.Application whatever ET_no_retain "ExpressionTracer:Whatever=$1.intValue()" TraceOneMethodWithParametersOfClass: target.Application whatever ET_retain "ExpressionTracer:Whatever retained=$1.intValue()"
  25. 25. Cert Issuer25 Introscope Hacks
  26. 26. Cert Issuer26 Introscope Hacks NordicEdge.pbd SetTracerClassMapping: ET com.wily.ps.expressiontracer.ExpressionTracer ... SetTracerParameter: ET metricType counter TraceOneMethodWithParametersOfClass: se.nordicedge.CertificateParser getCAType ET "NordicEdge|Cert Issuer:Nordea=$0.startsWith("NORDEA")" TraceOneMethodWithParametersOfClass: se.nordicedge.CertificateParser getCAType ET "NordicEdge|Cert Issuer:BankID=$0.startsWith("BIDT")" TraceOneMethodWithParametersOfClass: se.nordicedge.CertificateParser getCAType ET "NordicEdge|Cert Issuer:Other=@otherIssuer"ExpressionTracer.propertiesotherIssuer=$0.(#issuer = #this, !(#issuer.startsWith("NORDEA") || #issuer.startsWith("BIDT")))
  27. 27. Large Interval Counter Tracer
  28. 28. Large Interval Counter Tracer28 Introscope Hacks  Like “Responses per Interval”, but for much longer time periods
  29. 29. PBD sample29 Introscope HacksSetTracerClassMapping: LargeInterval_30s com.ribomation.large_interval_counter.LargeIntervalCounterTracer com.wily.introscope.probebuilder.validate.ResourceNameValidatorSetTracerOrdering: LargeInterval_30s -1000SetTracerParameter: LargeInterval_30s interval "30s"SetTracerParameter: LargeInterval_30s metricPattern "Calls / {0}"SetTracerClassMapping: LargeInterval_1m com.ribomation.large_interval_counter.LargeIntervalCounterTracer com.wily.introscope.probebuilder.validate.ResourceNameValidatorSetTracerParameter: LargeInterval_1m interval "1m"SetTracerClassMapping: LargeInterval_5m com.ribomation.large_interval_counter.LargeIntervalCounterTracer com.wily.introscope.probebuilder.validate.ResourceNameValidatorSetTracerParameter: LargeInterval_5m interval "5m"#TraceOneMethodOfClass: <class> <method> <Tracer> "<Resource:Metric>"TraceOneMethodOfClass: test.Application doit LargeInterval_30s "Large Interval Counter|{packagename}|{classname}|{method}|30s"TraceOneMethodOfClass: test.Application doit LargeInterval_1m "Large Interval Counter|{packagename}|{classname}|{method}|1m"TraceOneMethodOfClass: test.Application doit LargeInterval_5m "Large Interval Counter|{packagename}|{classname}|{method}|5m"
  30. 30. Number of registrations30 Introscope Hacks
  31. 31. Number of registrations31 Introscope HacksSetTracerClassMapping: GICT_1h com.wily.ps.generalized_interval_counter.GeneralizedIntervalCounterTracer com.wily…SetTracerOrdering: GICT_1h -1000SetTracerParameter: GICT_1h interval "1h" # Half minute. Possible suffixes: h=hour, m=minute, s=second. Default: 1m#SetTracerParameter: GICT_1h type "array" # SlottedBuffer implementation. Possible values: "array", "list". Default: "array"#SetTracerParameter: GICT_1h metricPattern "Calls / {0}" # Metric name to the right of :. The unit will be patched in to {0}SetTracerClassMapping: GICT_24h com.wily.ps.generalized_interval_counter.GeneralizedIntervalCounterTracer com.wily…SetTracerParameter: GICT_24h interval "24h"SetTracerClassMapping: GICT_5m com.wily.ps.generalized_interval_counter.GeneralizedIntervalCounterTracer com.wily…SetTracerParameter: GICT_5m interval "5m"#TraceOneMethodOfClass: <class> <method> <Tracer> "<Resource:Metric>"TraceOneMethodOfClass: stockholmstad.selfreg.StockholmStadSelfReg register GICT_5m "NordicEdge|{packagename}|{classname}|{method}|5m"TraceOneMethodOfClass: stockholmstad.selfreg.StockholmStadSelfReg register GICT_1h "NordicEdge|{packagename}|{classname}|{method}|1h"TraceOneMethodOfClass: stockholmstad.selfreg.StockholmStadSelfReg register GICT_24h "NordicEdge|{packagename}|{classname}|{method}|24h"
  32. 32. MM Replicator
  33. 33. MM Replicator33 Introscope Hacks  Need to replicate a “template” MM for many applications  Webapp running on the embedded Jetty  Operation modes  Manualusing WUI  Automatic using CURL HTTP GET scripting
  34. 34. Create a Template MM34 Introscope Hacks (1) Add @ marked keywords, for names, metric groups, alerts and more (2) Choose a MM template
  35. 35. Generate35 Introscope Hacks (3) Provide values for all @ keywords (4) Generate a new hot deployed MM
  36. 36. Summary
  37. 37. Thanks & Goodbye37 Introscope Hacks Jens Riboe +46 (0)730-314040 jens.riboe@ribomation.com www.ribomation.com blog.ribomation.com

×