Configuration¶
This page lists every property that controls OpenTelemetry export, and describes how export behaves when the collector is slow, rejects requests, or cannot be reached.
Overview¶
All export properties go in config/local.properties and are read once, at startup, so every
change needs a restart. They are listed in the startup log, log/AmiCore.log, with the values in
use; Sending metrics to a collector shows how to check.
A complete configuration for an authenticated collector looks like this:
Keep each comment on a line of its own. A # after a value on the same line becomes part of the
value.
Turning export on and choosing the collector¶
Export is off unless ami.log.stats.otel.enabled is true. With it on and nothing else set, data
goes to http://localhost:4318.
- Default:
- Description:
-
- Set to
trueto send runtime statistics to the collector at every statistics interval. - A value other than
trueorfalseturns export off and logsInvalid value for ami.log.stats.otel.enabled; expected true or false. OpenTelemetry export disabled.
- Set to
- Default:
- Description:
-
- Base URL of the OTLP/HTTP receiver. Metrics are sent to
<endpoint>/v1/metricsand log records to<endpoint>/v1/logs. - Must begin with a scheme such as
http://. A value without one, such aslocalhost:4318, sends nothing, never turns export off, and logs onlyCould not create rest request:withjava.net.MalformedURLException:unknown protocol: localhost. - A trailing
/is accepted by the OpenTelemetry Collector.
- Base URL of the OTLP/HTTP receiver. Metrics are sent to
Sending to an HTTPS collector¶
To send over HTTPS, set ami.log.stats.otel.endpoint to an https:// URL. The server checks the
collector's certificate against the trust store of its Java runtime, the bundled runtime in the
jre/ directory one level above the installation directory.
If that trust store does not trust the collector's certificate, every request fails, and export turns off after 5 failures:
To trust a collector whose certificate is issued by a private certificate authority, add the
authority's certificate to the bundled runtime's trust store, then restart. Run from the directory
that contains both jre/ and amicore/, replacing the file path with your authority's certificate:
The command prints Certificate was added to keystore. changeit is the password of the bundled
runtime's trust store.
Naming the service¶
Every request carries a service.name resource attribute. Set it so that each server can be told
apart when more than one reports to the same collector.
ami.log.stats.otel.service.name
- Default:
- Not set.
- Description:
-
- The value sent as
service.name. - When not set, the value of
f1.logfilenameis used, which isAmiCoreon a default installation.
- The value sent as
The other resource attributes are set automatically; see Resource attributes.
Authenticating to a collector¶
To send credentials, such as the access token a hosted collector requires, or any other HTTP header,
set ami.log.stats.otel.headers to a JSON object of
header names and values. The headers are added to every request.
- Default:
- Not set.
- Description:
-
- Extra HTTP headers as a JSON object, e.g:
{"Authorization":"Bearer <token>"}. - Any other format, including the HTTP form
Authorization: Bearer <token>, is ignored at startup with the warning below. Requests are then sent without the header, and a collector that requires it rejects them. - A header named exactly
Content-Typereplaces the defaultContent-Type: application/json.
- Extra HTTP headers as a JSON object, e.g:
A value that is not a JSON object logs this at startup:
The header value is written to the startup log
The startup log lists every property with its value, including ami.log.stats.otel.headers.
A token set there is stored in plain text in log/AmiCore.log. Restrict read access to the
installation's log/ directory, and treat old log files as containing the credential.
When the collector is unavailable¶
A request that fails is not retried: its data is dropped. After too many failed requests in a row, export turns itself off for as long as the server runs, and only a restart turns it back on.
ami.log.stats.otel.max.retries
- Default:
- Description:
-
- The number of consecutive failed requests after which export turns off until the next restart. It is not a retry count: no request is ever resent.
- Each interval makes 2 requests, metrics then log records, so with the default the limit is reached in the third failing interval. That is about 30 seconds after the first failure when the collector answers with an error at once, and longer when requests are slow to fail: 38 seconds when the connection was refused, which took about 2 seconds per request.
- A successful request resets the count. If the collector accepts log records but rejects metrics, or the reverse, the count never reaches the limit, export stays on, and the rejected data is lost at every interval.
ami.log.stats.otel.request.timeout
- Default:
- Description:
-
- How long, in milliseconds, each request waits to connect and to receive a response before it
fails with
the request timed out.
- How long, in milliseconds, each request waits to connect and to receive a response before it
fails with
Requests are sent from the thread that also writes most of the statistics file, so a collector that is slow, unresponsive, or unreachable delays those statistics too, until export turns off. Process statistics were recorded every 19 seconds instead of every 15 both with a 2-second timeout and a collector that did not respond, and with nothing listening at the endpoint.
When export turns off, the log shows:
Each earlier failure logs OTel export request failed because <reason> (<n>/5 consecutive failures).
Troubleshooting lists the reasons and what to do about each.
When the server is stopped normally, it sends one last request of metrics and log records before it exits.
How often data is sent¶
Export has no interval of its own: it sends at every statistics interval, set by
ami.amilog.stats.period. These properties belong to the statistics file and affect export as
follows:
| Property | Default | Effect on export |
|---|---|---|
ami.amilog.stats.period |
15 SECONDS |
One request of metrics and one of log records per period |
ami.amilog.stats.os.period |
1 MINUTE |
How often OperatingSystem.* and FileSystem.* statistics are collected |
ami.center.log.stats.period.millis |
15000 |
How often the Center's AmiCenter* statistics are collected |
Statistics collected between intervals are held and sent with the next request.
What this does not support¶
- Environment variables: the standard
OTEL_*variables, such asOTEL_EXPORTER_OTLP_ENDPOINT, are not read. Use the properties on this page. - Choosing which metrics are sent: there is no property to include, exclude, or rename metrics.