Skip to content

Commit

Permalink
removed additional logging and added additional calls
Browse files Browse the repository at this point in the history
  • Loading branch information
gsidhwani-nr committed Nov 23, 2023
1 parent 3709ccb commit a206e55
Showing 1 changed file with 21 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,75 +1,34 @@

package org.apache.sling.api.resource;

import java.util.logging.Level;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import com.newrelic.api.agent.Logger;
import com.newrelic.api.agent.NewRelic;
import com.newrelic.api.agent.Trace;
import com.newrelic.api.agent.Transaction;
import com.newrelic.api.agent.TransactionNamePriority;

import com.newrelic.api.agent.weaver.MatchType;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import org.apache.sling.api.resource.ResourceResolver;

@Weave(originalName = "org.apache.sling.api.resource.ResourceResolver", type = MatchType.Interface)
public abstract class ResourceResolver_instrumentation {


@Trace
public Resource resolve(HttpServletRequest req, String var1) {

Resource res=Weaver.callOriginal();

if (req instanceof HttpServletRequest) {

Transaction transaction = NewRelic.getAgent().getTransaction();
if(transaction != null) {
NewRelic.getAgent().getTracedMethod().setMetricName(new String[] {"Custom","Sling","resolve",res.getName()});

//transaction.setTransactionName(TransactionNamePriority.FRAMEWORK_LOW, true, "Sling",
/// new String[] { "Sling", "ResourceResolver", "resolve"});

Logger nrLogger = NewRelic.getAgent().getLogger();
nrLogger.log(Level.FINER, "APACHE-SLING - Starting ResourceResolver resolve method");



}

}
return res;
}


@Trace
public Resource resolve(HttpServletRequest req) {

Resource res=Weaver.callOriginal();

if (req instanceof HttpServletRequest) {

Transaction transaction = NewRelic.getAgent().getTransaction();
if(transaction != null) {
NewRelic.getAgent().getTracedMethod().setMetricName(new String[] {"Custom","Sling","resolve",res.getName()});

//transaction.setTransactionName(TransactionNamePriority.FRAMEWORK_LOW, true, "Sling",
// new String[] { "Sling", "ResourceResolver", "resolve"});

Logger nrLogger = NewRelic.getAgent().getLogger();
nrLogger.log(Level.FINER, "APACHE-SLING - Starting ResourceResolver resolve method");



}

}
return res;
}
}
@Trace
public Resource resolve(HttpServletRequest req) {
Resource res = Weaver.callOriginal();

if (req instanceof HttpServletRequest) {
NewRelic.getAgent().getTracedMethod().setMetricName(new String[] {"Custom", "Sling", getClass().getSimpleName(), "resolve", res.getName()});
}
return res;
}

@Trace
public Resource resolve(HttpServletRequest req, String var1) {
Resource res = Weaver.callOriginal();

if (req instanceof HttpServletRequest) {
NewRelic.getAgent().getTracedMethod().setMetricName(new String[] {"Custom", "Sling", getClass().getSimpleName(), "resolve", res.getName()});
}
return res;
}
}

0 comments on commit a206e55

Please sign in to comment.