Siemens Insights Hub
Synopsis
Creates a Siemens Insights Hub target that sends metrics to Siemens Insights Hub (formerly MindSphere), as time series of assets. The console card says: "Send metrics to Siemens Insights Hub as time series of your assets."
Schema
- name: <string>
description: <string>
type: insightshub
pipelines: <pipeline[]>
status: <boolean>
properties:
url: <string>
token_url: <string>
client_id: <string>
client_secret: <string>
asset_id: <string>
aspect: <string>
variable: <string>
timeout: <numeric>
batch_size: <numeric>
max_retries: <numeric>
retry_delay: <numeric>
disable_retries: <boolean>
headers:
<key>: <value>
tls:
status: <boolean>
verify: <boolean>
cert_name: <string>
key_name: <string>
server_name: <string>
min_tls_version: <string>
debug:
status: <boolean>
dont_send_logs: <boolean>
Configuration
The following fields are used to define the target:
| Field | Required | Default | Description |
|---|---|---|---|
name | Y | Target name | |
description | N | - | Optional description |
type | Y | Must be insightshub | |
pipelines | N | - | Optional post-processor pipelines |
status | N | true | Enable/disable the target |
Connection
| Field | Required | Default | Description |
|---|---|---|---|
url | Y | - | The https address of the Insights Hub gateway, such as https://gateway.eu1.mindsphere.io. It takes no user, query or fragment. The target sends values to <url>/api/iottimeseries/v3/timeseries/<asset>/<aspect>, and reads the aspects of an asset from <url>/api/assetmanagement/v3/assets/<asset>/aspects. In the console: |
Authentication
| Field | Required | Default | Description |
|---|---|---|---|
token_url | Y | - | The https address of the token service of the tenant, such as https://<tenant>.piam.eu1.mindsphere.io/oauth/token. It takes no user, query or fragment. In the console: |
client_id | Y | - | The client ID of a technical user, or of service credentials. In the console: |
client_secret | Y | - | The secret of that client. In the console: |
client_id and client_secret can each be plain text, an environment variable (${NAME}) or a secret ($secret{name}). The target does not start when one of them is set but resolves to nothing.
Time Series
| Field | Required | Default | Description |
|---|---|---|---|
asset_id | Y | - | The template for the ID of the asset that a value goes to. Insights Hub calls this ID the entity ID. The asset must exist already. See The Templates. In the console: |
aspect | Y | - | The template for the name of the aspect. The asset must have this aspect. In the console: |
variable | N | {metric} | The template for the name of the variable of the aspect. The aspect must have this variable. See Variable Names. In the console: |
Performance
| Field | Required | Default | Description |
|---|---|---|---|
timeout | N | 30 | As on the OTLP page. In the console: |
batch_size | N | 1000 | The most records in one batch. The target splits a batch into as many requests as its values need (see Requests and Answers). In the console: |
max_retries | N | 3 | As on the OTLP page. In the console: |
retry_delay | N | 1 | As on the OTLP page. In the console: |
disable_retries | N | false | As on the OTLP page. In the console: |
Other Settings
headersholds any other header that the target sends as it is. It cannot changeContent-Type,Accept,Content-EncodingorAuthorization. The console does not show the values ofheadersonce they are saved, as for a secret. Otherwise it works as on the OTLP page.- The
tlssettings work as on the OTLP page. The form has no TLS step. - The target never compresses a request.
cumulative_to_deltahas no effect on this target.
Scheduling
See Scheduling and Pool Behavior for interval and cron fields shared by all targets.
Debug Options
The debug options work as on the OTLP page.
The Console Form
The form has one step,
Connection settings :Gateway URL andToken URL side by side. Both are required, and each must start withhttps://.Authentication :Client ID andClient secret side by side, both required. The client secret has the Manual / Environment variable / Vault picker, and it is masked on the review step.Time series :Asset ID template andAspect name template , both required, andVariable name template (Optional, with{metric}as the hint text).Performance :Timeout ,Batch size , the switchDisable retries ,Maximum retries andRetry delay , each Optional, with the defaults 30, 1000, off, 3 and 1. The two retry fields are hidden whileDisable retries is on.
An Optional field that is left empty is not saved, so the default applies. The form has no field for headers, tls or debug: set them in the YAML. The form shows these messages next to a field:
Gateway URL is requiredandGateway URL must be an https URLToken URL is requiredandToken URL must be an https URLClient ID is requiredandClient secret is requiredAsset ID template is requiredandAsset ID template can use only {device}, {metric} and {attr.<key>} in bracesAspect name template is requiredandAspect name template can use only {device}, {metric} and {attr.<key>} in bracesVariable name template can use only {device}, {metric} and {attr.<key>} in bracesBatch size must be a whole number of 1 or more,Maximum retries must be a whole number of 1 or moreandRetry delay must be a whole number of at least 1 second
Details
What the Target Sends
Only metrics:
- the readings of metric devices;
- the metrics that the OpenTelemetry device receives.
The number points of gauges and sums become values of variables. Histograms, exponential histograms and summaries are not sent, because a variable holds single values.
A record that is not a metric, such as a log line, is counted as dropped, with a warning at most once a minute. So route only metrics to this target.
How the Data Reaches Insights Hub
Insights Hub keeps time series for each asset and each aspect of it, and an aspect has typed variables. Each value goes to one variable of one aspect of one asset, as the three templates say.
- The asset, the aspect and the variable must exist already: the target creates none of them.
- The target sends a PUT request with a JSON array of records to
<url>/api/iottimeseries/v3/timeseries/<asset>/<aspect>. A record holds its time in the field_time, in UTC with milliseconds, and the values of the variables at that time, for example[{"_time":"2026-11-02T10:00:00.000Z","temperature":20.5,"running":true}]. - It sends
Content-Type: application/jsonandAuthorization: Bearer <token>with each request.
One Record for Each Time
Insights Hub keeps one record for each asset, aspect and timestamp. A record that is sent for a timestamp that has a record already replaces the whole record, and the variables that the new record does not carry become empty.
- So the target puts all the values of one asset, aspect and millisecond into one record.
- The target also remembers the records that it wrote in the last 10 minutes, up to 10,000 of them in about 16 MB. When a later batch has values for the same asset, aspect and millisecond, the target adds the values that it wrote before to the new record, so that Insights Hub does not empty them. A value of the later batch replaces the earlier value of the same variable.
- The workers of the target take turns for each asset and aspect, so two workers never write the same asset and aspect at once.
- The target cannot add the values that another Director wrote, the values it wrote before the Director restarted, or the values it wrote more than 10 minutes ago. So keep the metrics of one aspect in one route of one Director.
The Templates
asset_id, aspect and variable are templates. As on the AVEVA CONNECT page:
{device}is the name of the device,{metric}is the name of the metric, and{attr.<key>}is the value of the attribute with that key.{attr.<key>}reads the attribute of the point, or else the attribute of its resource, such asservice.instance.idorhost.name.- A template with an unknown placeholder, or a brace without its partner, stops the target from starting.
Variable Names
A variable name holds only the letters A to Z (in either case), digits and _.
- The target replaces every other character with
_, so the default{metric}givescpu_loadfor the metriccpu.load. - When the name starts with a digit, the target puts
vin front of it, so5m_loadbecomesv5m_load. - No variable may be named
_time, because that name holds the time of each record. The target drops a value whose variable gets that name, and logs a warning.
One Series to One Variable
As on the AVEVA CONNECT page:
- One variable holds the values of one series. A series is one metric of one instance of a device or service, from one instrumentation scope, with one set of point attributes. The target tells instances apart by
service.name,service.namespace,service.instance.idandhost.name. - When two series give the same asset ID, aspect and variable, the target sends the first one, drops the values of the later one, and logs a warning. To keep two instances apart, add
{attr.service.instance.id}toasset_id,aspectorvariable. - The target keeps up to 100,000 entries, one for each asset ID, aspect and variable. A series that sends nothing for an hour loses its entry to the next series that asks for it. When 100,000 series hold an entry and none of them has been quiet for an hour, the target sends the values of a new series without this check, so that no value is lost. Two series can then mix their values in that variable.
The Types of the Variables
Before it sends anything, the target reads the aspects of each asset from the Asset Management API, at <url>/api/assetmanagement/v3/assets/<asset>/aspects (100 aspects a page, at most 20 pages), and keeps them for 10 minutes. The workers share what it learns.
- When the asset has no such aspect, or the aspect has no such variable, the target drops the value and logs a warning, because Insights Hub would refuse the whole request.
- A
DOUBLEvariable gets the value as a number. - An
INTvariable gets a whole number from -2,147,483,648 to 2,147,483,647. - A
LONGvariable gets a whole number. When a point records its value as a whole number, the value goes as it is, whatever its size. When a point records a floating-point number, it must be at most 2^53 in size, because a larger one is not exact. - For
INTandLONG, the target drops a value that has a fraction or that is out of range. - A
BOOLEANvariable getsfalsefor 0 andtruefor 1. The target drops any other value. - A
STRING,BIG_STRINGorTIMESTAMPvariable takes no values.
The target may fail to read the aspects of an asset:
- When the Asset Management API answers 403, the client may not read assets. The target cannot check the values then, so it sends them as numbers for 10 minutes, and Insights Hub decides. It logs a warning at most once a minute.
- After any other failed read, the target does the same for that batch only.
- When the asset does not exist (a 404 answer), the target drops its values. It asks again after a minute.
The client needs the right to write time series. For this check, it also needs the right to read assets.
Sign-in
The target signs in with OAuth 2.0 client credentials:
- It posts
grant_type=client_credentialsto the token service, with the client ID and the client secret in an HTTP BasicAuthorizationheader, not in the form. It readsaccess_tokenandexpires_infrom the answer, and it sendsAuthorization: Bearer <token>with each request. - As on the AVEVA CONNECT page, it keeps the token until a minute before it expires. A token that lives less than two minutes is kept for half its lifetime. An answer without
expires_inis taken as a lifetime of five minutes. The workers of the target share one token. - A 401 from Insights Hub drops the token. The target then asks for a new token and tries the request once more. A second 401 makes Director deliver the batch again later.
- A 400 or a 401 from the token service makes Director deliver the batch again later. The warning gives the status and, when the answer has an OAuth error code, that code. It never gives the client secret.
What Is Dropped Before Sending
The target drops a value that Insights Hub would not take, before it sends anything:
- a value that is NaN or an infinity (a point that records no value counts here too);
- a value of 1e126 or more in absolute value, and a non-zero value smaller than 1e-130 in absolute value;
- a point without a timestamp, because the time of Director would differ when the batch is delivered again, and Insights Hub would hold a second record;
- a value whose time is more than 366 days in the past or more than 31 days ahead;
- a reading that lacks an attribute that a template names, in the point or in its resource;
- a value whose asset ID, aspect or variable is empty, or whose variable is named
_time; - a histogram, an exponential histogram or a summary;
- a value that the asset, the aspect or the type of the variable cannot take (see The Types of the Variables).
A warning with the number of dropped values and the reason is logged at most once a minute. These values are counted in the warnings and not as dropped records.
Requests and Answers
The target sends one or more PUT requests for each asset and aspect. Each body holds at most about 100 KB, and a single record that is larger on its own goes in a body of its own. Insights Hub takes at most 100 KB a second for one asset and aspect, and it answers 429 when it gets more. The target sends the requests of one asset and aspect one after the other, and it retries a 429 as described below. The answer of Insights Hub decides what happens next:
- A 2xx answer means that Insights Hub took the request. It checks the request at once and writes it a little later.
- A 400, a 422, and any other 4xx answer that is not named here mean that Insights Hub will never take the request. The target drops the values of the request and logs a warning with the error code and the message of the answer, such as a variable that the aspect does not have.
- A 404 means that the asset or the aspect does not exist. The target drops the values of that asset and aspect in the batch, logs a warning, and asks Asset Management about the asset again in the next batch.
- A 413 means that the request is too large. The target sends its records again in two halves, down to one record. It drops a single record that is still too large.
- A 401 makes the target try once more with a new token, as described under Sign-in. A second 401 makes Director deliver the batch again later.
- A 403 and a redirect make Director deliver the batch again later, because waiting does not mend a permission or an address. The target follows no redirect.
- A 408, a 429 or a 5xx answer, and a failed connection, are tried again within the retry budget: the first try, and then at most
max_retriesmore.- When the answer has a
Retry-Afterheader, the target waits for that time before the next try. The header holds a number of seconds or an HTTP date. The target waits for at most one minute, whatever the header asks for. - A header of
0, or a date that has already passed, means no wait: the target tries again at once. - Without the header, the target waits for
retry_delayseconds. - When the budget is used up, Director delivers the batch again later.
- When the answer has a
- The records of a batch count as delivered once every request has been tried.
- A batch that fails part way is delivered again as a whole. Insights Hub replaces a record that has the same timestamp, so the same values at the same timestamps replace themselves.
Workers
The workers of the target share one token, one list of the series and the variables they hold, one cache of aspects, one memory of the records they wrote and one count of dropped values. So the target can run several workers, and queue.parallelism applies as usual.
Examples
One Aspect of One Asset
Sending every metric to the aspect | |
An Asset for Each Device, a Variable for Each Instance
The asset ID comes from an attribute of the reading, and the client secret from a secret store. Each instance of a service writes its own variable... | |
Troubleshooting
Dropped Values
A warning about dropped values reads [OTLP] dropped <n> values in the last minute: Siemens Insights Hub <reason> target=<name>. The reasons, and what to do:
says the asset <ID> does not exist: checkasset_id, or create the asset in Insights Hub. The target asks again after a minute.says the asset has no aspect named <name>: checkaspect, or add the aspect to the type of the asset.says the aspect <name> has no variable named <name>: checkvariableand the rules under Variable Names, or add the variable to the aspect.refuses a value for <asset>/<aspect>/<variable>: <why>: the type of the variable cannot take the value, for examplehas a fraction, and the variable is INT.already writes this variable for another series, <asset>/<aspect>/<variable>: two series give the same variable. Add{attr.service.instance.id}to a template.has no value for an attribute the asset_id template names(and the same foraspectandvariable): the reading lacks an attribute that the template names.has no asset ID,has no aspect nameorhas no variable name: a template gave an empty name.takes no variable named _time, which is the time of a record: a template gave the variable the name_time.takes no point that records no value,takes no value without a timestamportakes no value with a timestamp more than 366 days back or 31 days ahead: see What Is Dropped Before Sending.stores no histograms or summaries: route only gauges and sums to this target.refused a record that is too large even alone: a single record was still too large after the target split its request down to one record.says the asset or the aspect does not exist: status 404, …andrefused the values: status 400, code <code>, <message>: the answer of Insights Hub, with its error code and message.
Other Log Lines
[OTLP] aspects-denied url=<url> target=<name>: the client may not read the asset's aspects, so values go as numbers: give the client the right to read assets, or accept that the values are not checked.[OTLP] aspects-error url=<url> target=<name> err=<error>: the types of the variables are not known, so values go as numbers: the read failed for that batch, for example because the gateway could not be reached.[OTLP] sign-in-refused target=<name> err=<error>: the token service refused the client. CheckClient ID ,Client secret andToken URL .[OTLP] sign-in-error target=<name> attempt=<n> err=<error>: the token service could not be reached. The target tries again.[OTLP] send-failed … lastStatus=<status> …: Director delivers the batch again later. A 403 means that the client may not write time series. A 429 means that the target sends more than 100 KB a second for one asset and aspect.