Code Monkey home page Code Monkey logo

apache-sling-sample's Introduction

Setup

  1. Download Sling Starter Standalone from https://sling.apache.org/downloads.cgi

  2. Download applicationinsights-agent-{version}.jar from https://github.com/microsoft/ApplicationInsights-Java/releases

  3. Create file AI-Agent.xml with the following content:

    <?xml version="1.0" encoding="utf-8"?>
    <ApplicationInsightsAgent>
      <Instrumentation>
        <BuiltIn enabled="true">
        </BuiltIn>
      </Instrumentation>
    </ApplicationInsightsAgent>
    
  4. Put all three files in the same directory

    • org.apache.sling.starter-11.jar
    • applicationinsights-agent-{version}.jar
    • AI-Agent.xml
  5. Run sling

    java -javaagent:applicationinsights-agent-{version}.jar -jar org.apache.sling.starter-11.jar
    

Build sample app

  1. Update the instrumentation key in src/main/resources/ApplicationInsights.xml

  2. Optionally enable debug logging in the ApplicationInsights.xml file by uncommenting

    <SDKLogger type="CONSOLE">
      <Level>TRACE</Level>
    </SDKLogger>
    

    and

    <Channel>
      <DeveloperMode>true</DeveloperMode>
    </Channel>
    
  3. Build with maven

    mvn clean package
    

Deploy the bundle to Sling

  1. Go to http://localhost:8080/system/console/bundles

  2. Log in with admin/admin

  3. Click Install/Update...

  4. Select the bundle from target/apache-sling-sample-1.0-SNAPSHOT.jar

  5. Check Start Bundle

  6. Click Install or Update

Test the app

  1. Go to http://localhost:8080/hello-world-servlet

  2. Request and dependency telemetry should show up in Azure Portal within a couple of minutes

  3. If you turned on debug logging above, you should see the captured request and dependency telemetry json in the console window right away (where you ran java -javaagent:... -jar ...)

apache-sling-sample's People

Contributors

trask avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.