206.3.2 INGEST_METRICS Function

This function enables users in a workspace to ingest data in bulk into Oracle AI Database Telemetry Streaming.

This INGEST_METRICS function does a bulk ingest formatted in native JSON format (Telemetry protocol) or line protocol format and returns a JSON with information about the ingest performed.

Syntax

ingest_metrics(
         metrics        IN  CLOB,
         status         OUT NUMBER,
         metrics_format IN  VARCHAR2 default 'telemetry protocol') -- Other value ‘line protocol’
return clob;

Parameters

Table 206-3 INGEST_METRICS Function Parameters

Parameter Description
metrics

Metric data that needs to be inserted as CLOB

status

status specifies if data has been ingested successfully (201- success, 400 - unsuccessful)

metrics_format

Data format used for ingestion. metrics_format can be the native JSON format (Telemetry protocol) or Influx DB Line protocol format

The Telemetry protocol and Line protocol formats used in metrics_format are given in the following examples.

Telemetry Protocol Example

Format:
{ "metrics" : [
                [<metric_name>, <tags as JSON>, <value>, <time in secs since epoch>],
                [<metric_name>, <tags as JSON>, <value>, <time in secs since epoch>]
                   ..
              ]
}
Example:
{ "metrics" : [
                ["scrape_duration_seconds", {"http_scheme":"http","net_host_port":"2112"}, 0, 1704700084],
                ["scrape_samples_scraped", {"http_scheme":"http","net_host_port":"2112"}, 12, 1704700085]
                   ..
              ]
}

Line Protocol Example

Format:
<measurement>[,<tag_key>=<tag_value>[,<tag_key>=<tag_value>]] <field_key>=<field_value>[,<field_key>=<field_value>] [<timestamp>]
Example:
trig,host=phoenix92613 sine=0 1752215852000000000
mem,host=phoenix92613 sine=0 1752215852000000000