id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
49818800_44 | {
"fields": [
{
"declarator": "server = new MockWebServer()",
"modifier": "@Rule public",
"original_string": "@Rule public MockWebServer server = new MockWebServer();",
"type": "MockWebServer",
"var_name": "server"
},
{
"declarator": "fileSystem = new InMemoryFileSystem... | {
"body": "@Test public void originServerSends407() throws Exception {\n server.enqueue(new MockResponse().setResponseCode(407));\n\n HttpURLConnection conn = factory.open(server.url(\"/\").url());\n try {\n conn.getResponseCode();\n fail();\n } catch (IOException ignored) {\n }\n }",
"cla... | {
"fields": [
{
"declarator": "client",
"modifier": "private",
"original_string": "private OkHttpClient client;",
"type": "OkHttpClient",
"var_name": "client"
}
],
"file": "okhttp-urlconnection/src/main/java/okhttp3/OkUrlFactory.java",
"identifier": "OkUrlFactory",
"inter... | {
"body": "public HttpURLConnection open(URL url) {\n return open(url, client.proxy());\n }",
"class_method_signature": "OkUrlFactory.open(URL url)",
"constructor": false,
"full_signature": "public HttpURLConnection open(URL url)",
"identifier": "open",
"invocations": [
"open",
"proxy"
],
"m... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_29 | {
"fields": [
{
"declarator": "PLAIN = MediaType.parse(\"text/plain; charset=utf-8\")",
"modifier": "private static final",
"original_string": "private static final MediaType PLAIN = MediaType.parse(\"text/plain; charset=utf-8\");",
"type": "MediaType",
"var_name": "PLAIN"
},
... | {
"body": "@Test public void basicPost() throws IOException {\n setLevel(Level.BASIC);\n\n server.enqueue(new MockResponse());\n client.newCall(request().post(RequestBody.create(PLAIN, \"Hi?\")).build()).execute();\n\n applicationLogs\n .assertLogEqual(\"--> POST \" + url + \" HTTP/1.1 (3-byte body... | {
"fields": [
{
"declarator": "UTF8 = Charset.forName(\"UTF-8\")",
"modifier": "private static final",
"original_string": "private static final Charset UTF8 = Charset.forName(\"UTF-8\");",
"type": "Charset",
"var_name": "UTF8"
},
{
"declarator": "logger",
"modifie... | {
"body": "public HttpLoggingInterceptor setLevel(Level level) {\n if (level == null) throw new NullPointerException(\"level == null. Use Level.NONE instead.\");\n this.level = level;\n return this;\n }",
"class_method_signature": "HttpLoggingInterceptor.setLevel(Level level)",
"constructor": false,
"... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_28 | {
"fields": [
{
"declarator": "PLAIN = MediaType.parse(\"text/plain; charset=utf-8\")",
"modifier": "private static final",
"original_string": "private static final MediaType PLAIN = MediaType.parse(\"text/plain; charset=utf-8\");",
"type": "MediaType",
"var_name": "PLAIN"
},
... | {
"body": "@Test public void basicGet() throws IOException {\n setLevel(Level.BASIC);\n\n server.enqueue(new MockResponse());\n client.newCall(request().build()).execute();\n\n applicationLogs\n .assertLogEqual(\"--> GET \" + url + \" HTTP/1.1\")\n .assertLogMatch(\"<-- 200 OK \" + url + \" ... | {
"fields": [
{
"declarator": "UTF8 = Charset.forName(\"UTF-8\")",
"modifier": "private static final",
"original_string": "private static final Charset UTF8 = Charset.forName(\"UTF-8\");",
"type": "Charset",
"var_name": "UTF8"
},
{
"declarator": "logger",
"modifie... | {
"body": "public HttpLoggingInterceptor setLevel(Level level) {\n if (level == null) throw new NullPointerException(\"level == null. Use Level.NONE instead.\");\n this.level = level;\n return this;\n }",
"class_method_signature": "HttpLoggingInterceptor.setLevel(Level level)",
"constructor": false,
"... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_45 | {
"fields": [
{
"declarator": "server = new MockWebServer()",
"modifier": "@Rule public",
"original_string": "@Rule public MockWebServer server = new MockWebServer();",
"type": "MockWebServer",
"var_name": "server"
},
{
"declarator": "fileSystem = new InMemoryFileSystem... | {
"body": "@Test public void networkResponseSourceHeader() throws Exception {\n server.enqueue(new MockResponse().setBody(\"Isla Sorna\"));\n\n HttpURLConnection connection = factory.open(server.url(\"/\").url());\n assertResponseHeader(connection, \"NETWORK 200\");\n assertResponseBody(connection, \"Isla... | {
"fields": [
{
"declarator": "client",
"modifier": "private",
"original_string": "private OkHttpClient client;",
"type": "OkHttpClient",
"var_name": "client"
}
],
"file": "okhttp-urlconnection/src/main/java/okhttp3/OkUrlFactory.java",
"identifier": "OkUrlFactory",
"inter... | {
"body": "public HttpURLConnection open(URL url) {\n return open(url, client.proxy());\n }",
"class_method_signature": "OkUrlFactory.open(URL url)",
"constructor": false,
"full_signature": "public HttpURLConnection open(URL url)",
"identifier": "open",
"invocations": [
"open",
"proxy"
],
"m... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_12 | {
"fields": [
{
"declarator": "LOCAL_CERT = certificate(\"\"\n + \"-----BEGIN CERTIFICATE-----\\n\"\n + \"MIIBWDCCAQKgAwIBAgIJANS1EtICX2AZMA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV\\n\"\n + \"BAMTCWxvY2FsaG9zdDAgFw0xMjAxMDIxOTA4NThaGA8yMTExMTIwOTE5MDg1OFow\\n\"\n + \"FDESMBAGA1UEAxMJbG9jYWxob3N0MF... | {
"body": "@Test public void createJavaUrlConnection_responseChangesForbidden() throws Exception {\n Response okResponse = createArbitraryOkResponse();\n HttpURLConnection httpUrlConnection =\n JavaApiConverter.createJavaUrlConnectionForCachePut(okResponse);\n // Check an arbitrary (not complete) set ... | {
"fields": [
{
"declarator": "EMPTY_REQUEST_BODY = RequestBody.create(null, new byte[0])",
"modifier": "private static final",
"original_string": "private static final RequestBody EMPTY_REQUEST_BODY = RequestBody.create(null, new byte[0]);",
"type": "RequestBody",
"var_name": "EMPTY... | {
"body": "static HttpURLConnection createJavaUrlConnectionForCachePut(Response okResponse) {\n Request request = okResponse.request();\n // Create an object of the correct class in case the ResponseCache uses instanceof.\n if (request.isHttps()) {\n return new CacheHttpsURLConnection(new CacheHttpURLCo... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_53 | {
"fields": [
{
"declarator": "server",
"modifier": "private",
"original_string": "private MockWebServer server;",
"type": "MockWebServer",
"var_name": "server"
},
{
"declarator": "client",
"modifier": "private",
"original_string": "private OkApacheClient cl... | {
"body": "@Test public void redirect() throws Exception {\n server.enqueue(new MockResponse().setResponseCode(302).addHeader(\"Location\", \"/foo\"));\n server.enqueue(new MockResponse().setBody(\"Hello, Redirect!\"));\n\n HttpGet request = new HttpGet(server.url(\"/\").url().toURI());\n HttpResponse res... | {
"fields": [
{
"declarator": "params = new AbstractHttpParams() {\n @Override public Object getParameter(String name) {\n if (name.equals(ConnRouteParams.DEFAULT_PROXY)) {\n Proxy proxy = client.proxy();\n if (proxy == null) {\n return null;\n }\n InetSocketAddr... | {
"body": "@Override public HttpResponse execute(HttpUriRequest request) throws IOException {\n return execute(null, request, (HttpContext) null);\n }",
"class_method_signature": "OkApacheClient.execute(HttpUriRequest request)",
"constructor": false,
"full_signature": "@Override public HttpResponse execute(... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_7 | {
"fields": [
{
"declarator": "LOCAL_CERT = certificate(\"\"\n + \"-----BEGIN CERTIFICATE-----\\n\"\n + \"MIIBWDCCAQKgAwIBAgIJANS1EtICX2AZMA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV\\n\"\n + \"BAMTCWxvY2FsaG9zdDAgFw0xMjAxMDIxOTA4NThaGA8yMTExMTIwOTE5MDg1OFow\\n\"\n + \"FDESMBAGA1UEAxMJbG9jYWxob3N0MF... | {
"body": "@Test public void createOkRequest_nullRequestHeaders() throws Exception {\n URI uri = new URI(\"http://foo/bar\");\n\n Map<String, List<String>> javaRequestHeaders = null;\n Request request = JavaApiConverter.createOkRequest(uri, \"POST\", javaRequestHeaders);\n assertFalse(request.isHttps());\... | {
"fields": [
{
"declarator": "EMPTY_REQUEST_BODY = RequestBody.create(null, new byte[0])",
"modifier": "private static final",
"original_string": "private static final RequestBody EMPTY_REQUEST_BODY = RequestBody.create(null, new byte[0]);",
"type": "RequestBody",
"var_name": "EMPTY... | {
"body": "public static Request createOkRequest(\n URI uri, String requestMethod, Map<String, List<String>> requestHeaders) {\n // OkHttp's Call API requires a placeholder body; the real body will be streamed separately.\n RequestBody placeholderBody = HttpMethod.requiresRequestBody(requestMethod)\n ... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_24 | {
"fields": [
{
"declarator": "sslContext = SslContextBuilder.localhost()",
"modifier": "private",
"original_string": "private SSLContext sslContext = SslContextBuilder.localhost();",
"type": "SSLContext",
"var_name": "sslContext"
},
{
"declarator": "hostnameVerifier = ... | {
"body": "@Test public void get_httpGet() throws Exception {\n final URL serverUrl = configureServer(new MockResponse());\n assertEquals(\"http\", serverUrl.getProtocol());\n\n ResponseCache responseCache = new AbstractResponseCache() {\n @Override public CacheResponse get(\n URI uri, String m... | {
"fields": [
{
"declarator": "delegate",
"modifier": "private final",
"original_string": "private final ResponseCache delegate;",
"type": "ResponseCache",
"var_name": "delegate"
}
],
"file": "okhttp-android-support/src/main/java/okhttp3/internal/huc/CacheAdapter.java",
"id... | {
"body": "@Override public Response get(Request request) throws IOException {\n CacheResponse javaResponse = getJavaCachedResponse(request);\n if (javaResponse == null) {\n return null;\n }\n return JavaApiConverter.createOkResponseForCacheGet(request, javaResponse);\n }",
"class_method_signature... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_65 | {
"fields": [
{
"declarator": "server",
"modifier": "private",
"original_string": "private MockWebServer server;",
"type": "MockWebServer",
"var_name": "server"
},
{
"declarator": "client",
"modifier": "private",
"original_string": "private OkApacheClient cl... | {
"body": "@Test public void jsonTransparentGzipResponse() throws Exception {\n String text = \"{\\\"Message\\\": { \\\"text\\\": \\\"Hello, World!\\\" } }\";\n server.enqueue(new MockResponse().setBody(gzip(text))\n .setHeader(\"Content-Encoding\", \"gzip\")\n .setHeader(\"Content-Type\", \"appli... | {
"fields": [
{
"declarator": "params = new AbstractHttpParams() {\n @Override public Object getParameter(String name) {\n if (name.equals(ConnRouteParams.DEFAULT_PROXY)) {\n Proxy proxy = client.proxy();\n if (proxy == null) {\n return null;\n }\n InetSocketAddr... | {
"body": "@Override public HttpResponse execute(HttpUriRequest request) throws IOException {\n return execute(null, request, (HttpContext) null);\n }",
"class_method_signature": "OkApacheClient.execute(HttpUriRequest request)",
"constructor": false,
"full_signature": "@Override public HttpResponse execute(... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_32 | {
"fields": [
{
"declarator": "PLAIN = MediaType.parse(\"text/plain; charset=utf-8\")",
"modifier": "private static final",
"original_string": "private static final MediaType PLAIN = MediaType.parse(\"text/plain; charset=utf-8\");",
"type": "MediaType",
"var_name": "PLAIN"
},
... | {
"body": "@Test public void headersGet() throws IOException {\n setLevel(Level.HEADERS);\n\n server.enqueue(new MockResponse());\n Response response = client.newCall(request().build()).execute();\n response.body().close();\n\n applicationLogs\n .assertLogEqual(\"--> GET \" + url + \" HTTP/1.1\"... | {
"fields": [
{
"declarator": "UTF8 = Charset.forName(\"UTF-8\")",
"modifier": "private static final",
"original_string": "private static final Charset UTF8 = Charset.forName(\"UTF-8\");",
"type": "Charset",
"var_name": "UTF8"
},
{
"declarator": "logger",
"modifie... | {
"body": "public HttpLoggingInterceptor setLevel(Level level) {\n if (level == null) throw new NullPointerException(\"level == null. Use Level.NONE instead.\");\n this.level = level;\n return this;\n }",
"class_method_signature": "HttpLoggingInterceptor.setLevel(Level level)",
"constructor": false,
"... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
49818800_49 | {
"fields": [
{
"declarator": "server = new MockWebServer()",
"modifier": "@Rule public",
"original_string": "@Rule public MockWebServer server = new MockWebServer();",
"type": "MockWebServer",
"var_name": "server"
},
{
"declarator": "fileSystem = new InMemoryFileSystem... | {
"body": "@Test public void cacheResponseSourceHeaders() throws Exception {\n server.enqueue(new MockResponse()\n .addHeader(\"Expires: \" + formatDate(2, TimeUnit.HOURS))\n .setBody(\"Isla Nublar\"));\n\n HttpURLConnection connection1 = factory.open(server.url(\"/\").url());\n assertResponseH... | {
"fields": [
{
"declarator": "client",
"modifier": "private",
"original_string": "private OkHttpClient client;",
"type": "OkHttpClient",
"var_name": "client"
}
],
"file": "okhttp-urlconnection/src/main/java/okhttp3/OkUrlFactory.java",
"identifier": "OkUrlFactory",
"inter... | {
"body": "public HttpURLConnection open(URL url) {\n return open(url, client.proxy());\n }",
"class_method_signature": "OkUrlFactory.open(URL url)",
"constructor": false,
"full_signature": "public HttpURLConnection open(URL url)",
"identifier": "open",
"invocations": [
"open",
"proxy"
],
"m... | {
"created": null,
"fork": null,
"fork_count": 3,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 49818800,
"size": 641,
"stargazer_count": 14,
"stars": null,
"updates": null,
"url": "https://github.com/lizhangqu/PriorityOkHttp"
} |
139879729_5 | {
"fields": [
{
"declarator": "_DELTA = 1",
"modifier": "private static final",
"original_string": "private static final int _DELTA = 1;",
"type": "int",
"var_name": "_DELTA"
},
{
"declarator": "_LATITUDE = 33.997673",
"modifier": "private static final",
"or... | {
"body": "@Test\n\tpublic void testGetDistance() {\n\t\tAssert.assertEquals(\n\t\t\t69.382,\n\t\t\t_distanceCalculator.getDistance(\n\t\t\t\t_LATITUDE, _LONGITUDE, 34.045886, -118.564861),\n\t\t\t_DELTA);\n\t\tAssert.assertEquals(\n\t\t\t9070.629,\n\t\t\t_distanceCalculator.getDistance(\n\t\t\t\t_LATITUDE, _LONGITUD... | {
"fields": [
{
"declarator": "_EARTH_RADIUS = 6372.8",
"modifier": "private static final",
"original_string": "private static final double _EARTH_RADIUS = 6372.8;",
"type": "double",
"var_name": "_EARTH_RADIUS"
}
],
"file": "commerce-shipping-origin-locator/src/main/java/com... | {
"body": "public double getDistance(\n\t\tdouble latitude1, double longitude1, double latitude2,\n\t\tdouble longitude2) {\n\n\t\tdouble latitudeDifference = Math.toRadians(latitude2 - latitude1);\n\t\tdouble longitudeDifference = Math.toRadians(longitude2 - longitude1);\n\n\t\tlatitude1 = Math.toRadians(latitude1);... | {
"created": null,
"fork": null,
"fork_count": 128,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 139879729,
"size": 87644,
"stargazer_count": 41,
"stars": null,
"updates": null,
"url": "https://github.com/liferay/com-liferay-commerce"
} |
160304314_6 | {
"fields": [],
"file": "cover-checker-console/src/test/java/com/naver/nid/cover/util/ObjectFactoryTest.java",
"identifier": "ObjectFactoryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void getCoberturaCoverageReportParser() throws NoSuchFieldException, IllegalAccessException {\n CoverageReportParser cobertura = new ObjectFactory(Parameter.builder().coverageType(\"cobertura\").build()).getCoverageReportParser();\n Field handler = XmlCoverageReportParser.class.get... | {
"fields": [
{
"declarator": "param",
"modifier": "private final",
"original_string": "private final Parameter param;",
"type": "Parameter",
"var_name": "param"
}
],
"file": "cover-checker-console/src/main/java/com/naver/nid/cover/util/ObjectFactory.java",
"identifier": "O... | {
"body": "public CoverageReportParser getCoverageReportParser() {\n if (\"cobertura\".equals(param.getCoverageType())) {\n return new XmlCoverageReportParser(new CoberturaCoverageReportHandler());\n } else {\n return new JacocoReportParser();\n }\n }",
"class_method_si... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_17 | {
"fields": [],
"file": "cover-checker-core/src/test/java/com/naver/nid/cover/checker/NewCoverageCheckerTest.java",
"identifier": "NewCoverageCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void coverCheckTestForMultiModule() {\n NewCoverageChecker checker = new NewCoverageChecker();\n\n List<Line> lines = Arrays.asList(\n Line.builder().lineNumber(1).type(ModifyType.ADD).build()\n , Line.builder().lineNumber(2).type(ModifyType.ADD... | {
"fields": [
{
"declarator": "logger = LoggerFactory.getLogger(NewCoverageChecker.class)",
"modifier": "private static final",
"original_string": "private static final Logger logger = LoggerFactory.getLogger(NewCoverageChecker.class);",
"type": "Logger",
"var_name": "logger"
}
... | {
"body": "public NewCoverageCheckReport check(List<FileCoverageReport> coverage, List<Diff> diff, int threshold, int fileThreshold) {\n\t\tMap<String, List<Line>> diffMap = diff.stream()\n\t\t\t\t.filter(Objects::nonNull)\n\t\t\t\t.peek(d -> logger.debug(\"diff file {}\", d.getFileName()))\n\t\t\t\t.filter(d -> !d.g... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_16 | {
"fields": [],
"file": "cover-checker-core/src/test/java/com/naver/nid/cover/checker/NewCoverageCheckerTest.java",
"identifier": "NewCoverageCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void coverCheckTestForNonJava() {\n NewCoverageChecker checker = new NewCoverageChecker();\n\n List<Line> lines = Arrays.asList(\n Line.builder().lineNumber(1).type(ModifyType.ADD).build()\n , Line.builder().lineNumber(2).type(ModifyType.ADD).bu... | {
"fields": [
{
"declarator": "logger = LoggerFactory.getLogger(NewCoverageChecker.class)",
"modifier": "private static final",
"original_string": "private static final Logger logger = LoggerFactory.getLogger(NewCoverageChecker.class);",
"type": "Logger",
"var_name": "logger"
}
... | {
"body": "public NewCoverageCheckReport check(List<FileCoverageReport> coverage, List<Diff> diff, int threshold, int fileThreshold) {\n\t\tMap<String, List<Line>> diffMap = diff.stream()\n\t\t\t\t.filter(Objects::nonNull)\n\t\t\t\t.peek(d -> logger.debug(\"diff file {}\", d.getFileName()))\n\t\t\t\t.filter(d -> !d.g... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_7 | {
"fields": [],
"file": "cover-checker-console/src/test/java/com/naver/nid/cover/util/ObjectFactoryTest.java",
"identifier": "ObjectFactoryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void getJacocoCoverageReportParser() {\n CoverageReportParser jacoco = new ObjectFactory(Parameter.builder().build()).getCoverageReportParser();\n assertEquals(JacocoReportParser.class, jacoco.getClass());\n }",
"class_method_signature": "ObjectFactoryTest.getJacocoCoverageRep... | {
"fields": [
{
"declarator": "param",
"modifier": "private final",
"original_string": "private final Parameter param;",
"type": "Parameter",
"var_name": "param"
}
],
"file": "cover-checker-console/src/main/java/com/naver/nid/cover/util/ObjectFactory.java",
"identifier": "O... | {
"body": "public CoverageReportParser getCoverageReportParser() {\n if (\"cobertura\".equals(param.getCoverageType())) {\n return new XmlCoverageReportParser(new CoberturaCoverageReportHandler());\n } else {\n return new JacocoReportParser();\n }\n }",
"class_method_si... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_0 | {
"fields": [
{
"declarator": "prNum = 1",
"modifier": "private",
"original_string": "private int prNum = 1;",
"type": "int",
"var_name": "prNum"
},
{
"declarator": "mockIssue",
"modifier": "private",
"original_string": "private IssueService mockIssue;",
... | {
"body": "@Test\n\tpublic void deleteComment() throws IOException {\n\t\twhen(mockIssue.getComments(repositoryId, prNum))\n\t\t\t\t.thenReturn(Collections.singletonList(new Comment().setId(1).setBody(\"test\")\n\t\t\t\t\t\t.setUser(new User().setId(1))));\n\t\tdoNothing().when(mockIssue)\n\t\t\t\t.deleteComment(repo... | {
"fields": [
{
"declarator": "logger = LoggerFactory.getLogger(GithubCommentManager.class)",
"modifier": "private static final",
"original_string": "private static final Logger logger = LoggerFactory.getLogger(GithubCommentManager.class);",
"type": "Logger",
"var_name": "logger"
... | {
"body": "public int deleteComment(Predicate<Comment> commentPredicate) throws IOException {\n\t\tList<Comment> comments = issueService.getComments(repoId, issueNumber);\n\t\tint delCount = 0;\n\t\tfor (Comment c : comments) {\n\n\t\t\tif (logger.isDebugEnabled()) {\n\t\t\t\tlogger.debug(\"pre filtered comment {} : ... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_11 | {
"fields": [],
"file": "cover-checker-console/src/test/java/com/naver/nid/cover/LauncherTest.java",
"identifier": "LauncherTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMain() {\n Launcher.main(new String[]{\"\"});\n // execution fail\n // because there is no parameters for execute cover-checker\n assertThrows(NullPointerException.class, () -> Launcher.main(\"-c path -t 80 -dt file\".split(\" \")));\n }",
"class_... | {
"fields": [],
"file": "cover-checker-console/src/main/java/com/naver/nid/cover/Launcher.java",
"identifier": "Launcher",
"interfaces": "",
"methods": [
{
"class_method_signature": "Launcher.main(String[] args)",
"constructor": false,
"full_signature": "public static void main(String[] ... | {
"body": "public static void main(String[] args) {\n Parameter param = new ParameterParser().getParam(args);\n if (param == null) return;\n\n ObjectFactory objectManager = new ObjectFactory(param);\n new CoverChecker(objectManager.getCoverageReportParser(),\n objectManager.... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_10 | {
"fields": [],
"file": "cover-checker-console/src/test/java/com/naver/nid/cover/util/ParameterParserTest.java",
"identifier": "ParameterParserTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void getFailParam() {\n\t\tassertNull(new ParameterParser().getParam(\"\"));\n\t}",
"class_method_signature": "ParameterParserTest.getFailParam()",
"constructor": false,
"full_signature": "@Test public void getFailParam()",
"identifier": "getFailParam",
"invocations": [
"asser... | {
"fields": [
{
"declarator": "logger = LoggerFactory.getLogger(ParameterParser.class)",
"modifier": "private static final",
"original_string": "private static final Logger logger = LoggerFactory.getLogger(ParameterParser.class);",
"type": "Logger",
"var_name": "logger"
},
{
... | {
"body": "public Parameter getParam(String... commandArgs) {\n\t\tOptions commandOptions = executeOption();\n\n\t\tCommandLineParser parser = new DefaultParser();\n\t\tHelpFormatter formatter = new HelpFormatter();\n\n\t\tCommandLine cmd;\n\t\ttry {\n\t\t\tcmd = parser.parse(commandOptions, commandArgs);\n\t\t} catc... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_1 | {
"fields": [
{
"declarator": "prNum = 1",
"modifier": "private",
"original_string": "private int prNum = 1;",
"type": "int",
"var_name": "prNum"
},
{
"declarator": "mockIssue",
"modifier": "private",
"original_string": "private IssueService mockIssue;",
... | {
"body": "@Test\n\tpublic void insertComment() throws IOException {\n\t\twhen(mockIssue.createComment(repositoryId, prNum, \"test2\")).thenReturn(new Comment().setBody(\"test2\"));\n\n\t\tGithubCommentManager manager = new GithubCommentManager(mockIssue, repositoryId, prNum);\n\n\t\tmanager.addComment(\"test2\");\n\... | {
"fields": [
{
"declarator": "logger = LoggerFactory.getLogger(GithubCommentManager.class)",
"modifier": "private static final",
"original_string": "private static final Logger logger = LoggerFactory.getLogger(GithubCommentManager.class);",
"type": "Logger",
"var_name": "logger"
... | {
"body": "public void addComment(String comment) throws IOException {\n\t\tissueService.createComment(repoId, issueNumber, comment);\n\t}",
"class_method_signature": "GithubCommentManager.addComment(String comment)",
"constructor": false,
"full_signature": "public void addComment(String comment)",
"identifie... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_13 | {
"fields": [
{
"declarator": "mapper = new DiffMapper()",
"modifier": "private",
"original_string": "private DiffMapper mapper = new DiffMapper();",
"type": "DiffMapper",
"var_name": "mapper"
}
],
"file": "cover-checker-core/src/test/java/com/naver/nid/cover/parser/diff/Diff... | {
"body": "@Test\n\tpublic void testSingleLineFix() {\n\t\tString testContent = \"@@ -1 +1 @@\\n-test\\n\\\\\\\\ No newline at end of file\\n+test1\\n\\\\\\\\ No newline at end of file\";\n\n\t\tDiff test = mapper.apply(RawDiff.builder().fileName(\"test\")\n\t\t\t\t.rawDiff(Arrays.asList(testContent.split(\"\\n\"))).... | {
"fields": [
{
"declarator": "DEFAULT = new DiffMapper()",
"modifier": "private static final",
"original_string": "private static final DiffMapper DEFAULT = new DiffMapper();",
"type": "DiffMapper",
"var_name": "DEFAULT"
},
{
"declarator": "NEW_FILE_COUNT_PATTERN = Pat... | {
"body": "@Override\n\tpublic Diff apply(RawDiff rawDiff) {\n\t\tDiff diff = new Diff();\n\n\t\t// set file name\n\t\tOptional<String> fileName = Optional.ofNullable(rawDiff.getFileName()).map(this::removeNewFilePrefix);\n\t\tlog.info(\"parse diff / {}\", fileName);\n\n\t\tif (!fileName.isPresent()) {\n\t\t\tlog.err... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_2 | {
"fields": [
{
"declarator": "mockPrService",
"modifier": "@Mock\n\tprivate",
"original_string": "@Mock\n\tprivate PullRequestService mockPrService;",
"type": "PullRequestService",
"var_name": "mockPrService"
}
],
"file": "cover-checker-github/src/test/java/com/naver/nid/cov... | {
"body": "@Test\n\tpublic void getFileDiff() throws IOException {\n\t\tRepositoryId repoId = new RepositoryId(\"test\", \"test\");\n\t\tGithubDiffManager githubDiffManager = new GithubDiffManager(mockPrService, repoId, 1);\n\t\tList<CommitFile> result = new Gson()\n\t\t\t\t.fromJson(new BufferedReader(new InputStrea... | {
"fields": [
{
"declarator": "prService",
"modifier": "private",
"original_string": "private PullRequestService prService;",
"type": "PullRequestService",
"var_name": "prService"
},
{
"declarator": "repoId",
"modifier": "private",
"original_string": "privat... | {
"body": "public List<CommitFile> getFiles() throws IOException {\n\t\tlog.info(\"get diff {}/{}\", repoId.generateId(), prNumber);\n\t\treturn prService.getFiles(repoId, prNumber);\n\t}",
"class_method_signature": "GithubDiffManager.getFiles()",
"constructor": false,
"full_signature": "public List<CommitFile>... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_3 | {
"fields": [
{
"declarator": "commitService",
"modifier": "private",
"original_string": "private CommitService commitService;",
"type": "CommitService",
"var_name": "commitService"
}
],
"file": "cover-checker-github/src/test/java/com/naver/nid/cover/github/manager/GithubStat... | {
"body": "@Test\n\tpublic void setStatus() throws IOException {\n\t\tCommitStatusCreate commitStatus = CommitStatusCreate.builder()\n\t\t\t\t.state(CommitState.SUCCESS)\n\t\t\t\t.description(\"0 / 0 (100%) - pass\")\n\t\t\t\t.context(\"coverchecker\").build();\n\t\tRepositoryId repoId = new RepositoryId(\"test\", \"... | {
"fields": [
{
"declarator": "commitService",
"modifier": "private final",
"original_string": "private final CommitService commitService;",
"type": "CommitService",
"var_name": "commitService"
},
{
"declarator": "repoId",
"modifier": "private",
"original_st... | {
"body": "public void setStatus(CommitStatusCreate status) {\n\t\tString url = String.format(\"/repos/%s/statuses/%s\", repoId.generateId(), sha);\n\t\ttry {\n\t\t\tcommitService.createStatus(repoId, sha, status.toCommitStatus());\n\t\t} catch (Exception e) {\n\t\t\tlog.warn(\"error while set status({}) {}\", url, s... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_12 | {
"fields": [
{
"declarator": "reporter = new ConsoleReporter()",
"modifier": "private",
"original_string": "private Reporter reporter = new ConsoleReporter();",
"type": "Reporter",
"var_name": "reporter"
},
{
"declarator": "diffParser",
"modifier": "@Mock\n\tpriv... | {
"body": "@Test\n\tpublic void testCheck() {\n\t\tCoverChecker coverChecker = Mockito.spy(new CoverChecker(coverageReportParser, diffParser, checker, reporter));\n\n\t\tList<Line> lines = Arrays.asList(\n\t\t\t\tLine.builder().lineNumber(1).type(ModifyType.ADD).build()\n\t\t\t\t, Line.builder().lineNumber(2).type(Mo... | {
"fields": [
{
"declarator": "coverageParser",
"modifier": "private final",
"original_string": "private final CoverageReportParser coverageParser;",
"type": "CoverageReportParser",
"var_name": "coverageParser"
},
{
"declarator": "diffParser",
"modifier": "private... | {
"body": "public boolean check(Parameter param) {\n\t\ttry {\n\t\t\tlog.info(\"Check new line of code coverage by {}\", coverageParser.getClass().getSimpleName());\n\t\t\tCompletableFuture<List<FileCoverageReport>> coverage = param.getCoveragePath().stream()\n\t\t\t\t.map(s -> executeByBackground((Function<String, L... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_8 | {
"fields": [],
"file": "cover-checker-console/src/test/java/com/naver/nid/cover/util/ObjectFactoryTest.java",
"identifier": "ObjectFactoryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void getNewCoverageParser() {\n NewCoverageChecker newCoverageParser = new ObjectFactory(Parameter.builder().build()).getNewCoverageParser();\n assertEquals(NewCoverageChecker.class, newCoverageParser.getClass());\n }",
"class_method_signature": "ObjectFactoryTest.getNewCovera... | {
"fields": [
{
"declarator": "param",
"modifier": "private final",
"original_string": "private final Parameter param;",
"type": "Parameter",
"var_name": "param"
}
],
"file": "cover-checker-console/src/main/java/com/naver/nid/cover/util/ObjectFactory.java",
"identifier": "O... | {
"body": "public NewCoverageChecker getNewCoverageParser() {\n return new NewCoverageChecker();\n }",
"class_method_signature": "ObjectFactory.getNewCoverageParser()",
"constructor": false,
"full_signature": "public NewCoverageChecker getNewCoverageParser()",
"identifier": "getNewCoverageParser",
... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_15 | {
"fields": [],
"file": "cover-checker-core/src/test/java/com/naver/nid/cover/checker/NewCoverageCheckerTest.java",
"identifier": "NewCoverageCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void coverCheckTest() {\n NewCoverageChecker checker = new NewCoverageChecker();\n\n List<Line> lines = Arrays.asList(\n Line.builder().lineNumber(1).type(ModifyType.ADD).build()\n , Line.builder().lineNumber(2).type(ModifyType.ADD).build());\n\... | {
"fields": [
{
"declarator": "logger = LoggerFactory.getLogger(NewCoverageChecker.class)",
"modifier": "private static final",
"original_string": "private static final Logger logger = LoggerFactory.getLogger(NewCoverageChecker.class);",
"type": "Logger",
"var_name": "logger"
}
... | {
"body": "public NewCoverageCheckReport check(List<FileCoverageReport> coverage, List<Diff> diff, int threshold, int fileThreshold) {\n\t\tMap<String, List<Line>> diffMap = diff.stream()\n\t\t\t\t.filter(Objects::nonNull)\n\t\t\t\t.peek(d -> logger.debug(\"diff file {}\", d.getFileName()))\n\t\t\t\t.filter(d -> !d.g... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_4 | {
"fields": [
{
"declarator": "COMMENT_WITH_FILE = \"#### [PR Coverage check]\\n\" +\n\t\t\t\"\\n\" +\n\t\t\t\":heart_eyes: **pass** : 2 / 3 (66.67%)\\n\" +\n\t\t\t\"\\n\" +\n\t\t\t\"\\n\" +\n\t\t\t\"\\n\\n\" +\n\t\t\t\"#### file detail\\n\" +\n\t\t\t\"\\n\" +\n\t\t\t\"| |path|covered line|new line|covera... | {
"body": "@Test\n\tpublic void reportTest() throws IOException {\n\t\tGithubPullRequestReporter reporter = new GithubPullRequestReporter(mockPrManager);\n\t\twhen(mockCommentManager.deleteComment(reporter.oldReport(mockUser))).thenReturn(1);\n\t\tdoNothing().when(mockCommentManager).addComment(COMMENT_WITH_FILE);\n\... | {
"fields": [
{
"declarator": "logger = LoggerFactory.getLogger(GithubPullRequestReporter.class)",
"modifier": "private static final",
"original_string": "private static final Logger logger = LoggerFactory.getLogger(GithubPullRequestReporter.class);",
"type": "Logger",
"var_name": "l... | {
"body": "@Override\n public void report(NewCoverageCheckReport result) {\n logger.debug(\"report {}\", result);\n\n\n String comment = getComment(result);\n CommitStatusCreate commitStatus = getCommitStatus(result);\n\n logger.debug(\"result comment {}\", comment);\n logger.deb... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_5 | {
"fields": [],
"file": "cover-checker-console/src/test/java/com/naver/nid/cover/util/ObjectFactoryTest.java",
"identifier": "ObjectFactoryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void getDiffParser() {\n String diffPath = getClass().getClassLoader().getResource(\"test_diff.diff\").getPath();\n assertEquals(FileDiffReader.class, new ObjectFactory(Parameter.builder().diffPath(diffPath).diffType(\"file\").build()).getDiffReader().getClass());\n }",
"class... | {
"fields": [
{
"declarator": "param",
"modifier": "private final",
"original_string": "private final Parameter param;",
"type": "Parameter",
"var_name": "param"
}
],
"file": "cover-checker-console/src/main/java/com/naver/nid/cover/util/ObjectFactory.java",
"identifier": "O... | {
"body": "public DiffParser getDiffReader() {\n if (\"file\".equals(param.getDiffType())) {\n return new FileDiffReader(param.getDiffPath());\n } else {\n return new GithubDiffReader(getPrManager());\n }\n }",
"class_method_signature": "ObjectFactory.getDiffReader()",
... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_14 | {
"fields": [
{
"declarator": "mapper = new DiffMapper()",
"modifier": "private",
"original_string": "private DiffMapper mapper = new DiffMapper();",
"type": "DiffMapper",
"var_name": "mapper"
}
],
"file": "cover-checker-core/src/test/java/com/naver/nid/cover/parser/diff/Diff... | {
"body": "@Test\n\tpublic void testNewSingleLine() {\n\t\tString testContent = \"@@ -0 +1 @@\\n+test1\\n\\\\\\\\ No newline at end of file\";\n\n\t\tDiff test = mapper.apply(RawDiff.builder().fileName(\"test\")\n\t\t\t\t.rawDiff(Arrays.asList(testContent.split(\"\\n\"))).build());\n\n\t\tassertEquals(1, test.getDiff... | {
"fields": [
{
"declarator": "DEFAULT = new DiffMapper()",
"modifier": "private static final",
"original_string": "private static final DiffMapper DEFAULT = new DiffMapper();",
"type": "DiffMapper",
"var_name": "DEFAULT"
},
{
"declarator": "NEW_FILE_COUNT_PATTERN = Pat... | {
"body": "@Override\n\tpublic Diff apply(RawDiff rawDiff) {\n\t\tDiff diff = new Diff();\n\n\t\t// set file name\n\t\tOptional<String> fileName = Optional.ofNullable(rawDiff.getFileName()).map(this::removeNewFilePrefix);\n\t\tlog.info(\"parse diff / {}\", fileName);\n\n\t\tif (!fileName.isPresent()) {\n\t\t\tlog.err... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
160304314_9 | {
"fields": [],
"file": "cover-checker-console/src/test/java/com/naver/nid/cover/util/ParameterParserTest.java",
"identifier": "ParameterParserTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void getParam() {\n\t\tString param = \"-c /path -c /path2 -d /path -t 50 -g github_token -r repo -p 3 -type cobertura --diff-type com.naver.nid.cover.github\";\n\t\tParameter parameter = new ParameterParser().getParam(param.split(\" \"));\n\t\tassertEquals(Arrays.asList(\"/path\", \"/path2... | {
"fields": [
{
"declarator": "logger = LoggerFactory.getLogger(ParameterParser.class)",
"modifier": "private static final",
"original_string": "private static final Logger logger = LoggerFactory.getLogger(ParameterParser.class);",
"type": "Logger",
"var_name": "logger"
},
{
... | {
"body": "public Parameter getParam(String... commandArgs) {\n\t\tOptions commandOptions = executeOption();\n\n\t\tCommandLineParser parser = new DefaultParser();\n\t\tHelpFormatter formatter = new HelpFormatter();\n\n\t\tCommandLine cmd;\n\t\ttry {\n\t\t\tcmd = parser.parse(commandOptions, commandArgs);\n\t\t} catc... | {
"created": null,
"fork": null,
"fork_count": 9,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 160304314,
"size": 202,
"stargazer_count": 38,
"stars": null,
"updates": null,
"url": "https://github.com/naver/cover-checker"
} |
7997879_82 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/GraphiteNamePatternTest.java",
"identifier": "GraphiteNamePatternTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void createNew_WHEN_ValidPattern_THEN_ShouldInitInternalPatternSuccessfully() {\n final Map<String, String> validPatterns = new HashMap<String, String>();\n validPatterns.put(\"org.test.controller.gather.status.400\", \"^\\\\Qorg.test.controller.gather.status.400\\\\E$\");\n... | {
"fields": [
{
"declarator": "VALIDATION_PATTERN = Pattern.compile(METRIC_GLOB_REGEX)",
"modifier": "private static final",
"original_string": "private static final Pattern VALIDATION_PATTERN = Pattern.compile(METRIC_GLOB_REGEX);",
"type": "Pattern",
"var_name": "VALIDATION_PATTERN"... | {
"body": "String getPatternString() {\n return this.patternStr;\n }",
"class_method_signature": "GraphiteNamePattern.getPatternString()",
"constructor": false,
"full_signature": " String getPatternString()",
"identifier": "getPatternString",
"invocations": [],
"modifiers": "",
"parameters": "... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_94 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/CustomMappingSampleBuilderTest.java",
"identifier": "CustomMappingSampleBuilderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_WHEN_MoreMatchesReverseOrder_THEN_ShouldReturnFirstOne() {\n final Map<String, String> labels = new HashMap<String, String>();\n labels.put(\"service\", \"${0}\");\n labels.put(\"status\", \"${1}\");\n final MapperConfig mapperConfig = new MapperConfi... | {
"fields": [
{
"declarator": "compiledMapperConfigs",
"modifier": "private final",
"original_string": "private final List<CompiledMapperConfig> compiledMapperConfigs;",
"type": "List<CompiledMapperConfig>",
"var_name": "compiledMapperConfigs"
},
{
"declarator": "defaul... | {
"body": "@Override\n public Collector.MetricFamilySamples.Sample createSample(final String dropwizardName, final String nameSuffix, final List<String> additionalLabelNames, final List<String> additionalLabelValues, final double value) {\n if (dropwizardName == null) {\n throw new IllegalArgumen... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_57 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "metric",
"modifier": "",
"original_string": "Gauge metric;",
"type": "Ga... | {
"body": "@Test\n public void testSetChildReturnsGauge() {\n Gauge g = metric.setChild(new Gauge.Child(){\n public double get() {\n return 42;\n }\n }, \"a\");\n }",
"class_method_signature": "SimpleCollectorTest.testSetChildReturnsGauge()",
"constructor": false,
"full_signature": "@Te... | {
"fields": [
{
"declarator": "fullname",
"modifier": "protected final",
"original_string": "protected final String fullname;",
"type": "String",
"var_name": "fullname"
},
{
"declarator": "help",
"modifier": "protected final",
"original_string": "protected f... | {
"body": "public <T extends Collector> T setChild(Child child, String... labelValues) {\n if (labelValues.length != labelNames.size()) {\n throw new IllegalArgumentException(\"Incorrect number of labels.\");\n }\n children.put(Arrays.asList(labelValues), child);\n return (T)this;\n }",
"class_met... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_7 | {
"fields": [
{
"declarator": "LABEL_NAMES = {\"unit\"}",
"modifier": "private static final",
"original_string": "private static final String[] LABEL_NAMES = {\"unit\"};",
"type": "String[]",
"var_name": "LABEL_NAMES"
},
{
"declarator": "expectedException = ExpectedExce... | {
"body": "@Test\n public void shouldFailIfNoQueueThreadPoolsAreRegistered() {\n expectedException.expect(IllegalStateException.class);\n expectedException.expectMessage(\"QueuedThreadPool\");\n\n new QueuedThreadPoolStatisticsCollector().register();\n }",
"class_method_signature": "QueuedThreadPoolStati... | {
"fields": [
{
"declarator": "LABEL_NAMES = Collections.singletonList(\"unit\")",
"modifier": "private static final",
"original_string": "private static final List<String> LABEL_NAMES = Collections.singletonList(\"unit\");",
"type": "List<String>",
"var_name": "LABEL_NAMES"
},
... | {
"body": "@Override\n public <T extends Collector> T register(CollectorRegistry registry) {\n if (queuedThreadPoolMap.isEmpty()) {\n throw new IllegalStateException(\"You must register at least one QueuedThreadPool.\");\n }\n return super.register(registry);\n }",
"class_method_signature": "QueuedT... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_16 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testPushWithGroupingKeyWithSlashes() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"PUT\")\n .withPath(\"/metrics/job@base64/YS9i/l/v/l2@base64/75-_Lw==\")\n ).respond(response().withStatusCode(202));\n groupingKey.put(\"l2... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void push(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"PUT\");\n }",
"class_method_signature": "PushGateway.push(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void push(CollectorRegistry registry... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_41 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "noLabels",
"modifier": "",
"original_string": "Counter noLabels, labels;",
... | {
"body": "@Test\n public void testLabels() {\n assertEquals(null, getLabelsValue(\"a\"));\n assertEquals(null, getLabelsValue(\"b\"));\n labels.labels(\"a\").inc();\n assertEquals(1.0, getLabelsValue(\"a\").doubleValue(), .001);\n assertEquals(null, getLabelsValue(\"b\"));\n labels.labels(\"b\").i... | {
"fields": [],
"file": "simpleclient/src/main/java/io/prometheus/client/Counter.java",
"identifier": "Counter",
"interfaces": "implements Collector.Describable",
"methods": [
{
"class_method_signature": "Counter.Counter(Builder b)",
"constructor": true,
"full_signature": " Counter(Buil... | {
"body": "public void inc() {\n inc(1);\n }",
"class_method_signature": "Counter.inc()",
"constructor": false,
"full_signature": "public void inc()",
"identifier": "inc",
"invocations": [
"inc"
],
"modifiers": "public",
"parameters": "()",
"return": "void",
"signature": "void inc()",
"t... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_36 | {
"fields": [],
"file": "simpleclient_servlet/src/test/java/io/prometheus/client/exporter/MetricsServletTest.java",
"identifier": "MetricsServletTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testWriterIsClosedNormally() throws IOException, ServletException {\n HttpServletRequest req = mock(HttpServletRequest.class);\n HttpServletResponse resp = mock(HttpServletResponse.class);\n PrintWriter writer = mock(PrintWriter.class);\n when(resp.getWriter()).thenReturn(w... | {
"fields": [
{
"declarator": "registry",
"modifier": "private",
"original_string": "private CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient_servlet/src/main/java/io/prometheus/client/exporter/MetricsServlet.java",
... | {
"body": "@Override\n protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)\n throws ServletException, IOException {\n resp.setStatus(HttpServletResponse.SC_OK);\n resp.setContentType(TextFormat.CONTENT_TYPE_004);\n\n Writer writer = new BufferedWriter(resp.getWriter()... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_61 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient/src/test/java/io/prometheus/client/CollectorRegistryTest.java",
"identifier": "Collecto... | {
"body": "@Test\n public void testEmptyRegistryHasNoMoreElements() {\n assertFalse(registry.metricFamilySamples().hasMoreElements());\n }",
"class_method_signature": "CollectorRegistryTest.testEmptyRegistryHasNoMoreElements()",
"constructor": false,
"full_signature": "@Test public void testEmptyRegistryHa... | {
"fields": [
{
"declarator": "defaultRegistry = new CollectorRegistry(true)",
"modifier": "public static final",
"original_string": "public static final CollectorRegistry defaultRegistry = new CollectorRegistry(true);",
"type": "CollectorRegistry",
"var_name": "defaultRegistry"
... | {
"body": "public Enumeration<Collector.MetricFamilySamples> metricFamilySamples() {\n return new MetricFamilySamplesEnumeration();\n }",
"class_method_signature": "CollectorRegistry.metricFamilySamples()",
"constructor": false,
"full_signature": "public Enumeration<Collector.MetricFamilySamples> metricFami... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_98 | {
"fields": [],
"file": "simpleclient_graphite_bridge/src/test/java/io/prometheus/client/bridge/GraphiteTest.java",
"identifier": "GraphiteTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testPush() throws Exception {\n // Create a metric.\n CollectorRegistry registry = new CollectorRegistry();\n Gauge labels = Gauge.build().name(\"labels\").help(\"help\").labelNames(\"l\").register(registry);\n labels.labels(\"fo*o\").inc();\n\n\n // Server to accept pus... | {
"fields": [
{
"declarator": "logger = Logger.getLogger(Graphite.class.getName())",
"modifier": "private static final",
"original_string": "private static final Logger logger = Logger.getLogger(Graphite.class.getName());",
"type": "Logger",
"var_name": "logger"
},
{
"d... | {
"body": "public void push(CollectorRegistry registry) throws IOException {\n Socket s = new Socket(host, port);\n BufferedWriter writer = new BufferedWriter(new PrintWriter(new OutputStreamWriter(s.getOutputStream(), Charset.forName(\"UTF-8\"))));\n Matcher m = INVALID_GRAPHITE_CHARS.matcher(\"\");\n lo... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_77 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "noLabels",
"modifier": "",
"original_string": "Gauge noLabels, labels;",
... | {
"body": "@Test\n public void testCollect() {\n labels.labels(\"a\").inc();\n List<Collector.MetricFamilySamples> mfs = labels.collect();\n\n ArrayList<Collector.MetricFamilySamples.Sample> samples = new ArrayList<Collector.MetricFamilySamples.Sample>();\n ArrayList<String> labelNames = new ArrayList<St... | {
"fields": [],
"file": "simpleclient/src/main/java/io/prometheus/client/Gauge.java",
"identifier": "Gauge",
"interfaces": "implements Collector.Describable",
"methods": [
{
"class_method_signature": "Gauge.Gauge(Builder b)",
"constructor": true,
"full_signature": " Gauge(Builder b)",
... | {
"body": "@Override\n public List<MetricFamilySamples> collect() {\n List<MetricFamilySamples.Sample> samples = new ArrayList<MetricFamilySamples.Sample>(children.size());\n for(Map.Entry<List<String>, Child> c: children.entrySet()) {\n samples.add(new MetricFamilySamples.Sample(fullname, labelNames, c.g... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_20 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testPushAddWithGroupingKey() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"POST\")\n .withPath(\"/metrics/job/j/l/v\")\n ).respond(response().withStatusCode(202));\n pg.pushAdd(registry, \"j\", groupingKey);\n }",
"clas... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void pushAdd(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"POST\");\n }",
"class_method_signature": "PushGateway.pushAdd(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void pushAdd(CollectorRegistr... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_102 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "writer",
"modifier": "",
"original_string": "StringWriter writer;",
"typ... | {
"body": "@Test\n public void testMetricOutputWithTimestamp() throws IOException {\n\n class CustomCollector extends Collector {\n public List<MetricFamilySamples> collect() {\n List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>();\n ArrayList<String> labelNames = new ArrayList... | {
"fields": [
{
"declarator": "CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\"",
"modifier": "public final static",
"original_string": "public final static String CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\";",
"type": "String",
"var_name": "CONTENT... | {
"body": "public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException {\n /* See http://prometheus.io/docs/instrumenting/exposition_formats/\n * for the output format specification. */\n while(mfs.hasMoreElements()) {\n Collector.MetricFamilySamples me... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_114 | {
"fields": [],
"file": "simpleclient_guava/src/test/java/io/prometheus/client/guava/cache/CacheMetricsCollectorTest.java",
"identifier": "CacheMetricsCollectorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void cacheExposesMetricsForHitMissAndEviction() throws Exception {\n Cache<String, String> cache = CacheBuilder.newBuilder().maximumSize(2).recordStats().build();\n CollectorRegistry registry = new CollectorRegistry();\n\n CacheMetricsCollector collector = new CacheMe... | {
"fields": [
{
"declarator": "children = new ConcurrentHashMap<String, Cache>()",
"modifier": "protected final",
"original_string": "protected final ConcurrentMap<String, Cache> children = new ConcurrentHashMap<String, Cache>();",
"type": "ConcurrentMap<String, Cache>",
"var_name": ... | {
"body": "public void addCache(String cacheName, Cache cache) {\n children.put(cacheName, cache);\n }",
"class_method_signature": "CacheMetricsCollector.addCache(String cacheName, Cache cache)",
"constructor": false,
"full_signature": "public void addCache(String cacheName, Cache cache)",
"identifi... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_115 | {
"fields": [],
"file": "simpleclient_guava/src/test/java/io/prometheus/client/guava/cache/CacheMetricsCollectorTest.java",
"identifier": "CacheMetricsCollectorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@SuppressWarnings(\"unchecked\")\n @Test\n public void loadingCacheExposesMetricsForLoadsAndExceptions() throws Exception {\n CacheLoader<String, String> loader = mock(CacheLoader.class);\n when(loader.load(anyString()))\n .thenReturn(\"First User\")\n .the... | {
"fields": [
{
"declarator": "children = new ConcurrentHashMap<String, Cache>()",
"modifier": "protected final",
"original_string": "protected final ConcurrentMap<String, Cache> children = new ConcurrentHashMap<String, Cache>();",
"type": "ConcurrentMap<String, Cache>",
"var_name": ... | {
"body": "public void addCache(String cacheName, Cache cache) {\n children.put(cacheName, cache);\n }",
"class_method_signature": "CacheMetricsCollector.addCache(String cacheName, Cache cache)",
"constructor": false,
"full_signature": "public void addCache(String cacheName, Cache cache)",
"identifi... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_103 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "writer",
"modifier": "",
"original_string": "StringWriter writer;",
"typ... | {
"body": "@Test\n public void testSummaryOutput() throws IOException {\n Summary noLabels = Summary.build().name(\"nolabels\").help(\"help\").register(registry);\n noLabels.observe(2);\n TextFormat.write004(writer, registry.metricFamilySamples());\n assertEquals(\"# HELP nolabels help\\n\"\n ... | {
"fields": [
{
"declarator": "CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\"",
"modifier": "public final static",
"original_string": "public final static String CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\";",
"type": "String",
"var_name": "CONTENT... | {
"body": "public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException {\n /* See http://prometheus.io/docs/instrumenting/exposition_formats/\n * for the output format specification. */\n while(mfs.hasMoreElements()) {\n Collector.MetricFamilySamples me... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_21 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testPushAddCollectorWithGroupingKey() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"POST\")\n .withPath(\"/metrics/job/j/l/v\")\n ).respond(response().withStatusCode(202));\n pg.pushAdd(gauge, \"j\", groupingKey);\n }",
... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void pushAdd(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"POST\");\n }",
"class_method_signature": "PushGateway.pushAdd(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void pushAdd(CollectorRegistr... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_99 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "writer",
"modifier": "",
"original_string": "StringWriter writer;",
"typ... | {
"body": "@Test\n public void testGaugeOutput() throws IOException {\n Gauge noLabels = Gauge.build().name(\"nolabels\").help(\"help\").register(registry);\n noLabels.inc();\n TextFormat.write004(writer, registry.metricFamilySamples());\n assertEquals(\"# HELP nolabels help\\n\"\n + \"# ... | {
"fields": [
{
"declarator": "CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\"",
"modifier": "public final static",
"original_string": "public final static String CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\";",
"type": "String",
"var_name": "CONTENT... | {
"body": "public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException {\n /* See http://prometheus.io/docs/instrumenting/exposition_formats/\n * for the output format specification. */\n while(mfs.hasMoreElements()) {\n Collector.MetricFamilySamples me... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_76 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "noLabels",
"modifier": "",
"original_string": "Gauge noLabels, labels;",
... | {
"body": "@Test\n public void testLabels() {\n assertEquals(null, getLabelsValue(\"a\"));\n assertEquals(null, getLabelsValue(\"b\"));\n labels.labels(\"a\").inc();\n assertEquals(1.0, getLabelsValue(\"a\").doubleValue(), .001);\n assertEquals(null, getLabelsValue(\"b\"));\n labels.labels(\"b\").i... | {
"fields": [],
"file": "simpleclient/src/main/java/io/prometheus/client/Gauge.java",
"identifier": "Gauge",
"interfaces": "implements Collector.Describable",
"methods": [
{
"class_method_signature": "Gauge.Gauge(Builder b)",
"constructor": true,
"full_signature": " Gauge(Builder b)",
... | {
"body": "public void inc() {\n inc(1);\n }",
"class_method_signature": "Gauge.inc()",
"constructor": false,
"full_signature": "public void inc()",
"identifier": "inc",
"invocations": [
"inc"
],
"modifiers": "public",
"parameters": "()",
"return": "void",
"signature": "void inc()",
"tes... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_60 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient/src/test/java/io/prometheus/client/CollectorRegistryTest.java",
"identifier": "Collecto... | {
"body": "@Test\n public void testMetricFamilySamples() {\n Collector g = Gauge.build().name(\"g\").help(\"h\").register(registry);\n Collector c = Counter.build().name(\"c\").help(\"h\").register(registry);\n Collector s = Summary.build().name(\"s\").help(\"h\").register(registry);\n Collector ec = new... | {
"fields": [
{
"declarator": "defaultRegistry = new CollectorRegistry(true)",
"modifier": "public static final",
"original_string": "public static final CollectorRegistry defaultRegistry = new CollectorRegistry(true);",
"type": "CollectorRegistry",
"var_name": "defaultRegistry"
... | {
"body": "public Enumeration<Collector.MetricFamilySamples> metricFamilySamples() {\n return new MetricFamilySamplesEnumeration();\n }",
"class_method_signature": "CollectorRegistry.metricFamilySamples()",
"constructor": false,
"full_signature": "public Enumeration<Collector.MetricFamilySamples> metricFami... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_37 | {
"fields": [],
"file": "simpleclient_servlet/src/test/java/io/prometheus/client/exporter/MetricsServletTest.java",
"identifier": "MetricsServletTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testWriterIsClosedOnException() throws IOException, ServletException {\n HttpServletRequest req = mock(HttpServletRequest.class);\n HttpServletResponse resp = mock(HttpServletResponse.class);\n PrintWriter writer = mock(PrintWriter.class);\n when(resp.getWriter()).thenRetur... | {
"fields": [
{
"declarator": "registry",
"modifier": "private",
"original_string": "private CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient_servlet/src/main/java/io/prometheus/client/exporter/MetricsServlet.java",
... | {
"body": "@Override\n protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)\n throws ServletException, IOException {\n resp.setStatus(HttpServletResponse.SC_OK);\n resp.setContentType(TextFormat.CONTENT_TYPE_004);\n\n Writer writer = new BufferedWriter(resp.getWriter()... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_40 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "noLabels",
"modifier": "",
"original_string": "Counter noLabels, labels;",
... | {
"body": "@Test\n public void testNegativeIncrementFails() {\n thrown.expect(IllegalArgumentException.class);\n thrown.expectMessage(\"Amount to increment must be non-negative.\");\n noLabels.inc(-1);\n }",
"class_method_signature": "CounterTest.testNegativeIncrementFails()",
"constructor": false,
"... | {
"fields": [],
"file": "simpleclient/src/main/java/io/prometheus/client/Counter.java",
"identifier": "Counter",
"interfaces": "implements Collector.Describable",
"methods": [
{
"class_method_signature": "Counter.Counter(Builder b)",
"constructor": true,
"full_signature": " Counter(Buil... | {
"body": "public void inc() {\n inc(1);\n }",
"class_method_signature": "Counter.inc()",
"constructor": false,
"full_signature": "public void inc()",
"identifier": "inc",
"invocations": [
"inc"
],
"modifiers": "public",
"parameters": "()",
"return": "void",
"signature": "void inc()",
"t... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_17 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testPushCollectorWithGroupingKey() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"PUT\")\n .withPath(\"/metrics/job/j/l/v\")\n ).respond(response().withStatusCode(202));\n pg.push(gauge, \"j\", groupingKey);\n }",
"class... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void push(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"PUT\");\n }",
"class_method_signature": "PushGateway.push(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void push(CollectorRegistry registry... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_6 | {
"fields": [
{
"declarator": "LABEL_NAMES = {\"unit\"}",
"modifier": "private static final",
"original_string": "private static final String[] LABEL_NAMES = {\"unit\"};",
"type": "String[]",
"var_name": "LABEL_NAMES"
},
{
"declarator": "expectedException = ExpectedExce... | {
"body": "@Test\n public void metricsGathered() throws Exception {\n String unit = \"queue1\";\n String[] labelValues = {unit};\n new QueuedThreadPoolStatisticsCollector(queuedThreadPool, unit).register();\n\n server.start();\n\n assertTrue(\n CollectorRegistry.defaultRegistry.getSampleValue(\... | {
"fields": [
{
"declarator": "LABEL_NAMES = Collections.singletonList(\"unit\")",
"modifier": "private static final",
"original_string": "private static final List<String> LABEL_NAMES = Collections.singletonList(\"unit\");",
"type": "List<String>",
"var_name": "LABEL_NAMES"
},
... | {
"body": "@Override\n public <T extends Collector> T register(CollectorRegistry registry) {\n if (queuedThreadPoolMap.isEmpty()) {\n throw new IllegalStateException(\"You must register at least one QueuedThreadPool.\");\n }\n return super.register(registry);\n }",
"class_method_signature": "QueuedT... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_56 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "metric",
"modifier": "",
"original_string": "Gauge metric;",
"type": "Ga... | {
"body": "@Test\n public void testSetChild() {\n metric.setChild(new Gauge.Child(){\n public double get() {\n return 42;\n }\n }, \"a\");\n assertEquals(42.0, getValue(\"a\").doubleValue(), .001);\n }",
"class_method_signature": "SimpleCollectorTest.testSetChild()",
"constructor": fal... | {
"fields": [
{
"declarator": "fullname",
"modifier": "protected final",
"original_string": "protected final String fullname;",
"type": "String",
"var_name": "fullname"
},
{
"declarator": "help",
"modifier": "protected final",
"original_string": "protected f... | {
"body": "public <T extends Collector> T setChild(Child child, String... labelValues) {\n if (labelValues.length != labelNames.size()) {\n throw new IllegalArgumentException(\"Incorrect number of labels.\");\n }\n children.put(Arrays.asList(labelValues), child);\n return (T)this;\n }",
"class_met... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_95 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/CustomMappingSampleBuilderTest.java",
"identifier": "CustomMappingSampleBuilderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_WHEN_MoreToFormatInLabelsAndName_THEN_ShouldReturnCorrectSample() {\n final Map<String, String> labels = new HashMap<String, String>();\n labels.put(\"service\", \"${0}_${1}\");\n labels.put(\"status\", \"s_${1}\");\n final MapperConfig mapperConfig =... | {
"fields": [
{
"declarator": "compiledMapperConfigs",
"modifier": "private final",
"original_string": "private final List<CompiledMapperConfig> compiledMapperConfigs;",
"type": "List<CompiledMapperConfig>",
"var_name": "compiledMapperConfigs"
},
{
"declarator": "defaul... | {
"body": "@Override\n public Collector.MetricFamilySamples.Sample createSample(final String dropwizardName, final String nameSuffix, final List<String> additionalLabelNames, final List<String> additionalLabelValues, final double value) {\n if (dropwizardName == null) {\n throw new IllegalArgumen... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_83 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/GraphiteNamePatternTest.java",
"identifier": "GraphiteNamePatternTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void extractParameters() {\n GraphiteNamePattern pattern;\n Map<String, String> expected = new HashMap<String, String>();\n expected.put(\"${0}\", \"gather\");\n expected.put(\"${1}\", \"400\");\n pattern = new GraphiteNamePattern(\"org.test.controller.*... | {
"fields": [
{
"declarator": "VALIDATION_PATTERN = Pattern.compile(METRIC_GLOB_REGEX)",
"modifier": "private static final",
"original_string": "private static final Pattern VALIDATION_PATTERN = Pattern.compile(METRIC_GLOB_REGEX);",
"type": "Pattern",
"var_name": "VALIDATION_PATTERN"... | {
"body": "Map<String, String> extractParameters(final String metricName) {\n final Matcher matcher = this.pattern.matcher(metricName);\n final Map<String, String> params = new HashMap<String, String>();\n if (matcher.find()) {\n for (int i = 1; i <= matcher.groupCount(); i++) {\n ... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_30 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testOldPushAddCollector() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"POST\")\n .withPath(\"/metrics/job/j/instance/i\")\n ).respond(response().withStatusCode(202));\n pg.pushAdd(gauge, \"j\", \"i\");\n }",
"class_met... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void pushAdd(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"POST\");\n }",
"class_method_signature": "PushGateway.pushAdd(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void pushAdd(CollectorRegistr... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_88 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/MapperConfigTest.java",
"identifier": "MapperConfigTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void toString_WHEN_EmptyConfig_AllGood() {\n final MapperConfig mapperConfig = new MapperConfig();\n assertEquals(\"MapperConfig{match=null, name=null, labels={}}\", mapperConfig.toString());\n }",
"class_method_signature": "MapperConfigTest.toString_WHEN_EmptyConfig_Al... | {
"fields": [
{
"declarator": "METRIC_PART_REGEX = \"[a-zA-Z_0-9](-?[a-zA-Z0-9_])+\"",
"modifier": "private static final",
"original_string": "private static final String METRIC_PART_REGEX = \"[a-zA-Z_0-9](-?[a-zA-Z0-9_])+\";",
"type": "String",
"var_name": "METRIC_PART_REGEX"
},... | {
"body": "@Override\n public String toString() {\n return String.format(\"MapperConfig{match=%s, name=%s, labels=%s}\", match, name, labels);\n }",
"class_method_signature": "MapperConfig.toString()",
"constructor": false,
"full_signature": "@Override public String toString()",
"identifier": "to... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_67 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient/src/test/java/io/prometheus/client/CollectorRegistryTest.java",
"identifier": "Collecto... | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void testAutoDescribeThrowsOnReregisteringCustomCollector() {\n CollectorRegistry r = new CollectorRegistry(true);\n new MyCollector().register(r);\n new MyCollector().register(r);\n }",
"class_method_signature": "CollectorRegistryTest.... | {
"fields": [
{
"declarator": "defaultRegistry = new CollectorRegistry(true)",
"modifier": "public static final",
"original_string": "public static final CollectorRegistry defaultRegistry = new CollectorRegistry(true);",
"type": "CollectorRegistry",
"var_name": "defaultRegistry"
... | {
"body": "public void register(Collector m) {\n List<String> names = collectorNames(m);\n synchronized (namesCollectorsLock) {\n for (String name : names) {\n if (namesToCollectors.containsKey(name)) {\n throw new IllegalArgumentException(\"Collector already registered that provides name: ... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_71 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient/src/test/java/io/prometheus/client/CounterMetricFamilyTest.java",
"identifier": "Counte... | {
"body": "@Test\n public void testJavadocExample() {\n class YourCustomCollector extends Collector {\n public List<MetricFamilySamples> collect() {\n List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>();\n // With no labels.\n mfs.add(new CounterMetricFamily(\"my_counter... | {
"fields": [
{
"declarator": "labelNames",
"modifier": "private final",
"original_string": "private final List<String> labelNames;",
"type": "List<String>",
"var_name": "labelNames"
}
],
"file": "simpleclient/src/main/java/io/prometheus/client/CounterMetricFamily.java",
"i... | {
"body": "public CounterMetricFamily addMetric(List<String> labelValues, double value) {\n if (labelValues.size() != labelNames.size()) {\n throw new IllegalArgumentException(\"Incorrect number of labels.\");\n }\n samples.add(new Sample(name, labelNames, labelValues, value));\n return this;\n }",
... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_26 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testOldNon202ResponseThrows() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"PUT\")\n .withPath(\"/metrics/job/j/instance/i\")\n ).respond(response().withStatusCode(500));\n thrown.expect(IOException.class);\n thrown.exp... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void push(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"PUT\");\n }",
"class_method_signature": "PushGateway.push(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void push(CollectorRegistry registry... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_104 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "writer",
"modifier": "",
"original_string": "StringWriter writer;",
"typ... | {
"body": "@Test\n public void testSummaryOutputWithQuantiles() throws IOException {\n Summary labelsAndQuantiles = Summary.build()\n .quantile(0.5, 0.05).quantile(0.9, 0.01).quantile(0.99, 0.001)\n .labelNames(\"l\").name(\"labelsAndQuantiles\").help(\"help\").register(registry);\n label... | {
"fields": [
{
"declarator": "CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\"",
"modifier": "public final static",
"original_string": "public final static String CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\";",
"type": "String",
"var_name": "CONTENT... | {
"body": "public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException {\n /* See http://prometheus.io/docs/instrumenting/exposition_formats/\n * for the output format specification. */\n while(mfs.hasMoreElements()) {\n Collector.MetricFamilySamples me... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_112 | {
"fields": [
{
"declarator": "mockGcBean1 = Mockito.mock(GarbageCollectorMXBean.class)",
"modifier": "private",
"original_string": "private GarbageCollectorMXBean mockGcBean1 = Mockito.mock(GarbageCollectorMXBean.class);",
"type": "GarbageCollectorMXBean",
"var_name": "mockGcBean1"
... | {
"body": "@Test\n public void testGarbageCollectorExports() {\n assertEquals(\n 100L,\n registry.getSampleValue(\n \"jvm_gc_collection_seconds_count\",\n new String[]{\"gc\"},\n new String[]{\"MyGC1\"}),\n .0000001);\n assertEquals(\n 10d,\n ... | {
"fields": [
{
"declarator": "garbageCollectors",
"modifier": "private final",
"original_string": "private final List<GarbageCollectorMXBean> garbageCollectors;",
"type": "List<GarbageCollectorMXBean>",
"var_name": "garbageCollectors"
}
],
"file": "simpleclient_hotspot/src/m... | {
"body": "public GarbageCollectorExports() {\n this(ManagementFactory.getGarbageCollectorMXBeans());\n }",
"class_method_signature": "GarbageCollectorExports.GarbageCollectorExports()",
"constructor": true,
"full_signature": "public GarbageCollectorExports()",
"identifier": "GarbageCollectorExports",
... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_84 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/GraphiteNamePatternTest.java",
"identifier": "GraphiteNamePatternTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void extractParameters_WHEN_emptyStringInDottedMetricsName_THEN_ShouldReturnEmptyString() {\n GraphiteNamePattern pattern;\n Map<String, String> expected = new HashMap<String, String>();\n expected.put(\"${0}\", \"\");\n expected.put(\"${1}\", \"400\");\n ... | {
"fields": [
{
"declarator": "VALIDATION_PATTERN = Pattern.compile(METRIC_GLOB_REGEX)",
"modifier": "private static final",
"original_string": "private static final Pattern VALIDATION_PATTERN = Pattern.compile(METRIC_GLOB_REGEX);",
"type": "Pattern",
"var_name": "VALIDATION_PATTERN"... | {
"body": "Map<String, String> extractParameters(final String metricName) {\n final Matcher matcher = this.pattern.matcher(metricName);\n final Map<String, String> params = new HashMap<String, String>();\n if (matcher.find()) {\n for (int i = 1; i <= matcher.groupCount(); i++) {\n ... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_92 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/CustomMappingSampleBuilderTest.java",
"identifier": "CustomMappingSampleBuilderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_WHEN_OneMatch_THEN_ShouldReturnConverted() {\n final Map<String, String> labels = new HashMap<String, String>();\n labels.put(\"service\", \"${0}\");\n final MapperConfig mapperConfig = new MapperConfig(\n \"app.okhttpclient.client.HttpClient.... | {
"fields": [
{
"declarator": "compiledMapperConfigs",
"modifier": "private final",
"original_string": "private final List<CompiledMapperConfig> compiledMapperConfigs;",
"type": "List<CompiledMapperConfig>",
"var_name": "compiledMapperConfigs"
},
{
"declarator": "defaul... | {
"body": "@Override\n public Collector.MetricFamilySamples.Sample createSample(final String dropwizardName, final String nameSuffix, final List<String> additionalLabelNames, final List<String> additionalLabelValues, final double value) {\n if (dropwizardName == null) {\n throw new IllegalArgumen... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_51 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "metric",
"modifier": "",
"original_string": "Gauge metric;",
"type": "Ga... | {
"body": "@Test\n public void testTooManyLabelsThrows() {\n thrown.expect(IllegalArgumentException.class);\n thrown.expectMessage(\"Incorrect number of labels.\");\n metric.labels(\"a\", \"b\");\n }",
"class_method_signature": "SimpleCollectorTest.testTooManyLabelsThrows()",
"constructor": false,
"f... | {
"fields": [
{
"declarator": "fullname",
"modifier": "protected final",
"original_string": "protected final String fullname;",
"type": "String",
"var_name": "fullname"
},
{
"declarator": "help",
"modifier": "protected final",
"original_string": "protected f... | {
"body": "public Child labels(String... labelValues) {\n if (labelValues.length != labelNames.size()) {\n throw new IllegalArgumentException(\"Incorrect number of labels.\");\n }\n for (String label: labelValues) {\n if (label == null) {\n throw new IllegalArgumentException(\"Label cannot b... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_108 | {
"fields": [
{
"declarator": "server = new Server()",
"modifier": "private final",
"original_string": "private final Server server = new Server();",
"type": "Server",
"var_name": "server"
},
{
"declarator": "connector = new ServerConnector(server)",
"modifier": "... | {
"body": "@Test\n public void collect() throws Exception {\n // send GET request\n try {\n final String spec = \"http://127.0.0.1:\" + connector.getLocalPort();\n final HttpURLConnection urlConnection = (HttpURLConnection) new URL(spec).openConnection();\n urlConnection.getInputStream().close()... | {
"fields": [
{
"declarator": "statisticsHandler",
"modifier": "private final",
"original_string": "private final StatisticsHandler statisticsHandler;",
"type": "StatisticsHandler",
"var_name": "statisticsHandler"
},
{
"declarator": "EMPTY_LIST = new ArrayList<String>()... | {
"body": "@Override\n public List<MetricFamilySamples> collect() {\n return Arrays.asList(\n buildCounter(\"jetty_requests_total\", \"Number of requests\", statisticsHandler.getRequests()),\n buildGauge(\"jetty_requests_active\", \"Number of requests currently active\", statisticsHandler.ge... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_1 | {
"fields": [
{
"declarator": "appender",
"modifier": "private",
"original_string": "private InstrumentedAppender appender;",
"type": "InstrumentedAppender",
"var_name": "appender"
},
{
"declarator": "event",
"modifier": "private",
"original_string": "privat... | {
"body": "@Test\n public void metersDebugEvents() throws Exception {\n when(event.getLevel()).thenReturn(DEBUG);\n\n appender.append(event);\n\n assertEquals(1, getLogLevelCount(\"debug\"));\n }",
"class_method_signature": "InstrumentedAppenderTest.metersDebugEvents()",
"constructor": ... | {
"fields": [
{
"declarator": "COUNTER_NAME = \"log4j2_appender_total\"",
"modifier": "public static final",
"original_string": "public static final String COUNTER_NAME = \"log4j2_appender_total\";",
"type": "String",
"var_name": "COUNTER_NAME"
},
{
"declarator": "COUNT... | {
"body": "@Override\n public void append(LogEvent event) {\n Level level = event.getLevel();\n if (TRACE.equals(level)) TRACE_LABEL.inc();\n else if (DEBUG.equals(level)) DEBUG_LABEL.inc();\n else if (INFO.equals(level)) INFO_LABEL.inc();\n else if (WARN.equals(level)) WARN_LABE... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_10 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testPush200Response() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"PUT\")\n .withPath(\"/metrics/job/j\")\n ).respond(response().withStatusCode(200));\n pg.push(registry, \"j\");\n }",
"class_method_signature": "PushGa... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void push(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"PUT\");\n }",
"class_method_signature": "PushGateway.push(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void push(CollectorRegistry registry... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_47 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "noLabels",
"modifier": "",
"original_string": "Histogram noLabels, labels;",
... | {
"body": "@Test\n public void testLeLabelThrows() {\n thrown.expect(IllegalStateException.class);\n thrown.expectMessage(\"Histogram cannot have a label named 'le'.\");\n Histogram.build().name(\"labels\").help(\"help\").labelNames(\"le\").create();\n }",
"class_method_signature": "HistogramTest.testLeL... | {
"fields": [
{
"declarator": "buckets",
"modifier": "private final",
"original_string": "private final double[] buckets;",
"type": "double[]",
"var_name": "buckets"
}
],
"file": "simpleclient/src/main/java/io/prometheus/client/Histogram.java",
"identifier": "Histogram",
... | {
"body": "public static Builder build(String name, String help) {\n return new Builder().name(name).help(help);\n }",
"class_method_signature": "Histogram.build(String name, String help)",
"constructor": false,
"full_signature": "public static Builder build(String name, String help)",
"identifier": "buil... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_46 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "noLabels",
"modifier": "",
"original_string": "Histogram noLabels, labels;",
... | {
"body": "@Test\n public void testLabels() {\n assertEquals(null, getLabelsCount(\"a\"));\n assertEquals(null, getLabelsSum(\"a\"));\n assertEquals(null, getLabelsCount(\"b\"));\n assertEquals(null, getLabelsSum(\"b\"));\n labels.labels(\"a\").observe(2);\n assertEquals(1.0, getLabelsCount(\"a\").... | {
"fields": [
{
"declarator": "buckets",
"modifier": "private final",
"original_string": "private final double[] buckets;",
"type": "double[]",
"var_name": "buckets"
}
],
"file": "simpleclient/src/main/java/io/prometheus/client/Histogram.java",
"identifier": "Histogram",
... | {
"body": "public void observe(double amt) {\n noLabelsChild.observe(amt);\n }",
"class_method_signature": "Histogram.observe(double amt)",
"constructor": false,
"full_signature": "public void observe(double amt)",
"identifier": "observe",
"invocations": [
"observe"
],
"modifiers": "public",
"... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_11 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testNon202ResponseThrows() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"PUT\")\n .withPath(\"/metrics/job/j\")\n ).respond(response().withStatusCode(500));\n thrown.expect(IOException.class);\n thrown.expectMessage(\n ... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void push(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"PUT\");\n }",
"class_method_signature": "PushGateway.push(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void push(CollectorRegistry registry... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_0 | {
"fields": [
{
"declarator": "appender",
"modifier": "private",
"original_string": "private InstrumentedAppender appender;",
"type": "InstrumentedAppender",
"var_name": "appender"
},
{
"declarator": "event",
"modifier": "private",
"original_string": "privat... | {
"body": "@Test\n public void metersTraceEvents() throws Exception {\n when(event.getLevel()).thenReturn(TRACE);\n\n appender.append(event);\n\n assertEquals(1, getLogLevelCount(\"trace\"));\n }",
"class_method_signature": "InstrumentedAppenderTest.metersTraceEvents()",
"constructor": ... | {
"fields": [
{
"declarator": "COUNTER_NAME = \"log4j2_appender_total\"",
"modifier": "public static final",
"original_string": "public static final String COUNTER_NAME = \"log4j2_appender_total\";",
"type": "String",
"var_name": "COUNTER_NAME"
},
{
"declarator": "COUNT... | {
"body": "@Override\n public void append(LogEvent event) {\n Level level = event.getLevel();\n if (TRACE.equals(level)) TRACE_LABEL.inc();\n else if (DEBUG.equals(level)) DEBUG_LABEL.inc();\n else if (INFO.equals(level)) INFO_LABEL.inc();\n else if (WARN.equals(level)) WARN_LABE... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_50 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "metric",
"modifier": "",
"original_string": "Gauge metric;",
"type": "Ga... | {
"body": "@Test\n public void testNullLabelThrows() {\n thrown.expect(IllegalArgumentException.class);\n thrown.expectMessage(\"Label cannot be null.\");\n metric.labels(new String[]{null});\n }",
"class_method_signature": "SimpleCollectorTest.testNullLabelThrows()",
"constructor": false,
"full_sign... | {
"fields": [
{
"declarator": "fullname",
"modifier": "protected final",
"original_string": "protected final String fullname;",
"type": "String",
"var_name": "fullname"
},
{
"declarator": "help",
"modifier": "protected final",
"original_string": "protected f... | {
"body": "public Child labels(String... labelValues) {\n if (labelValues.length != labelNames.size()) {\n throw new IllegalArgumentException(\"Incorrect number of labels.\");\n }\n for (String label: labelValues) {\n if (label == null) {\n throw new IllegalArgumentException(\"Label cannot b... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_109 | {
"fields": [],
"file": "simpleclient_caffeine/src/test/java/io/prometheus/client/cache/caffeine/CacheMetricsCollectorTest.java",
"identifier": "CacheMetricsCollectorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void cacheExposesMetricsForHitMissAndEviction() throws Exception {\n Cache<String, String> cache = Caffeine.newBuilder().maximumSize(2).recordStats().executor(new Executor() {\n @Override\n public void execute(Runnable command) {\n // Run cleanu... | {
"fields": [
{
"declarator": "children = new ConcurrentHashMap<String, Cache>()",
"modifier": "protected final",
"original_string": "protected final ConcurrentMap<String, Cache> children = new ConcurrentHashMap<String, Cache>();",
"type": "ConcurrentMap<String, Cache>",
"var_name": ... | {
"body": "public void addCache(String cacheName, Cache cache) {\n children.put(cacheName, cache);\n }",
"class_method_signature": "CacheMetricsCollector.addCache(String cacheName, Cache cache)",
"constructor": false,
"full_signature": "public void addCache(String cacheName, Cache cache)",
"identifi... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_93 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/CustomMappingSampleBuilderTest.java",
"identifier": "CustomMappingSampleBuilderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_WHEN_MoreMatches_THEN_ShouldReturnFirstOne() {\n final Map<String, String> labels = new HashMap<String, String>();\n labels.put(\"service\", \"${0}\");\n final MapperConfig mapperConfig = new MapperConfig(\n \"app.okhttpclient.client.HttpClien... | {
"fields": [
{
"declarator": "compiledMapperConfigs",
"modifier": "private final",
"original_string": "private final List<CompiledMapperConfig> compiledMapperConfigs;",
"type": "List<CompiledMapperConfig>",
"var_name": "compiledMapperConfigs"
},
{
"declarator": "defaul... | {
"body": "@Override\n public Collector.MetricFamilySamples.Sample createSample(final String dropwizardName, final String nameSuffix, final List<String> additionalLabelNames, final List<String> additionalLabelValues, final double value) {\n if (dropwizardName == null) {\n throw new IllegalArgumen... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_85 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/GraphiteNamePatternTest.java",
"identifier": "GraphiteNamePatternTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void extractParameters_WHEN_moreDots_THEN_ShouldReturnNoMatches() {\n GraphiteNamePattern pattern;\n pattern = new GraphiteNamePattern(\"org.test.controller.*.status.*\");\n Assertions.assertThat(pattern.extractParameters(\"org.test.controller...status.400\"))\n ... | {
"fields": [
{
"declarator": "VALIDATION_PATTERN = Pattern.compile(METRIC_GLOB_REGEX)",
"modifier": "private static final",
"original_string": "private static final Pattern VALIDATION_PATTERN = Pattern.compile(METRIC_GLOB_REGEX);",
"type": "Pattern",
"var_name": "VALIDATION_PATTERN"... | {
"body": "Map<String, String> extractParameters(final String metricName) {\n final Matcher matcher = this.pattern.matcher(metricName);\n final Map<String, String> params = new HashMap<String, String>();\n if (matcher.find()) {\n for (int i = 1; i <= matcher.groupCount(); i++) {\n ... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_113 | {
"fields": [
{
"declarator": "osBean",
"modifier": "",
"original_string": "UnixOperatingSystemMXBean osBean;",
"type": "UnixOperatingSystemMXBean",
"var_name": "osBean"
},
{
"declarator": "runtimeBean",
"modifier": "",
"original_string": "RuntimeMXBean runt... | {
"body": "@Test\n public void testStandardExports() {\n CollectorRegistry registry = new CollectorRegistry();\n new StandardExports(new StatusReaderTest(), osBean, runtimeBean).register(registry);\n\n assertEquals(123 / 1.0E9,\n registry.getSampleValue(\"process_cpu_seconds_total\", new String[]{}, ... | {
"fields": [
{
"declarator": "LOGGER = Logger.getLogger(StandardExports.class.getName())",
"modifier": "private static final",
"original_string": "private static final Logger LOGGER = Logger.getLogger(StandardExports.class.getName());",
"type": "Logger",
"var_name": "LOGGER"
},
... | {
"body": "public StandardExports() {\n this(new StatusReader(),\n ManagementFactory.getOperatingSystemMXBean(),\n ManagementFactory.getRuntimeMXBean());\n }",
"class_method_signature": "StandardExports.StandardExports()",
"constructor": true,
"full_signature": "public StandardExports()",
... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_105 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "writer",
"modifier": "",
"original_string": "StringWriter writer;",
"typ... | {
"body": "@Test\n public void testLabelsOutput() throws IOException {\n Gauge labels = Gauge.build().name(\"labels\").help(\"help\").labelNames(\"l\").register(registry);\n labels.labels(\"a\").inc();\n TextFormat.write004(writer, registry.metricFamilySamples());\n assertEquals(\"# HELP labels help\\n\"... | {
"fields": [
{
"declarator": "CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\"",
"modifier": "public final static",
"original_string": "public final static String CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\";",
"type": "String",
"var_name": "CONTENT... | {
"body": "public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException {\n /* See http://prometheus.io/docs/instrumenting/exposition_formats/\n * for the output format specification. */\n while(mfs.hasMoreElements()) {\n Collector.MetricFamilySamples me... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_27 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testOldPushWithSlashes() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"PUT\")\n .withPath(\"/metrics/job@base64/YS9i/instance@base64/Yy9k\")\n ).respond(response().withStatusCode(202));\n pg.push(registry, \"a/b\", \"c/d\"... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void push(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"PUT\");\n }",
"class_method_signature": "PushGateway.push(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void push(CollectorRegistry registry... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_70 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient/src/test/java/io/prometheus/client/GaugeMetricFamilyTest.java",
"identifier": "GaugeMet... | {
"body": "@Test\n public void testBuilderStyleUsage() {\n class YourCustomCollector extends Collector {\n public List<MetricFamilySamples> collect() {\n return Arrays.<MetricFamilySamples>asList(\n new GaugeMetricFamily(\"my_metric\", \"help\", Arrays.asList(\"name\"))\n .ad... | {
"fields": [
{
"declarator": "labelNames",
"modifier": "private final",
"original_string": "private final List<String> labelNames;",
"type": "List<String>",
"var_name": "labelNames"
}
],
"file": "simpleclient/src/main/java/io/prometheus/client/GaugeMetricFamily.java",
"ide... | {
"body": "public GaugeMetricFamily addMetric(List<String> labelValues, double value) {\n if (labelValues.size() != labelNames.size()) {\n throw new IllegalArgumentException(\"Incorrect number of labels.\");\n }\n samples.add(new Sample(name, labelNames, labelValues, value));\n return this;\n }",
... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_89 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/DefaultSampleBuilderTest.java",
"identifier": "DefaultSampleBuilderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_WHEN_NoSuffixAndExtraLabels_THEN_ShouldReturnCorrectSample() {\n final DefaultSampleBuilder builder = new DefaultSampleBuilder();\n final Collector.MetricFamilySamples.Sample result = builder.createSample(\"org.github.name\", null, null, null, 1d);\n Assert.... | {
"fields": [],
"file": "simpleclient_dropwizard/src/main/java/io/prometheus/client/dropwizard/samplebuilder/DefaultSampleBuilder.java",
"identifier": "DefaultSampleBuilder",
"interfaces": "implements SampleBuilder",
"methods": [
{
"class_method_signature": "DefaultSampleBuilder.createSample(final S... | {
"body": "@Override\n public Collector.MetricFamilySamples.Sample createSample(final String dropwizardName, final String nameSuffix, final List<String> additionalLabelNames, final List<String> additionalLabelValues, final double value) {\n final String suffix = nameSuffix == null ? \"\" : nameSuffix;\n ... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_66 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient/src/test/java/io/prometheus/client/CollectorRegistryTest.java",
"identifier": "Collecto... | {
"body": "@Test\n public void testAutoDescribeDisabledByDefault() {\n CollectorRegistry r = new CollectorRegistry();\n new MyCollector().register(r);\n // This doesn't throw.\n new MyCollector().register(r);\n }",
"class_method_signature": "CollectorRegistryTest.testAutoDescribeDisabledByDefault()",
... | {
"fields": [
{
"declarator": "defaultRegistry = new CollectorRegistry(true)",
"modifier": "public static final",
"original_string": "public static final CollectorRegistry defaultRegistry = new CollectorRegistry(true);",
"type": "CollectorRegistry",
"var_name": "defaultRegistry"
... | {
"body": "public void register(Collector m) {\n List<String> names = collectorNames(m);\n synchronized (namesCollectorsLock) {\n for (String name : names) {\n if (namesToCollectors.containsKey(name)) {\n throw new IllegalArgumentException(\"Collector already registered that provides name: ... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_31 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testOldDelete() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"DELETE\")\n .withPath(\"/metrics/job/j/instance/i\")\n ).respond(response().withStatusCode(202));\n pg.delete(\"j\", \"i\");\n }",
"class_method_signature": ... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void delete(String job) throws IOException {\n doRequest(null, job, null, \"DELETE\");\n }",
"class_method_signature": "PushGateway.delete(String job)",
"constructor": false,
"full_signature": "public void delete(String job)",
"identifier": "delete",
"invocations": [
"doRequest"
... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_110 | {
"fields": [],
"file": "simpleclient_caffeine/src/test/java/io/prometheus/client/cache/caffeine/CacheMetricsCollectorTest.java",
"identifier": "CacheMetricsCollectorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@SuppressWarnings(\"unchecked\")\n @Test\n public void loadingCacheExposesMetricsForLoadsAndExceptions() throws Exception {\n CacheLoader<String, String> loader = mock(CacheLoader.class);\n when(loader.load(anyString()))\n .thenReturn(\"First User\")\n .the... | {
"fields": [
{
"declarator": "children = new ConcurrentHashMap<String, Cache>()",
"modifier": "protected final",
"original_string": "protected final ConcurrentMap<String, Cache> children = new ConcurrentHashMap<String, Cache>();",
"type": "ConcurrentMap<String, Cache>",
"var_name": ... | {
"body": "public void addCache(String cacheName, Cache cache) {\n children.put(cacheName, cache);\n }",
"class_method_signature": "CacheMetricsCollector.addCache(String cacheName, Cache cache)",
"constructor": false,
"full_signature": "public void addCache(String cacheName, Cache cache)",
"identifi... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_49 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "metric",
"modifier": "",
"original_string": "Gauge metric;",
"type": "Ga... | {
"body": "@Test\n public void testTooFewLabelsThrows() {\n thrown.expect(IllegalArgumentException.class);\n thrown.expectMessage(\"Incorrect number of labels.\");\n metric.labels();\n }",
"class_method_signature": "SimpleCollectorTest.testTooFewLabelsThrows()",
"constructor": false,
"full_signature"... | {
"fields": [
{
"declarator": "fullname",
"modifier": "protected final",
"original_string": "protected final String fullname;",
"type": "String",
"var_name": "fullname"
},
{
"declarator": "help",
"modifier": "protected final",
"original_string": "protected f... | {
"body": "public Child labels(String... labelValues) {\n if (labelValues.length != labelNames.size()) {\n throw new IllegalArgumentException(\"Incorrect number of labels.\");\n }\n for (String label: labelValues) {\n if (label == null) {\n throw new IllegalArgumentException(\"Label cannot b... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_106 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "writer",
"modifier": "",
"original_string": "StringWriter writer;",
"typ... | {
"body": "@Test\n public void testLabelValuesEscaped() throws IOException {\n Gauge labels = Gauge.build().name(\"labels\").help(\"help\").labelNames(\"l\").register(registry);\n labels.labels(\"ąćčęntěd a\\nb\\\\c\\\"d\").inc();\n TextFormat.write004(writer, registry.metricFamilySamples());\n assertEqu... | {
"fields": [
{
"declarator": "CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\"",
"modifier": "public final static",
"original_string": "public final static String CONTENT_TYPE_004 = \"text/plain; version=0.0.4; charset=utf-8\";",
"type": "String",
"var_name": "CONTENT... | {
"body": "public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException {\n /* See http://prometheus.io/docs/instrumenting/exposition_formats/\n * for the output format specification. */\n while(mfs.hasMoreElements()) {\n Collector.MetricFamilySamples me... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_24 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testOldPushWithoutInstance() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"PUT\")\n .withPath(\"/metrics/job/j/instance@base64/=\")\n ).respond(response().withStatusCode(202));\n pg.push(registry, \"j\", \"\");\n }",
"c... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void push(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"PUT\");\n }",
"class_method_signature": "PushGateway.push(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void push(CollectorRegistry registry... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_73 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "noLabels",
"modifier": "",
"original_string": "Gauge noLabels, labels;",
... | {
"body": "@Test\n public void testDecrement() {\n noLabels.dec();\n assertEquals(-1.0, getValue(), .001);\n noLabels.dec(2);\n assertEquals(-3.0, getValue(), .001);\n noLabels.labels().dec(4);\n assertEquals(-7.0, getValue(), .001);\n noLabels.labels().dec();\n assertEquals(-8.0, getValue(),... | {
"fields": [],
"file": "simpleclient/src/main/java/io/prometheus/client/Gauge.java",
"identifier": "Gauge",
"interfaces": "implements Collector.Describable",
"methods": [
{
"class_method_signature": "Gauge.Gauge(Builder b)",
"constructor": true,
"full_signature": " Gauge(Builder b)",
... | {
"body": "public void dec() {\n dec(1);\n }",
"class_method_signature": "Gauge.dec()",
"constructor": false,
"full_signature": "public void dec()",
"identifier": "dec",
"invocations": [
"dec"
],
"modifiers": "public",
"parameters": "()",
"return": "void",
"signature": "void dec()",
"tes... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_65 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient/src/test/java/io/prometheus/client/CollectorRegistryTest.java",
"identifier": "Collecto... | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void testHistogramAndSummaryWithSameNameThrows() {\n Histogram.build().name(\"s\").help(\"h\").register(registry);\n Summary.build().name(\"s\").help(\"h\").register(registry);\n }",
"class_method_signature": "CollectorRegistryTest.testHis... | {
"fields": [
{
"declarator": "defaultRegistry = new CollectorRegistry(true)",
"modifier": "public static final",
"original_string": "public static final CollectorRegistry defaultRegistry = new CollectorRegistry(true);",
"type": "CollectorRegistry",
"var_name": "defaultRegistry"
... | {
"body": "public void register(Collector m) {\n List<String> names = collectorNames(m);\n synchronized (namesCollectorsLock) {\n for (String name : names) {\n if (namesToCollectors.containsKey(name)) {\n throw new IllegalArgumentException(\"Collector already registered that provides name: ... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_32 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testInstanceIPGroupingKey() throws IOException {\n groupingKey = PushGateway.instanceIPGroupingKey();\n Assert.assertTrue(!groupingKey.get(\"instance\").equals(\"\"));\n }",
"class_method_signature": "PushGatewayTest.testInstanceIPGroupingKey()",
"constructor": false,
"ful... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public static Map<String, String> instanceIPGroupingKey() throws UnknownHostException {\n Map<String, String> groupingKey = new HashMap<String, String>();\n groupingKey.put(\"instance\", InetAddress.getLocalHost().getHostAddress());\n return groupingKey;\n }",
"class_method_signature": "PushGat... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_45 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "noLabels",
"modifier": "",
"original_string": "Histogram noLabels, labels;",
... | {
"body": "@Test\n public void testBoundaryConditions() {\n // Equal to a bucket.\n noLabels.observe(2.5);\n assertEquals(0.0, getBucket(1), .001);\n assertEquals(1.0, getBucket(2.5), .001);\n noLabels.labels().observe(Double.POSITIVE_INFINITY);\n\n // Infinity.\n assertEquals(0.0, getBucket(1),... | {
"fields": [
{
"declarator": "buckets",
"modifier": "private final",
"original_string": "private final double[] buckets;",
"type": "double[]",
"var_name": "buckets"
}
],
"file": "simpleclient/src/main/java/io/prometheus/client/Histogram.java",
"identifier": "Histogram",
... | {
"body": "public void observe(double amt) {\n noLabelsChild.observe(amt);\n }",
"class_method_signature": "Histogram.observe(double amt)",
"constructor": false,
"full_signature": "public void observe(double amt)",
"identifier": "observe",
"invocations": [
"observe"
],
"modifiers": "public",
"... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_12 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testPushCollector() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"PUT\")\n .withPath(\"/metrics/job/j\")\n ).respond(response().withStatusCode(202));\n pg.push(gauge, \"j\");\n }",
"class_method_signature": "PushGateway... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void push(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"PUT\");\n }",
"class_method_signature": "PushGateway.push(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void push(CollectorRegistry registry... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_3 | {
"fields": [
{
"declarator": "appender",
"modifier": "private",
"original_string": "private InstrumentedAppender appender;",
"type": "InstrumentedAppender",
"var_name": "appender"
},
{
"declarator": "event",
"modifier": "private",
"original_string": "privat... | {
"body": "@Test\n public void metersWarnEvents() throws Exception {\n when(event.getLevel()).thenReturn(WARN);\n\n appender.append(event);\n\n assertEquals(1, getLogLevelCount(\"warn\"));\n }",
"class_method_signature": "InstrumentedAppenderTest.metersWarnEvents()",
"constructor": fals... | {
"fields": [
{
"declarator": "COUNTER_NAME = \"log4j2_appender_total\"",
"modifier": "public static final",
"original_string": "public static final String COUNTER_NAME = \"log4j2_appender_total\";",
"type": "String",
"var_name": "COUNTER_NAME"
},
{
"declarator": "COUNT... | {
"body": "@Override\n public void append(LogEvent event) {\n Level level = event.getLevel();\n if (TRACE.equals(level)) TRACE_LABEL.inc();\n else if (DEBUG.equals(level)) DEBUG_LABEL.inc();\n else if (INFO.equals(level)) INFO_LABEL.inc();\n else if (WARN.equals(level)) WARN_LABE... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_53 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
},
{
"declarator": "metric",
"modifier": "",
"original_string": "Gauge metric;",
"type": "Ga... | {
"body": "@Test\n public void testNoLabelsWorkAfterRemove() {\n noLabels.inc(1);\n assertEquals(getValueNoLabels(), 1.0, .001);\n noLabels.remove();\n noLabels.inc(2);\n assertEquals(getValueNoLabels(), 2.0, .001);\n }",
"class_method_signature": "SimpleCollectorTest.testNoLabelsWorkAfterRemove()"... | {
"fields": [
{
"declarator": "fullname",
"modifier": "protected final",
"original_string": "protected final String fullname;",
"type": "String",
"var_name": "fullname"
},
{
"declarator": "help",
"modifier": "protected final",
"original_string": "protected f... | {
"body": "public void remove(String... labelValues) {\n children.remove(Arrays.asList(labelValues));\n initializeNoLabelsChild();\n }",
"class_method_signature": "SimpleCollector.remove(String... labelValues)",
"constructor": false,
"full_signature": "public void remove(String... labelValues)",
"ident... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_28 | {
"fields": [
{
"declarator": "thrown = none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "mockServerRule = new MockServerRule... | {
"body": "@Test\n public void testOldPushCollector() throws IOException {\n mockServerClient.when(\n request()\n .withMethod(\"PUT\")\n .withPath(\"/metrics/job/j/instance/i\")\n ).respond(response().withStatusCode(202));\n pg.push(gauge, \"j\", \"i\");\n }",
"class_method_sig... | {
"fields": [
{
"declarator": "MILLISECONDS_PER_SECOND = 1000",
"modifier": "private static final",
"original_string": "private static final int MILLISECONDS_PER_SECOND = 1000;",
"type": "int",
"var_name": "MILLISECONDS_PER_SECOND"
},
{
"declarator": "gatewayBaseURL",
... | {
"body": "public void push(CollectorRegistry registry, String job) throws IOException {\n doRequest(registry, job, null, \"PUT\");\n }",
"class_method_signature": "PushGateway.push(CollectorRegistry registry, String job)",
"constructor": false,
"full_signature": "public void push(CollectorRegistry registry... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_90 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/DefaultSampleBuilderTest.java",
"identifier": "DefaultSampleBuilderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test_WHEN_SuffixAndExtraLabels_THEN_ShouldReturnCorrectSample() {\n final DefaultSampleBuilder builder = new DefaultSampleBuilder();\n final Collector.MetricFamilySamples.Sample result = builder.createSample(\"org.github.name\", \"suffix.test\", Collections.singletonLis... | {
"fields": [],
"file": "simpleclient_dropwizard/src/main/java/io/prometheus/client/dropwizard/samplebuilder/DefaultSampleBuilder.java",
"identifier": "DefaultSampleBuilder",
"interfaces": "implements SampleBuilder",
"methods": [
{
"class_method_signature": "DefaultSampleBuilder.createSample(final S... | {
"body": "@Override\n public Collector.MetricFamilySamples.Sample createSample(final String dropwizardName, final String nameSuffix, final List<String> additionalLabelNames, final List<String> additionalLabelValues, final double value) {\n final String suffix = nameSuffix == null ? \"\" : nameSuffix;\n ... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_69 | {
"fields": [
{
"declarator": "registry",
"modifier": "",
"original_string": "CollectorRegistry registry;",
"type": "CollectorRegistry",
"var_name": "registry"
}
],
"file": "simpleclient/src/test/java/io/prometheus/client/GaugeMetricFamilyTest.java",
"identifier": "GaugeMet... | {
"body": "@Test\n public void testJavadocExample() {\n class YourCustomCollector extends Collector {\n public List<MetricFamilySamples> collect() {\n List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>();\n // With no labels.\n mfs.add(new GaugeMetricFamily(\"my_gauge\", ... | {
"fields": [
{
"declarator": "labelNames",
"modifier": "private final",
"original_string": "private final List<String> labelNames;",
"type": "List<String>",
"var_name": "labelNames"
}
],
"file": "simpleclient/src/main/java/io/prometheus/client/GaugeMetricFamily.java",
"ide... | {
"body": "public GaugeMetricFamily addMetric(List<String> labelValues, double value) {\n if (labelValues.size() != labelNames.size()) {\n throw new IllegalArgumentException(\"Incorrect number of labels.\");\n }\n samples.add(new Sample(name, labelNames, labelValues, value));\n return this;\n }",
... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_86 | {
"fields": [],
"file": "simpleclient_dropwizard/src/test/java/io/prometheus/client/dropwizard/samplebuilder/MapperConfigTest.java",
"identifier": "MapperConfigTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void setMatch_WHEN_ExpressionDoesnNotMatchPattern_ThrowException() {\n final MapperConfig mapperConfig = new MapperConfig();\n mapperConfig.setMatch(\"com.company.meter.**.yay\");\n }",
"class_method_signature": "MapperConfigTe... | {
"fields": [
{
"declarator": "METRIC_PART_REGEX = \"[a-zA-Z_0-9](-?[a-zA-Z0-9_])+\"",
"modifier": "private static final",
"original_string": "private static final String METRIC_PART_REGEX = \"[a-zA-Z_0-9](-?[a-zA-Z0-9_])+\";",
"type": "String",
"var_name": "METRIC_PART_REGEX"
},... | {
"body": "public void setMatch(final String match) {\n validateMatch(match);\n this.match = match;\n }",
"class_method_signature": "MapperConfig.setMatch(final String match)",
"constructor": false,
"full_signature": "public void setMatch(final String match)",
"identifier": "setMatch",
"inv... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
7997879_68 | {
"fields": [],
"file": "simpleclient/src/test/java/io/prometheus/client/SimpleTimerTest.java",
"identifier": "SimpleTimerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void elapsedSeconds() throws Exception {\n SimpleTimer.TimeProvider provider = new SimpleTimer.TimeProvider() {\n long value = (long)(30 * 1e9);\n long nanoTime() {\n value += (long)(10 * 1e9);\n return value;\n }\n ... | {
"fields": [
{
"declarator": "start",
"modifier": "private final",
"original_string": "private final long start;",
"type": "long",
"var_name": "start"
},
{
"declarator": "defaultTimeProvider = new TimeProvider()",
"modifier": "static",
"original_string": "s... | {
"body": "public double elapsedSeconds() {\n return elapsedSecondsFromNanos(start, timeProvider.nanoTime());\n }",
"class_method_signature": "SimpleTimer.elapsedSeconds()",
"constructor": false,
"full_signature": "public double elapsedSeconds()",
"identifier": "elapsedSeconds",
"invocations": [
"el... | {
"created": "2/3/2013 10:55:49 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 7997879,
"size": null,
"stargazer_count": null,
"stars": 1094,
"updates": "2020-01-25T01:49:53+00:00",
"url": "https://github.com/prometheus/clien... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.