test_class.declarator: servlet
test_class.modifier: private
test_class.original_string: private StagemonitorMetricsServlet servlet;
test_class.type: StagemonitorMetricsServlet
test_class.var_name: servlet
test_class.declarator: registry
test_class.modifier: private
test_class.original_string: private Metric2Registry registry;
test_class.type: Metric2Registry
test_class.var_name: registry
test_class.file: stagemonitor-web-servlet/src/test/java/org/stagemonitor/web/servlet/widget/StagemonitorMetricsServletTest.java
test_class.identifier: StagemonitorMetricsServletTest
test_case.body: @Test
  	public void getMeter() throws Exception {
  		registry.meter(name("foo").tag("bar", "baz").build()).mark();
  		final MockHttpServletResponse resp = new MockHttpServletResponse();
  		servlet.doGet(new MockHttpServletRequest(), resp);
  		final double mean_rate = JsonUtils.getMapper().readTree(resp.getContentAsString()).get(0).get("values").get("mean_rate").doubleValue();
  		assertTrue("Expected m1 rate of > 0, but got " + mean_rate, mean_rate > 0);
  	}
test_case.class_method_signature: StagemonitorMetricsServletTest.getMeter()
test_case.full_signature: @Test public void getMeter()
test_case.identifier: getMeter
test_case.invocations: mark meter build tag name doGet doubleValue get get get readTree getMapper getContentAsString assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getMeter()
focal_class.declarator: registry
focal_class.modifier: private final transient
focal_class.original_string: private final transient Metric2Registry registry;
focal_class.type: Metric2Registry
focal_class.var_name: registry
focal_class.declarator: servletPlugin
focal_class.modifier: private final transient
focal_class.original_string: private final transient ServletPlugin   servletPlugin;
focal_class.type: ServletPlugin
focal_class.var_name: servletPlugin
focal_class.declarator: mapper
focal_class.modifier: private final transient
focal_class.original_string: private final transient ObjectMapper    mapper;
focal_class.type: ObjectMapper
focal_class.var_name: mapper
focal_class.file: stagemonitor-web-servlet/src/main/java/org/stagemonitor/web/servlet/widget/StagemonitorMetricsServlet.java
focal_class.identifier: StagemonitorMetricsServlet
focal_class.class_method_signature: StagemonitorMetricsServlet.StagemonitorMetricsServlet()
focal_class.full_signature: public  StagemonitorMetricsServlet()
focal_class.identifier: StagemonitorMetricsServlet
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  StagemonitorMetricsServlet()
focal_class.class_method_signature: StagemonitorMetricsServlet.StagemonitorMetricsServlet(Metric2Registry registry, ServletPlugin servletPlugin, ObjectMapper mapper)
focal_class.full_signature: public  StagemonitorMetricsServlet(Metric2Registry registry, ServletPlugin servletPlugin, ObjectMapper mapper)
focal_class.identifier: StagemonitorMetricsServlet
focal_class.modifiers: public
focal_class.parameters: (Metric2Registry registry, ServletPlugin servletPlugin, ObjectMapper mapper)
focal_class.signature:  StagemonitorMetricsServlet(Metric2Registry registry, ServletPlugin servletPlugin, ObjectMapper mapper)
focal_class.class_method_signature: StagemonitorMetricsServlet.doGet(HttpServletRequest req, HttpServletResponse resp)
focal_class.full_signature: @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp)
focal_class.identifier: doGet
focal_class.modifiers: @Override protected
focal_class.parameters: (HttpServletRequest req, HttpServletResponse resp)
focal_class.return: void
focal_class.signature: void doGet(HttpServletRequest req, HttpServletResponse resp)
focal_class.class_method_signature: StagemonitorMetricsServlet.getWriter(HttpServletRequest request)
focal_class.full_signature: private ObjectWriter getWriter(HttpServletRequest request)
focal_class.identifier: getWriter
focal_class.modifiers: private
focal_class.parameters: (HttpServletRequest request)
focal_class.return: ObjectWriter
focal_class.signature: ObjectWriter getWriter(HttpServletRequest request)
focal_class.class_method_signature: StagemonitorMetricsServlet.registerMetricsRegistryModule(HttpServletRequest request, ObjectMapper objectMapperCopy)
focal_class.full_signature: private void registerMetricsRegistryModule(HttpServletRequest request, ObjectMapper objectMapperCopy)
focal_class.identifier: registerMetricsRegistryModule
focal_class.modifiers: private
focal_class.parameters: (HttpServletRequest request, ObjectMapper objectMapperCopy)
focal_class.return: void
focal_class.signature: void registerMetricsRegistryModule(HttpServletRequest request, ObjectMapper objectMapperCopy)
focal_class.superclass: extends HttpServlet
focal_method.body: @Override
  	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  		resp.setContentType("application/json");
  		if (servletPlugin.getMetricsServletAllowedOrigin() != null) {
  			resp.setHeader("Access-Control-Allow-Origin", servletPlugin.getMetricsServletAllowedOrigin());
  		}
  		resp.setHeader("Cache-Control", "must-revalidate,no-cache,no-store");
  		resp.setStatus(HttpServletResponse.SC_OK);
  
  		try (OutputStream output = resp.getOutputStream()) {
  			String jsonpParamName = servletPlugin.getMetricsServletJsonpParamName();
  			if (jsonpParamName != null && req.getParameter(jsonpParamName) != null) {
  				getWriter(req).writeValue(output, new JSONPObject(req.getParameter(jsonpParamName), registry));
  			} else {
  				getWriter(req).writeValue(output, registry);
  			}
  		}
  	}
focal_method.class_method_signature: StagemonitorMetricsServlet.doGet(HttpServletRequest req, HttpServletResponse resp)
focal_method.full_signature: @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp)
focal_method.identifier: doGet
focal_method.invocations: setContentType getMetricsServletAllowedOrigin setHeader getMetricsServletAllowedOrigin setHeader setStatus getOutputStream getMetricsServletJsonpParamName getParameter writeValue getWriter getParameter writeValue getWriter
focal_method.modifiers: @Override protected
focal_method.parameters: (HttpServletRequest req, HttpServletResponse resp)
focal_method.return: void
focal_method.signature: void doGet(HttpServletRequest req, HttpServletResponse resp)