Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
c7677d10
Commit
c7677d10
authored
Jun 05, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish documentation
parent
25f74cba
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
203 additions
and
209 deletions
+203
-209
getting-started.adoc
spring-boot-docs/src/main/asciidoc/getting-started.adoc
+2
-2
production-ready-features.adoc
...oot-docs/src/main/asciidoc/production-ready-features.adoc
+38
-34
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+162
-172
using-spring-boot.adoc
spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc
+1
-1
No files found.
spring-boot-docs/src/main/asciidoc/getting-started.adoc
View file @
c7677d10
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
[partintro]
[partintro]
--
--
If you're just getting started with Spring Boot, or 'Spring' in general, this is the section
If you're just getting started with Spring Boot, or 'Spring' in general, this is the section
for you! Here we answer the basic
'"`what?`"', '"`how?`"' and '"`why?`"'
questions. You'll
for you! Here we answer the basic
"`what?`", "`how?`" and "`why?`"
questions. You'll
find a gentle introduction to Spring Boot along with installation instructions.
find a gentle introduction to Spring Boot along with installation instructions.
We'll then build our first Spring Boot application, discussing some core principles as
We'll then build our first Spring Boot application, discussing some core principles as
we go.
we go.
...
@@ -524,7 +524,7 @@ endif::[]
...
@@ -524,7 +524,7 @@ endif::[]
----
----
This should give you a working build, you can test it out by running `mvn package` (you
This should give you a working build, you can test it out by running `mvn package` (you
can ignore the "`jar will be empty - no content was marked for inclusion!
'
`" warning for
can ignore the "`jar will be empty - no content was marked for inclusion!`" warning for
now).
now).
NOTE: At this point you could import the project into an IDE (most modern Java IDE's
NOTE: At this point you could import the project into an IDE (most modern Java IDE's
...
...
spring-boot-docs/src/main/asciidoc/production-ready-features.adoc
View file @
c7677d10
...
@@ -964,10 +964,10 @@ the metrics are exported to a Redis cache for aggregation. The `RedisMetricRepos
...
@@ -964,10 +964,10 @@ the metrics are exported to a Redis cache for aggregation. The `RedisMetricRepos
two
important
parameters
to
configure
it
for
this
purpose
:
`
prefix
`
and
`
key
`
(
passed
into
two
important
parameters
to
configure
it
for
this
purpose
:
`
prefix
`
and
`
key
`
(
passed
into
its
constructor
).
It
is
best
to
use
a
prefix
that
is
unique
to
the
application
instance
its
constructor
).
It
is
best
to
use
a
prefix
that
is
unique
to
the
application
instance
(
e
.
g
.
using
a
random
value
and
maybe
the
logical
name
of
the
application
to
make
it
(
e
.
g
.
using
a
random
value
and
maybe
the
logical
name
of
the
application
to
make
it
possible
to
correlate
with
other
instances
of
the
same
application
).
The
"
key"
is
used
to
possible
to
correlate
with
other
instances
of
the
same
application
).
The
"
`key`"
is
used
keep
a
global
index
of
all
metric
names
,
so
it
should
be
unique
"globally"
,
whatever
that
to
keep
a
global
index
of
all
metric
names
,
so
it
should
be
unique
"`globally`"
,
whatever
means
for
your
system
(
e
.
g
.
2
instances
of
the
same
system
could
share
a
Redis
cache
if
that
means
for
your
system
(
e
.
g
.
two
instances
of
the
same
system
could
share
a
Redis
cache
they
have
distinct
keys
).
if
they
have
distinct
keys
).
Example
:
Example
:
...
@@ -991,33 +991,33 @@ spring.metrics.export.redis.key: keys.metrics.mysystem
...
@@ -991,33 +991,33 @@ spring.metrics.export.redis.key: keys.metrics.mysystem
The
prefix
is
constructed
with
the
application
name
and
id
at
the
end
,
so
it
can
easily
be
used
The
prefix
is
constructed
with
the
application
name
and
id
at
the
end
,
so
it
can
easily
be
used
to
identify
a
group
of
processes
with
the
same
logical
name
later
.
to
identify
a
group
of
processes
with
the
same
logical
name
later
.
NOTE
:
it
's important to set both the key and the prefix
. The key is used for all
NOTE
:
It
's important to set both the `key` and the `prefix`
. The key is used for all
repository operations, and can be shared by multiple repositories. If multiple
repository operations, and can be shared by multiple repositories. If multiple
repositories share a key (like in the case where you need to aggregate across them), then
repositories share a key (like in the case where you need to aggregate across them), then
you normally have a read-only "
master
" repository that has a short, but identifiable,
you normally have a read-only "
`master`
" repository that has a short, but identifiable,
prefix (like "
metrics.mysystem
"), and many write-only repositories with prefixes that
prefix (like "
`metrics.mysystem`
"), and many write-only repositories with prefixes that
start with the master prefix (like `metrics.mysystem.*` in the example above). It is
start with the master prefix (like `metrics.mysystem.*` in the example above). It is
efficient to read all the keys from a "
master
" repository like that, but inefficient to
efficient to read all the keys from a "
`master`
" repository like that, but inefficient to
read a subset with a longer prefix (e.g. using one of the writing repositories).
read a subset with a longer prefix (e.g. using one of the writing repositories).
NOTE: t
he example above uses `MetricExportProperties` to inject and extract the key and
TIP: T
he example above uses `MetricExportProperties` to inject and extract the key and
prefix. This is provided to you as a convenience by Spring Boot,
and the defaults for that
prefix. This is provided to you as a convenience by Spring Boot,
configured with sensible
will be sensible, but there is nothing to stop you using your own values as long as they
defaults. There is nothing to stop you using your own values as long as they follow the
follow the
recommendations.
recommendations.
[[production-ready-metric-writers-export-to-open-tdsb]]
[[production-ready-metric-writers-export-to-open-tdsb]]
==== Example: Export to Open TSDB
==== Example: Export to Open TSDB
If you provide a `@Bean` of type `OpenTsdbHttpMetricWriter` and mark it
If you provide a `@Bean` of type `OpenTsdbHttpMetricWriter` and mark it
`@ExportMetricWriter`
the
metrics are exported to http://opentsdb.net/[Open TSDB] for
`@ExportMetricWriter` metrics are exported to http://opentsdb.net/[Open TSDB] for
aggregation. The `OpenTsdbHttpMetricWriter` has a `url` property that you need to set
aggregation. The `OpenTsdbHttpMetricWriter` has a `url` property that you need to set
to the Open TSDB "
/put
" endpoint, e.g. `http://localhost:4242/api/put`). It also has a
to the Open TSDB "
`/put`
" endpoint, e.g. `http://localhost:4242/api/put`). It also has a
`namingStrategy` that you can customize or configure to make the metrics match the data
`namingStrategy` that you can customize or configure to make the metrics match the data
structure you need on the server. By default it just passes through the metric name as an
structure you need on the server. By default it just passes through the metric name as an
Open TSDB metric name
and adds a tag "domain" with value "org.springframework.metrics" and
Open TSDB metric name
, and adds the tags "`domain`" (with value
another tag "process" with value equals to the object hash of the naming strategy. Thus,
"`org.springframework.metrics`") and "`process`" (with the value equal to the object hash
after running the application and generating some metrics (e.g. by pinging the home page)
of the naming strategy). Thus, after running the application and generating some metrics
you can inspect the metrics in the TDB UI (http://localhost:4242 by default).
you can inspect the metrics in the TDB UI (http://localhost:4242 by default).
Example:
Example:
...
@@ -1072,7 +1072,9 @@ MetricWriter metricWriter() {
...
@@ -1072,7 +1072,9 @@ MetricWriter metricWriter() {
If you provide a `@Bean` of type `JmxMetricWriter` marked `@ExportMetricWriter` the metrics are exported as MBeans to
If you provide a `@Bean` of type `JmxMetricWriter` marked `@ExportMetricWriter` the metrics are exported as MBeans to
the local server (the `MBeanExporter` is provided by Spring Boot JMX autoconfiguration as
the local server (the `MBeanExporter` is provided by Spring Boot JMX autoconfiguration as
long as it is switched on). Metrics can then be inspected, graphed, alerted etc. using any
long as it is switched on). Metrics can then be inspected, graphed, alerted etc. using any
tool that understands JMX (e.g. JConsole or JVisualVM). Example:
tool that understands JMX (e.g. JConsole or JVisualVM).
Example:
[source,java,indent=0]
[source,java,indent=0]
----
----
...
@@ -1098,10 +1100,12 @@ period-separated prefix, and the reader will aggregate (by truncating the metric
...
@@ -1098,10 +1100,12 @@ period-separated prefix, and the reader will aggregate (by truncating the metric
and dropping the prefix). Counters are summed and everything else (i.e. gauges) take their
and dropping the prefix). Counters are summed and everything else (i.e. gauges) take their
most recent value.
most recent value.
This is very useful (for instance) if multiple application instances are feeding to a
This is very useful if multiple application instances are feeding to a central (e.g.
central (e.g. redis) repository and you want to display the results. Particularly
Redis) repository and you want to display the results. Particularly recommended in
recommended in conjunction with a `MetricReaderPublicMetrics` for hooking up to the
conjunction with a `MetricReaderPublicMetrics` for hooking up to the results to the
results to the "/metrics" endpoint. Example:
"`/metrics`" endpoint.
Example:
[source,java,indent=0]
[source,java,indent=0]
----
----
...
@@ -1125,17 +1129,17 @@ results to the "/metrics" endpoint. Example:
...
@@ -1125,17 +1129,17 @@ results to the "/metrics" endpoint. Example:
}
}
----
----
NOTE: the example above uses `MetricExportProperties` to inject and
NOTE: The example above uses `MetricExportProperties` to inject and extract the key and
extract the key and prefix. This is provided to you as a convenience
prefix. This is provided to you as a convenience by Spring Boot, and the defaults will be
by Spring Boot, and the defaults will be sensible. They are set up in
sensible. They are set up in `MetricExportAutoConfiguration`.
`MetricExportAutoConfiguration`.
NOTE:
t
he `MetricReaders` above are not `@Beans` and are not marked as
NOTE:
T
he `MetricReaders` above are not `@Beans` and are not marked as
`@ExportMetricReader` because they are just collecting and analy
sing
`@ExportMetricReader` because they are just collecting and analy
zing data from other
data from other
repositories, and don'
t
want
to
export
their
values
.
repositories, and don'
t
want
to
export
their
values
.
[[
production
-
ready
-
code
-
hale
-
metrics
]]
[[
production
-
ready
-
dropwizard
-
metrics
]]
[[
production
-
ready
-
dropwizard
-
metrics
]]
===
Dropwizard
Metrics
===
Dropwizard
Metrics
A
default
`
MetricRegistry
`
Spring
bean
will
be
created
when
you
declare
a
dependency
to
A
default
`
MetricRegistry
`
Spring
bean
will
be
created
when
you
declare
a
dependency
to
...
@@ -1149,7 +1153,7 @@ endpoint
...
@@ -1149,7 +1153,7 @@ endpoint
When
Dropwizard
metrics
are
in
use
,
the
default
`
CounterService
`
and
`
GaugeService
`
are
When
Dropwizard
metrics
are
in
use
,
the
default
`
CounterService
`
and
`
GaugeService
`
are
replaced
with
a
`
DropwizardMetricServices
`,
which
is
a
wrapper
around
the
`
MetricRegistry
`
replaced
with
a
`
DropwizardMetricServices
`,
which
is
a
wrapper
around
the
`
MetricRegistry
`
(
so
you
can
`@
Autowired
`
one
of
those
services
and
use
it
as
normal
).
You
can
also
create
(
so
you
can
`@
Autowired
`
one
of
those
services
and
use
it
as
normal
).
You
can
also
create
"
special
"
Dropwizard
metrics
by
prefixing
your
metric
names
with
the
appropriate
type
"
`special`
"
Dropwizard
metrics
by
prefixing
your
metric
names
with
the
appropriate
type
(
i
.
e
.
`+
timer
.*+`,
`+
histogram
.*+`
for
gauges
,
and
`+
meter
.*+`
for
counters
).
(
i
.
e
.
`+
timer
.*+`,
`+
histogram
.*+`
for
gauges
,
and
`+
meter
.*+`
for
counters
).
...
@@ -1185,7 +1189,7 @@ and obtain basic information about the last few requests:
...
@@ -1185,7 +1189,7 @@ and obtain basic information about the last few requests:
[source,json,indent=0]
[source,json,indent=0]
----
----
[{
[{
"timestamp": 1394343677415,
"timestamp": 1394343677415,
"info": {
"info": {
"method": "GET",
"method": "GET",
...
...
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
c7677d10
This diff is collapsed.
Click to expand it.
spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc
View file @
c7677d10
...
@@ -238,7 +238,7 @@ where `+*+` is a particular type of application. This naming structure is intend
...
@@ -238,7 +238,7 @@ where `+*+` is a particular type of application. This naming structure is intend
help when you need to find a starter. The Maven integration in many IDEs allow you to
help when you need to find a starter. The Maven integration in many IDEs allow you to
search dependencies by name. For example, with the appropriate Eclipse or STS plugin
search dependencies by name. For example, with the appropriate Eclipse or STS plugin
installed, you can simply hit `ctrl-space` in the POM editor and type
installed, you can simply hit `ctrl-space` in the POM editor and type
''spring-boot-starter''
for a complete list.
"`spring-boot-starter`"
for a complete list.
Third party starters should not start with `spring-boot-starter` as it is reserved for
Third party starters should not start with `spring-boot-starter` as it is reserved for
official starters. A third-party starter for `acme` will be typically named
official starters. A third-party starter for `acme` will be typically named
...
...
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