Skip to content

Commit 0b36387

Browse files
author
“anand-raju”
committed
Removed commented methods
Removed Epoch counter
1 parent 0e4ad83 commit 0b36387

File tree

2 files changed

+8
-37
lines changed

2 files changed

+8
-37
lines changed

.settings/org.eclipse.jdt.core.prefs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
3+
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
45
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5-
org.eclipse.jdt.core.compiler.compliance=1.7
6+
org.eclipse.jdt.core.compiler.compliance=1.6
67
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
78
org.eclipse.jdt.core.compiler.debug.localVariable=generate
89
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
910
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
1011
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11-
org.eclipse.jdt.core.compiler.source=1.7
12+
org.eclipse.jdt.core.compiler.source=1.6

src/com/objectedge/newrelic/MonitoringAgent.java

+4-34
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
import com.fasterxml.jackson.databind.ObjectMapper;
1717
import com.newrelic.metrics.publish.Agent;
1818
import com.newrelic.metrics.publish.configuration.ConfigurationException;
19-
import com.newrelic.metrics.publish.processors.EpochProcessor;
20-
import com.newrelic.metrics.publish.processors.Processor;
2119
import com.newrelic.metrics.publish.util.Logger;
2220

2321
/**
@@ -31,11 +29,10 @@ public class MonitoringAgent extends Agent {
3129
private static final String VERSION = "1.0.0";
3230

3331
private static final String HTTP = "http";
34-
private static final String ATG_INSTANCE_URL = "/oe-diagnostics/rest/api/metrics/get";
32+
private static final String ATG_METRICS_URI = "/oe-diagnostics/rest/api/metrics/get";
3533

3634
private String name;
3735
private URL url;
38-
private Processor repositoryCreationRate;
3936

4037
private static Logger LOGGER = Logger.getLogger(MonitoringAgent.class);
4138

@@ -50,8 +47,7 @@ public MonitoringAgent(String name, String host, int port) throws ConfigurationE
5047
super(GUID, VERSION);
5148
try {
5249
this.name = name;
53-
this.url = new URL(HTTP,host,port, ATG_INSTANCE_URL);
54-
this.repositoryCreationRate = new EpochProcessor();
50+
this.url = new URL(HTTP,host,port, ATG_METRICS_URI);
5551
} catch (MalformedURLException e) {
5652
throw new ConfigurationException("ATG Statistics Engine metric URL could not be parsed", e);
5753
}
@@ -61,8 +57,7 @@ public MonitoringAgent(String name, String host) throws ConfigurationException {
6157
super(GUID, VERSION);
6258
try {
6359
this.name = name;
64-
this.url = new URL(HTTP,host, ATG_INSTANCE_URL);
65-
this.repositoryCreationRate = new EpochProcessor();
60+
this.url = new URL(HTTP,host, ATG_METRICS_URI);
6661
} catch (MalformedURLException e) {
6762
throw new ConfigurationException("ATG Statistics Engine metric URL could not be parsed", e);
6863
}
@@ -128,7 +123,7 @@ public String handleResponse(
128123
return httpclient.execute(httpget, responseHandler);
129124

130125
} catch (ClientProtocolException e) {
131-
e.printStackTrace();
126+
e.getMessage();
132127
} catch (IOException e) {
133128
e.printStackTrace();
134129
} finally {
@@ -150,29 +145,4 @@ private static String getURLString(URL url) {
150145
return urlStr.toString();
151146
}
152147

153-
154-
/*private JSONObject getJSONResponse() {
155-
Object response = null;
156-
InputStream inputStream = null;
157-
HttpURLConnection connection = null;
158-
try {
159-
connection = (HttpURLConnection) url.openConnection();
160-
connection.addRequestProperty("Accept", "application/json");
161-
inputStream = connection.getInputStream();
162-
response = JSONValue.parse(new InputStreamReader(inputStream));
163-
} catch (IOException e) {
164-
System.out.println("Error: Unable to access to agent at "+url.getHost()+":"+url.getPort());
165-
} finally {
166-
if (inputStream != null) {
167-
try {
168-
inputStream.close();
169-
} catch (IOException e) {}
170-
}
171-
if (connection != null) {
172-
connection.disconnect();
173-
}
174-
}
175-
return (JSONObject) response;
176-
}*/
177-
178148
}

0 commit comments

Comments
 (0)