Initial code import
[msb/apigateway.git] / apiroute / apiroute-service / src / main / java / org / openo / msb / resources / MetricsResource.java
diff --git a/apiroute/apiroute-service/src/main/java/org/openo/msb/resources/MetricsResource.java b/apiroute/apiroute-service/src/main/java/org/openo/msb/resources/MetricsResource.java
new file mode 100644 (file)
index 0000000..d15799b
--- /dev/null
@@ -0,0 +1,49 @@
+/**\r
+* Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*/\r
+\r
+package org.openo.msb.resources;\r
+\r
+import io.swagger.annotations.Api;\r
+import io.swagger.annotations.ApiOperation;\r
+\r
+import javax.ws.rs.GET;\r
+import javax.ws.rs.Path;\r
+import javax.ws.rs.Produces;\r
+import javax.ws.rs.core.MediaType;\r
+\r
+import org.apache.http.impl.client.CloseableHttpClient;\r
+import org.openo.msb.api.MetricsInfo;\r
+import org.openo.msb.wrapper.MetricsServiceWrapper;\r
+\r
+import com.codahale.metrics.annotation.Timed;\r
+\r
+@Path("/metrics")\r
+@Api(tags = { "metrics" })\r
+@Produces(MediaType.APPLICATION_JSON)\r
+public class MetricsResource {\r
+       \r
+\r
+       @GET\r
+       @Path("/")\r
+       @ApiOperation(value = "get Metrics Info ", response = MetricsInfo.class)\r
+       @Produces(MediaType.APPLICATION_JSON)\r
+       @Timed\r
+       public MetricsInfo getMetricsInfo() {\r
+               return MetricsServiceWrapper.getMetricsInfo();\r
+       }\r
+       \r
+       \r
+}\r