@semiont/jobs 0.4.21 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/smelter-main.js +15 -2
- package/dist/smelter-main.js.map +1 -1
- package/dist/worker-main.js +9249 -8
- package/dist/worker-main.js.map +1 -1
- package/package.json +3 -1
package/dist/smelter-main.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { createSmelterActorVM
|
|
2
|
-
import { createTomlConfigLoader, burstBuffer, resourceId, annotationId } from '@semiont/core';
|
|
1
|
+
import { createSmelterActorVM } from '@semiont/sdk';
|
|
2
|
+
import { createTomlConfigLoader, burstBuffer, resourceId, getTargetSelector, getExactText, annotationId } from '@semiont/core';
|
|
3
3
|
import { createEmbeddingProvider, createVectorStore, chunkText } from '@semiont/vectors';
|
|
4
4
|
import { createServer } from 'http';
|
|
5
5
|
import { existsSync, readFileSync } from 'fs';
|
|
6
6
|
import { homedir } from 'os';
|
|
7
7
|
import { join } from 'path';
|
|
8
8
|
import winston from 'winston';
|
|
9
|
+
import { getLogTraceContext } from '@semiont/observability';
|
|
9
10
|
|
|
10
11
|
var __create = Object.create;
|
|
11
12
|
var __defProp = Object.defineProperty;
|
|
@@ -9718,11 +9719,20 @@ var require_operators = __commonJS({
|
|
|
9718
9719
|
// src/smelter-main.ts
|
|
9719
9720
|
var import_rxjs = __toESM(require_cjs());
|
|
9720
9721
|
var import_operators = __toESM(require_operators());
|
|
9722
|
+
var traceContextFormat = winston.format((info) => {
|
|
9723
|
+
const trace = getLogTraceContext();
|
|
9724
|
+
if (trace) {
|
|
9725
|
+
info.trace_id = trace.trace_id;
|
|
9726
|
+
info.span_id = trace.span_id;
|
|
9727
|
+
}
|
|
9728
|
+
return info;
|
|
9729
|
+
})();
|
|
9721
9730
|
function createProcessLogger(component) {
|
|
9722
9731
|
const level = process.env.LOG_LEVEL ?? "info";
|
|
9723
9732
|
const format = process.env.LOG_FORMAT === "simple" ? winston.format.combine(
|
|
9724
9733
|
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
|
|
9725
9734
|
winston.format.errors({ stack: true }),
|
|
9735
|
+
traceContextFormat,
|
|
9726
9736
|
winston.format.printf(({ level: lvl, message, timestamp, ...meta }) => {
|
|
9727
9737
|
const metaStr = Object.keys(meta).length > 0 ? ` ${JSON.stringify(meta)}` : "";
|
|
9728
9738
|
return `${timestamp} [${lvl.toUpperCase()}] [${component}] ${message}${metaStr}`;
|
|
@@ -9730,6 +9740,7 @@ function createProcessLogger(component) {
|
|
|
9730
9740
|
) : winston.format.combine(
|
|
9731
9741
|
winston.format.timestamp(),
|
|
9732
9742
|
winston.format.errors({ stack: true }),
|
|
9743
|
+
traceContextFormat,
|
|
9733
9744
|
winston.format.json()
|
|
9734
9745
|
);
|
|
9735
9746
|
const logger2 = winston.createLogger({
|
|
@@ -9984,6 +9995,8 @@ async function batchAnnotationAdded(events) {
|
|
|
9984
9995
|
eventsProcessed += events.length;
|
|
9985
9996
|
}
|
|
9986
9997
|
async function main() {
|
|
9998
|
+
const { initObservabilityNode } = await import('@semiont/observability/node');
|
|
9999
|
+
initObservabilityNode({ serviceName: "semiont-smelter" });
|
|
9987
10000
|
logger.info("Authenticating", { baseUrl });
|
|
9988
10001
|
authToken = await authenticate();
|
|
9989
10002
|
logger.info("Authenticated");
|