Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
Metrics
Onionoo
Commits
0f28ea28
Commit
0f28ea28
authored
Sep 19, 2017
by
iwakeh
Browse files
Add build revision field to documents.
Implements task-23778.
parent
e7cce268
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
0f28ea28
...
...
@@ -4,6 +4,8 @@
-
Only set the "running" field in a bridge's details document to
true if the bridge is both contained in the last known bridge
network status and has the "Running" flag assigned there.
-
Add build_revision to documents, if available.
-
Update to metrics-lib 2.1.1.
*
Minor changes
-
Remove placeholder page on index.html.
...
...
build.xml
View file @
0f28ea28
...
...
@@ -11,7 +11,7 @@
<property
name=
"onionoo.protocol.version"
value=
"4.1"
/>
<property
name=
"release.version"
value=
"${onionoo.protocol.version}-1.5.0-dev"
/>
<property
name=
"metricslibversion"
value=
"2.1.
0
"
/>
<property
name=
"metricslibversion"
value=
"2.1.
1
"
/>
<property
name=
"jetty.version"
value=
"-9.2.21.v20170120"
/>
<property
name=
"warfile"
value=
"onionoo-${release.version}.war"
/>
...
...
src/main/java/org/torproject/onionoo/server/ResponseBuilder.java
View file @
0f28ea28
...
...
@@ -18,16 +18,37 @@ import com.google.gson.GsonBuilder;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.InputStream
;
import
java.io.PrintWriter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Properties
;
public
class
ResponseBuilder
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ResponseBuilder
.
class
);
private
DocumentStore
documentStore
;
private
String
buildRevision
;
/** Initialize document store and the build revision. */
public
ResponseBuilder
()
{
this
.
documentStore
=
DocumentStoreFactory
.
getDocumentStore
();
Properties
buildProperties
=
new
Properties
();
try
(
InputStream
is
=
getClass
().
getClassLoader
()
.
getResourceAsStream
(
"onionoo.buildrevision.properties"
))
{
buildProperties
.
load
(
is
);
buildRevision
=
buildProperties
.
getProperty
(
"onionoo.build.revision"
,
null
);
}
catch
(
Exception
ex
)
{
// We create documents anyway: only log a warning.
logger
.
warn
(
"No build revision available."
,
ex
);
buildRevision
=
null
;
}
}
private
String
resourceType
;
...
...
@@ -112,6 +133,9 @@ public class ResponseBuilder {
this
.
write
(
pw
,
"\"next_major_version_scheduled\":\"%s\",\n"
,
NEXT_MAJOR_VERSION_SCHEDULED
);
}
if
(
null
!=
buildRevision
)
{
this
.
write
(
pw
,
"\"build_revision\":\"%s\",\n"
,
buildRevision
);
}
this
.
write
(
pw
,
"\"relays_published\":\"%s\",\n"
,
this
.
relaysPublishedString
);
if
(
this
.
relaysSkipped
>
0
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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