Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-4849

Create Metrics instumentation bundle using ASM.

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Implemented
    • None
    • None
    • Extensions
    • None

    Description

      Aim: To enable metrics for any method call in a Sling JVM without requiring any code changes to existing bundles.

      Method: OSGi 4.3 has a WeavingHook which is allows a byte code generator to get in between the classloader and classloading. Using ASM it should be possible to write code that enhances the byte code of any class to wrap method calls in calls to the Dropwizard Metrics library. This should work without any changes to the startup. The only requirement is the bundle is loaded before the classloader loads the classes that need to be instrumented.

      Quick tests indicate the method works and adds no more than 10 byte code instructions to a method. It may be possible to reduce that further.

      Instrumentation will be controlled by configuration, so classes that are not instrumented are not modified at all when loading.

      The metrics once available can be pushed into Graphite, Kibana or some other collection service. Dumped to a file periodically or exposed in JMX as counters.

      Will work in a branch on github initially.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ianeboston Ian Boston
            ianeboston Ian Boston
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment