1 | {"version":3,"sources":["../../../../telemetry/trace/report/to-zipkin.ts"],"names":["traceId","process","env","TRACE_ID","toString","localEndpoint","serviceName","ipv4","port","zipkinUrl","reportToLocalHost","name","duration","timestamp","id","parentId","attrs","body","tags","method","headers","JSON","stringify","catch"],"mappings":"4DAAA,8BACA,6D,mFAEA,GAAIA,CAAAA,OAAO,CAAGC,OAAO,CAACC,GAAR,CAAYC,QAA1B,CACA,GAAI,CAACH,OAAL,CAAc,CACZA,OAAO,CAAGC,OAAO,CAACC,GAAR,CAAYC,QAAZ,CAAuB,wBAAY,CAAZ,EAAeC,QAAf,CAAwB,KAAxB,CAAjC,CACD,CAED,KAAMC,CAAAA,aAAa,CAAG,CACpBC,WAAW,CAAE,cADO,CAEpBC,IAAI,CAAE,WAFc,CAGpBC,IAAI,CAAE,IAHc,CAAtB,CAKA,KAAMC,CAAAA,SAAS,CAAI,UAASJ,aAAa,CAACE,IAAK,IAAGF,aAAa,CAACG,IAAK,eAArE,CAEA,KAAME,CAAAA,iBAAiB,CAAG,CACxBC,IADwB,CAExBC,QAFwB,CAGxBC,SAHwB,CAIxBC,EAJwB,CAKxBC,QALwB,CAMxBC,KANwB,GAOrB,CACH,KAAMC,CAAAA,IAAI,CAAG,CACX,CACEjB,OADF,CAEEe,QAFF,CAGEJ,IAHF,CAIEG,EAJF,CAKED,SALF,CAMED,QANF,CAOEP,aAPF,CAQEa,IAAI,CAAEF,KARR,CADW,CAAb,CAaA;AACA,uBAAMP,SAAN,CAAiB,CACfU,MAAM,CAAE,MADO,CAEfC,OAAO,CAAE,CAAE,eAAgB,kBAAlB,CAFM,CAGfH,IAAI,CAAEI,IAAI,CAACC,SAAL,CAAeL,IAAf,CAHS,CAAjB,EAIGM,KAJH,CAIS,IAAM,CAAE,CAJjB,EAKD,CA3BD,C,aA6Beb,iB","sourcesContent":["import { randomBytes } from 'crypto'\nimport fetch from 'node-fetch'\n\nlet traceId = process.env.TRACE_ID\nif (!traceId) {\n traceId = process.env.TRACE_ID = randomBytes(8).toString('hex')\n}\n\nconst localEndpoint = {\n serviceName: 'zipkin-query',\n ipv4: '127.0.0.1',\n port: 9411,\n}\nconst zipkinUrl = `http://${localEndpoint.ipv4}:${localEndpoint.port}/api/v2/spans`\n\nconst reportToLocalHost = (\n name: string,\n duration: number,\n timestamp: number,\n id: string,\n parentId?: string,\n attrs?: Object\n) => {\n const body = [\n {\n traceId,\n parentId,\n name,\n id,\n timestamp,\n duration,\n localEndpoint,\n tags: attrs,\n },\n ]\n\n // We intentionally do not block on I/O here.\n fetch(zipkinUrl, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n }).catch(() => {})\n}\n\nexport default reportToLocalHost\n"]} |