mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
save logs to otel
This commit is contained in:
parent
3841b655e5
commit
9fe998a43d
@ -5,5 +5,5 @@
|
|||||||
Please use
|
Please use
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
dotnet run
|
dotnet run --urls=http://localhost:7856/
|
||||||
```
|
```
|
@ -6,3 +6,5 @@
|
|||||||
2.0
|
2.0
|
||||||
2.0
|
2.0
|
||||||
2.0
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
@ -189,7 +189,7 @@ router.post(
|
|||||||
try {
|
try {
|
||||||
logger.info('OTel Ingestor API called');
|
logger.info('OTel Ingestor API called');
|
||||||
|
|
||||||
logger.info(req.body);
|
req.body = req.body.toJSON();
|
||||||
|
|
||||||
const resourceLogs = req.body['resourceLogs'] as JSONArray;
|
const resourceLogs = req.body['resourceLogs'] as JSONArray;
|
||||||
|
|
||||||
@ -228,7 +228,12 @@ router.post(
|
|||||||
dbLog.time = OneUptimeDate.fromUnixNano(log['timeUnixNano'] as number);
|
dbLog.time = OneUptimeDate.fromUnixNano(log['timeUnixNano'] as number);
|
||||||
dbLog.severityNumber = log['severityNumber'] as string;
|
dbLog.severityNumber = log['severityNumber'] as string;
|
||||||
dbLog.severityText = log['severityText'] as string;
|
dbLog.severityText = log['severityText'] as string;
|
||||||
dbLog.body = log['body'] as string;
|
|
||||||
|
const logBody: JSONObject = log['body'] as JSONObject;
|
||||||
|
|
||||||
|
|
||||||
|
dbLog.body = logBody['stringValue'] as string;
|
||||||
|
|
||||||
dbLog.traceId = log['traceId'] as string;
|
dbLog.traceId = log['traceId'] as string;
|
||||||
dbLog.spanId = log['spanId'] as string;
|
dbLog.spanId = log['spanId'] as string;
|
||||||
|
|
||||||
@ -238,6 +243,8 @@ router.post(
|
|||||||
'attributes'
|
'attributes'
|
||||||
] as JSONArray;
|
] as JSONArray;
|
||||||
|
|
||||||
|
if (attributes) {
|
||||||
|
|
||||||
const dbattributes: Array<KeyValueNestedModel> = [];
|
const dbattributes: Array<KeyValueNestedModel> = [];
|
||||||
|
|
||||||
for (const attribute of attributes) {
|
for (const attribute of attributes) {
|
||||||
@ -264,6 +271,7 @@ router.post(
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbLog.attributes = dbattributes;
|
dbLog.attributes = dbattributes;
|
||||||
|
}
|
||||||
|
|
||||||
dbLogs.push(dbLog);
|
dbLogs.push(dbLog);
|
||||||
|
|
||||||
|
@ -1,24 +1,3 @@
|
|||||||
/**
|
|
||||||
* CREATE TABLE opentelemetry_logs
|
|
||||||
(
|
|
||||||
trace_id String,
|
|
||||||
span_id String,
|
|
||||||
name String,
|
|
||||||
time DateTime('UTC'),
|
|
||||||
body String,
|
|
||||||
attributes Nested
|
|
||||||
(
|
|
||||||
key String,
|
|
||||||
value String
|
|
||||||
),
|
|
||||||
flags Int32,
|
|
||||||
severity_number Int32,
|
|
||||||
severity_text String
|
|
||||||
) ENGINE = MergeTree()
|
|
||||||
ORDER BY (trace_id, span_id);
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
import AnalyticsBaseModel from 'Common/AnalyticsModels/BaseModel';
|
import AnalyticsBaseModel from 'Common/AnalyticsModels/BaseModel';
|
||||||
import AnalyticsTableColumn from 'Common/Types/AnalyticsDatabase/TableColumn';
|
import AnalyticsTableColumn from 'Common/Types/AnalyticsDatabase/TableColumn';
|
||||||
import TableColumnType from 'Common/Types/AnalyticsDatabase/TableColumnType';
|
import TableColumnType from 'Common/Types/AnalyticsDatabase/TableColumnType';
|
||||||
|
@ -1,49 +1,3 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* CREATE TABLE opentelemetry_spans
|
|
||||||
(
|
|
||||||
trace_id String,
|
|
||||||
span_id String,
|
|
||||||
trace_state String,
|
|
||||||
parent_span_id String,
|
|
||||||
name String,
|
|
||||||
kind Int32,
|
|
||||||
start_time DateTime('UTC'),
|
|
||||||
end_time DateTime('UTC'),
|
|
||||||
attributes Nested
|
|
||||||
(
|
|
||||||
key String,
|
|
||||||
value String
|
|
||||||
),
|
|
||||||
events Nested
|
|
||||||
(
|
|
||||||
time DateTime('UTC'),
|
|
||||||
name String,
|
|
||||||
attributes Nested
|
|
||||||
(
|
|
||||||
key String,
|
|
||||||
value String
|
|
||||||
)
|
|
||||||
),
|
|
||||||
links Nested
|
|
||||||
(
|
|
||||||
trace_id String,
|
|
||||||
span_id String,
|
|
||||||
trace_state String,
|
|
||||||
attributes Nested
|
|
||||||
(
|
|
||||||
key String,
|
|
||||||
value String
|
|
||||||
)
|
|
||||||
),
|
|
||||||
status_code Int32,
|
|
||||||
status_message String
|
|
||||||
) ENGINE = MergeTree()
|
|
||||||
ORDER BY (trace_id, span_id);
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
import AnalyticsBaseModel from 'Common/AnalyticsModels/BaseModel';
|
import AnalyticsBaseModel from 'Common/AnalyticsModels/BaseModel';
|
||||||
import AnalyticsTableColumn from 'Common/Types/AnalyticsDatabase/TableColumn';
|
import AnalyticsTableColumn from 'Common/Types/AnalyticsDatabase/TableColumn';
|
||||||
import TableColumnType from 'Common/Types/AnalyticsDatabase/TableColumnType';
|
import TableColumnType from 'Common/Types/AnalyticsDatabase/TableColumnType';
|
||||||
|
Loading…
Reference in New Issue
Block a user