Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
INB
ELIXIR
tools-platform
elixibilitas
elixibilitas-rest
Commits
4beb43a0
Commit
4beb43a0
authored
Feb 02, 2022
by
dmitry
Browse files
fix /homepage endpoint {id}
parent
994c4551
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
4beb43a0
...
...
@@ -73,7 +73,7 @@
<dependency>
<groupId>
es.elixir.bsc.json.schema
</groupId>
<artifactId>
json-schema-validator
</artifactId>
<version>
0.4.
1
</version>
<version>
0.4.
4
</version>
</dependency>
<dependency>
...
...
@@ -91,7 +91,7 @@
<dependency>
<groupId>
io.swagger.core.v3
</groupId>
<artifactId>
swagger-jaxrs2
</artifactId>
<version>
2.
0
.1
0
</version>
<version>
2.
1
.1
2
</version>
</dependency>
<dependency>
...
...
src/main/java/es/bsc/inb/elixir/elixibilitas/rest/MonitorRestServices.java
View file @
4beb43a0
...
...
@@ -33,13 +33,18 @@ import es.bsc.inb.elixir.elixibilitas.query.MongoQueries;
import
es.bsc.inb.elixir.elixibilitas.rest.ext.ContentRange
;
import
es.bsc.inb.elixir.elixibilitas.rest.ext.Range
;
import
io.swagger.v3.oas.annotations.Hidden
;
import
io.swagger.v3.oas.annotations.OpenAPIDefinition
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.headers.Header
;
import
io.swagger.v3.oas.annotations.info.Contact
;
import
io.swagger.v3.oas.annotations.info.Info
;
import
io.swagger.v3.oas.annotations.info.License
;
import
io.swagger.v3.oas.annotations.media.ArraySchema
;
import
io.swagger.v3.oas.annotations.media.Content
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.responses.ApiResponse
;
import
io.swagger.v3.oas.annotations.servers.Server
;
import
java.io.BufferedWriter
;
import
java.io.OutputStream
;
import
java.io.OutputStreamWriter
;
...
...
@@ -84,7 +89,15 @@ import javax.ws.rs.core.UriInfo;
*
* @author Dmitry Repchevsky
*/
@OpenAPIDefinition
(
info
=
@Info
(
title
=
"OpenEBench REST API services"
,
version
=
"0.1"
,
description
=
"OpenEBench REST API services"
,
license
=
@License
(
name
=
"LGPL 2.1"
,
url
=
"https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"
),
contact
=
@Contact
(
url
=
"https://openebench.bsc.es"
)
),
//security = @SecurityRequirement(name = "openid-connect"),
servers
=
{
@Server
(
url
=
"https://openebench.bsc.es/"
)})
@Path
(
"/rest/"
)
@ApplicationScoped
public
class
MonitorRestServices
{
...
...
@@ -491,17 +504,15 @@ public class MonitorRestServices {
}
@GET
@Path
(
"/homepage/{id
}/{type}/{host}{path
:.*}"
)
@Path
(
"/homepage/{id:.*}"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Operation
(
summary
=
"Tool's homepage uptime statistics"
,
description
=
"the complete tool id has a form '{prefix}:{id}:{version}/{type}/{authority}'. "
+
"providing a partial id (i.e. 'pmut') may found many tools, "
+
"for those only one metrics is returned."
,
description
=
"the tool id in either complete '{prefix}:{id}:{version}/{type}/{authority}' "
+
"or short form (i.e. 'pmut')"
,
responses
=
{
@ApiResponse
(
content
=
@Content
(
mediaType
=
MediaType
.
APPLICATION_JSON
,
schema
=
@Schema
(
ref
=
"https://openebench.bsc.es/monitor/metrics/metrics.json"
))),
@ApiResponse
(
responseCode
=
"404"
,
description
=
"metrics not found"
)
@Content
(
mediaType
=
MediaType
.
APPLICATION_JSON
)),
@ApiResponse
(
responseCode
=
"404"
,
description
=
"tool log not found"
)
}
)
public
void
getHomePageMonitoring
(
...
...
@@ -509,24 +520,12 @@ public class MonitorRestServices {
@QueryParam
(
"date2"
)
Long
date2
,
@QueryParam
(
"limit"
)
Integer
limit
,
@PathParam
(
"id"
)
@Parameter
(
description
=
"
prefixed
tool id"
,
example
=
"
biotools:
pmut"
)
@Parameter
(
description
=
"tool id"
,
example
=
"pmut"
)
final
String
id
,
@PathParam
(
"type"
)
@Parameter
(
description
=
"tool type"
,
example
=
"web"
)
final
String
type
,
@PathParam
(
"host"
)
@Parameter
(
description
=
"tool authority"
,
example
=
"mmb.irbbarcelona.org"
)
final
String
host
,
@PathParam
(
"path"
)
@Parameter
(
description
=
"json pointer"
)
final
String
path
,
@Suspended
final
AsyncResponse
asyncResponse
)
{
executor
.
submit
(()
->
{
asyncResponse
.
resume
(
getHomePageMonitoringAsync
(
id
+
"/"
+
type
+
"/"
+
host
,
date1
,
date2
,
limit
)
asyncResponse
.
resume
(
getHomePageMonitoringAsync
(
id
,
date1
,
date2
,
limit
)
.
build
());
});
}
...
...
src/main/java/es/bsc/inb/elixir/elixibilitas/rest/StatisticsServices.java
View file @
4beb43a0
This diff is collapsed.
Click to expand it.
src/main/resources/META-INF/resources/metrics.json
View file @
4beb43a0
...
...
@@ -31,18 +31,23 @@
"type"
:
"boolean"
},
"description"
:
{
"description"
:
"high-level description of the tool is available"
,
"type"
:
"boolean"
},
"concept"
:
{
"description"
:
"high-level description of how the tool/software works is available"
,
"type"
:
"boolean"
},
"rationale"
:
{
"description"
:
"design rationale is available"
,
"type"
:
"boolean"
},
"architecture"
:
{
"description"
:
"architectural overview, with diagrams, is available"
,
"type"
:
"boolean"
},
"usecases"
:
{
"description"
:
"descriptions of intended use cases are available"
,
"type"
:
"boolean"
},
"case_studies"
:
{
...
...
@@ -110,6 +115,24 @@
"description"
:
"homepage load time in ms."
,
"type"
:
"integer"
},
"redirects"
:
{
"description"
:
"site redirects (if any) with http codes"
,
"type"
:
"array"
,
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"url"
:
{
"description"
:
"redirect url"
,
"type"
:
"string"
,
"format"
:
"uri"
},
"status"
:
{
"description"
:
"http status code"
,
"type"
:
"integer"
}
}
}
},
"bioschemas"
:
{
"description"
:
"whether the homepage is annotated with 'bioschemas'"
,
"type"
:
"boolean"
...
...
@@ -117,6 +140,27 @@
"last_month_access"
:
{
"description"
:
"last month uptime statistics"
,
"$ref"
:
"#/definitions/HomepageAccess"
},
"half_year_stat"
:
{
"description"
:
"half year statistics of http response codes"
,
"type"
:
"object"
,
"properties"
:
{
"status"
:
{
"description"
:
"http response code"
,
"type"
:
"integer"
},
"days"
:
{
"description"
:
"number of days website returned the code"
,
"type"
:
"integer"
},
"serie"
:
{
"description"
:
"serie of uninterrupted status codes in days"
,
"type"
:
"array"
,
"items"
:
{
"type"
:
"integer"
}
}
}
}
}
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment