Skip to content

Commit

Permalink
fixes needed for later SAP versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dhilpipre committed Jul 10, 2024
1 parent 0d19455 commit 25610ac
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ public static void addInstanceName(HashMap<String, Object> attributes) {
reportObject(attributes, "Agent-InstanceName", instanceId);
}

public static void reportPerformanceCollectorData(IPerformanceCollectorData data) {
public static void reportPerformanceCollectorData(IPerformanceCollectorData data, String source) {
Insights insights = NewRelic.getAgent().getInsights();
HashMap<String, Object> attributes = new HashMap<String, Object>();
reportObject(attributes, "Source", source);
reportObject(attributes,"ActionName", data.getActionName());
reportObject(attributes,"CreationTimestamp", data.getCreationTimestamp());
reportObject(attributes,"DeliverySemantics", data.getDeliverySemantics());
Expand All @@ -48,6 +49,7 @@ public static void reportPerformanceCollectorData(IPerformanceCollectorData data
reportObject(attributes,"ToServiceName", data.getToServiceName());
reportObject(attributes,"IsLoopback", data.isLoopback());
reportObject(attributes,"IsSyncResponse", data.isSyncResponse());
reportObject(attributes, "isTimePeriodCalculationFinalize", data.isTimePeriodCalculationFinalize());
if(data.hasIMeasuringPoints()) {
ArrayList<IMeasuringPoint> measuringPts = data.getMeasuringPoints();
int size = measuringPts.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,9 @@ public static PerformanceDataCache getInstance() {

public abstract HashMap<MessageKey, IPerformanceCollectorData> getCompleteMemoryCache();

public void cleanCache() {
NewRelic.incrementCounter("Custom/PerformanceDataCache/cleanCache/Calls");
Weaver.callOriginal();
}

public void cleanMemCache() {
NewRelic.incrementCounter("Custom/PerformanceDataCache/cleanMemCache/Calls");
Weaver.callOriginal();
}

protected boolean removeCacheEntry(IPerformanceCollectorData entry) {
NewRelic.incrementCounter("Custom/PerformanceDataCache/removeCacheEntry/Calls");
MessageStats.reportPerformanceCollectorData(entry);
MessageStats.reportPerformanceCollectorData(entry, "PerformanceDataCache-removeCacheEntry");
return Weaver.callOriginal();
}

Expand All @@ -43,7 +33,7 @@ protected void addCacheEntry(IPerformanceCollectorData entry) {
private IPerformanceCollectorData swapIn(MessageKey messageKey) {
NewRelic.incrementCounter("Custom/PerformanceDataCache/swapIn/Calls");
IPerformanceCollectorData returned = Weaver.callOriginal();
MessageStats.reportPerformanceCollectorData(returned);
MessageStats.reportPerformanceCollectorData(returned, "PerformanceDataCache-swapIn");
return returned;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.sap.aii.af.service.statistic;

import java.sql.Timestamp;
import java.util.HashMap;

import com.newrelic.api.agent.NewRelic;
import com.newrelic.api.agent.Trace;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.sap.aii.af.service.statistic.impl.PerformanceAccumulatorObject;
import com.newrelic.instrumentation.labs.sap.stats.MessageStats;
import com.sap.engine.interfaces.messaging.api.MessageKey;

@Weave
Expand All @@ -16,42 +14,24 @@ public static PerformanceMonitorManager getInstance() {
return Weaver.callOriginal();
}

public static boolean ACTIVE = Weaver.callOriginal();

public abstract HashMap<PerformanceAccumulatorObject, PerformanceAccumulatorObject> getPerformanceAccumulatorMap();


public IPerformanceCollectorData getPerformanceCollectorData(MessageKey messageKey, boolean startImplicit) throws ProfileException {
IPerformanceCollectorData result = Weaver.callOriginal();
return result;
}

public PerformanceAccumulatorObject[] getPerformanceData(PeriodType periodType, Timestamp selectionBeginTime,
Timestamp selectionEndTime, boolean strictPeriodStartEndCheck)
throws ProfileException, ClusterCommunicationException {
PerformanceAccumulatorObject[] result = Weaver.callOriginal();
return result;
}

public abstract IPeriod[] getProfilePeriods();
public abstract IPerformanceCollectorData getPerformanceCollectorData(MessageKey messageKey);

@Trace
public void start(MessageKey messageKey) {
Weaver.callOriginal();
}

@Trace
public void startAggregator(boolean force, Timestamp startTime, boolean dumpOpenIntervals, boolean skipDataDeletion) {
public void stop(MessageKey messageKey) {
NewRelic.incrementCounter("Custom/PerformanceMonitorManager/stop/Calls");
Weaver.callOriginal();
}

@Trace
public void stop(MessageKey messageKey) {
public void cancel(MessageKey messageKey) {
NewRelic.incrementCounter("Custom/PerformanceMonitorManager/cancel/Calls");
Weaver.callOriginal();
}

@Trace
public void cancel(MessageKey messageKey) {
private void updateAccumulationCache(IPerformanceCollectorData iPerformanceCollectorData) {
NewRelic.incrementCounter("Custom/PerformanceMonitorManager/updateAccumulationCache/Calls");
Weaver.callOriginal();
MessageStats.reportPerformanceCollectorData(iPerformanceCollectorData,"PerformanceMonitorManager-updateAccumulationCache");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.sap.aii.af.service.statistic.impl;

import java.sql.Timestamp;
import java.util.ArrayList;

import com.newrelic.api.agent.Trace;
import com.newrelic.api.agent.weaver.Weave;
import com.newrelic.api.agent.weaver.Weaver;
import com.sap.aii.af.service.statistic.IPerformanceCollectorData;
import com.sap.engine.interfaces.messaging.api.MessageKey;

@Weave
public abstract class DataAccess {

@SuppressWarnings("rawtypes")
@Trace(dispatcher = true)
public ArrayList<IPerformanceCollectorData> insertOrUpdateIPerformanceCollectorData(ArrayList performanceCollectorDataArray) {
return Weaver.callOriginal();
}

@Trace(dispatcher = true)
public IPerformanceCollectorData[] selectIPerformanceCollectorData(MessageKey messageKey) {
return Weaver.callOriginal();
}

@Trace(dispatcher = true)
public IPerformanceCollectorData[] selectIPerformanceCollectorData(Timestamp begin, Timestamp end, boolean processingTimestamp, boolean ascending) {
return Weaver.callOriginal();
}

@Trace(dispatcher = true)
public void deleteIPerformanceCollectorData(MessageKey messageKey) {
Weaver.callOriginal();
}

@Trace(dispatcher = true)
public long deleteIPerformanceCollectorData(Timestamp olderThan, int chunkSize) {
return Weaver.callOriginal();
}
}

0 comments on commit 25610ac

Please sign in to comment.