@seeka-labs/sdk-apps-server-telemetry-logging 3.9.6 → 3.9.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{OTLPLogExporter as
|
|
1
|
+
import{OTLPLogExporter as g}from"@opentelemetry/exporter-logs-otlp-proto";import{HttpInstrumentation as S}from"@opentelemetry/instrumentation-http";import{UndiciInstrumentation as L}from"@opentelemetry/instrumentation-undici";import{WinstonInstrumentation as P}from"@opentelemetry/instrumentation-winston";import{BatchLogRecordProcessor as I}from"@opentelemetry/sdk-logs";import{resourceFromAttributes as h}from"@opentelemetry/resources";import{NodeSDK as w}from"@opentelemetry/sdk-node";import{ATTR_SERVICE_NAME as N,ATTR_SERVICE_VERSION as A}from"@opentelemetry/semantic-conventions";var c=class{constructor(r){this.wrapped=r}onEmit(r,t){let n=r.attributes;if(n)for(let e of Object.keys(n)){let a=n[e];if(!this.isValidAttributeValue(a))try{n[e]=JSON.stringify(a)}catch{n[e]=String(a)}}this.wrapped.onEmit(r,t)}shutdown(){return this.wrapped.shutdown()}forceFlush(){return this.wrapped.forceFlush()}isValidAttributeValue(r){return r==null||typeof r=="string"||typeof r=="number"||typeof r=="boolean"?!0:Array.isArray(r)?r.every(t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean"):!1}};var o=null,E=null,m="__SEEKA_OTEL_REGISTERED__",H=(i,r,t,n,e,a)=>{let l=h({[N]:i,[A]:r,"service.namespace":"devapp","service.instance.id":e.WEBSITE_ROLE_INSTANCE_ID,"faas.name":e.WEBSITE_SITE_NAME,"faas.instance":e.WEBSITE_ROLE_INSTANCE_ID,"faas.version":e.OTEL_SERVICE_VERSION,"deployment.environment":e.NODE_ENV,"cloud.region":e.REGION_NAME,"cloud.provider":t,"cloud.platform":n,"seeka.app.id":e.SEEKA_APP_ID?.replace(/-/g,""),"seeka.app.name":i,...a});if(e.OTEL_SDK_DISABLED==="true")return l;if(global[m]==!0||o)return console.warn("[otel] OpenTelemetry SDK already started"),l;global[m]=!0;let u=[],d=e.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT||e.OTEL_EXPORTER_OTLP_ENDPOINT;if(d){let s=e.OTEL_EXPORTER_OTLP_LOGS_HEADERS||e.OTEL_EXPORTER_OTLP_HEADERS,f={};s&&(f=s.split(",").reduce((y,T)=>{let[O,R]=T.split("=");return{...y,[O]:R}},{})),E=new g({url:d,headers:f});let _=new I(E);u.push(new c(_))}o=new w({resource:l,instrumentations:[new P({}),new L,new S],logRecordProcessors:u});try{o.start(),e.NODE_ENV!=="production"&&console.log("[otel] OpenTelemetry SDK started")}catch(s){console.error("[otel] OpenTelemetry SDK failed to start",s)}let p=async()=>{try{if(!o)return;await o.shutdown(),console.log("[otel] OpenTelemetry SDK shut down")}catch(s){console.error("[otel] Error during OpenTelemetry shutdown",s)}};return process.on("SIGTERM",p),process.on("SIGINT",p),l},M=async()=>{try{o&&typeof o.forceFlush=="function"&&await o.forceFlush()}catch(i){console.error("[otel] forceFlush failed",i)}};export{M as forceFlushOpenTelemetry,H as registerSeekaAppOpenTelemetry};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seeka-labs/sdk-apps-server-telemetry-logging",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.7",
|
|
4
4
|
"description": "Seeka - Apps SDK - Server Telemetry Logging (App health and logging)",
|
|
5
5
|
"author": "SEEKA <platform@seeka.co>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"undici": "^7",
|
|
75
75
|
"winston": "^3"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "2ed87ad7a4f3c817a9906393a0642013156018dc"
|
|
78
78
|
}
|