import{AsyncApiRealmAPI as r}from"@redocly/realm-asyncapi-sdk";import{PACKAGE_NAME as s}from"../../config/product-gates.js";import{OTEL_TRACES_DEV_URL as o,TELEMETRY_ENABLED as t}from"../constants/common.js";class c extends r.Telemetry{constructor(){super(),this.updateCloudEventData(()=>({organization:{id:process.env.ORGANIZATION_ID||"",slug:process.env.ORGANIZATION_SLUG||""},project:{id:process.env.PROJECT_ID||"",slug:""},productType:"server",sourceDetails:{user:"Anonymous",object:"user",uri:""},request:{source:"server"}}))}initialize(e=!1){this.init({otel:{serviceName:"realm-server",serviceVersion:`${s}@${process.env.REDOCLY_PORTAL_VERSION}`,collectorTraceUrl:e?o:process.env.OTEL_TRACES_URL||"https://otel.cloud.redocly.com/v1/traces",isProd:process.env.REDOCLY_ENV==="production",version:"1.0",tracerName:"server-telemetry",delayMillis:100},disabled:e?process.env.TELEMETRY_DEV_DEBUG!=="true":!t})}}const p=new c;export{p as telemetry};
