(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4053],{90950:(M,h,t)=>{"use strict";t.d(h,{n:()=>m});var u=t(52423),r=t(68404),e=t(5916),o=t(11543),l=t(81764),f=t(8944);function m({options:s,onOptionsChange:a}){return r.createElement("div",{className:p.container},r.createElement("h3",{className:"page-heading"},"Node Graph"),r.createElement(o.Z,{className:p.row},r.createElement(l._,{tooltip:"Enables the Node Graph visualization in the trace viewer.",label:"Enable Node Graph",labelWidth:26},r.createElement(f.x,{id:"enableNodeGraph",value:s.jsonData.nodeGraph?.enabled,onChange:c=>(0,e.tp)({onOptionsChange:a,options:s},"nodeGraph",{...s.jsonData.nodeGraph,enabled:c.currentTarget.checked})}))))}const p={container:u.css`
    label: container;
    width: 100%;
  `,row:u.css`
    label: row;
    align-items: baseline;
  `}},48288:(M,h,t)=>{"use strict";t.d(h,{F:()=>c});var u=t(52423),r=t(68404),e=t(5916),o=t(53117),l=t(72648),f=t(11543),m=t(81764),p=t(31403),s=t(46967),a=t(33045);function c({options:i,onOptionsChange:E}){const C=(0,l.wW)(v);return r.createElement("div",{className:(0,u.css)({width:"100%"})},r.createElement("h3",{className:"page-heading"},"Trace to metrics"),r.createElement("div",{className:C.infoText},"Trace to metrics lets you navigate from a trace span to the selected data source."),r.createElement(f.Z,{className:C.row},r.createElement(m._,{tooltip:"The data source the trace is going to navigate to",label:"Data source",labelWidth:26},r.createElement(o.q,{inputId:"trace-to-metrics-data-source-picker",pluginId:"prometheus",current:i.jsonData.tracesToMetrics?.datasourceUid,noDefault:!0,width:40,onChange:I=>(0,e.tp)({onOptionsChange:E,options:i},"tracesToMetrics",{...i.jsonData.tracesToMetrics,datasourceUid:I.uid})})),i.jsonData.tracesToMetrics?.datasourceUid?r.createElement(p.zx,{type:"button",variant:"secondary",size:"sm",fill:"text",onClick:()=>{(0,e.tp)({onOptionsChange:E,options:i},"tracesToMetrics",{...i.jsonData.tracesToMetrics,datasourceUid:void 0})}},"Clear"):null),r.createElement(f.Z,null,r.createElement(m._,{tooltip:"Tags that will be used in the metrics query.",label:"Tags",labelWidth:26},r.createElement(a.a,{values:i.jsonData.tracesToMetrics?.tags??[],onChange:I=>(0,e.tp)({onOptionsChange:E,options:i},"tracesToMetrics",{...i.jsonData.tracesToMetrics,tags:I})}))),r.createElement(f.Z,null,r.createElement(m._,{label:"Span start time shift",labelWidth:26,grow:!0,tooltip:"Shifts the start time of the span. Default 0 (Time units can be used here, for example: 5s, 1m, 3h)"},r.createElement(s.I,{type:"text",placeholder:"-1h",width:40,onChange:I=>(0,e.tp)({onOptionsChange:E,options:i},"tracesToMetrics",{...i.jsonData.tracesToMetrics,spanStartTimeShift:I.currentTarget.value}),value:i.jsonData.tracesToMetrics?.spanStartTimeShift||""}))),r.createElement(f.Z,null,r.createElement(m._,{label:"Span end time shift",labelWidth:26,grow:!0,tooltip:"Shifts the end time of the span. Default 0 Time units can be used here, for example: 5s, 1m, 3h"},r.createElement(s.I,{type:"text",placeholder:"1h",width:40,onChange:I=>(0,e.tp)({onOptionsChange:E,options:i},"tracesToMetrics",{...i.jsonData.tracesToMetrics,spanEndTimeShift:I.currentTarget.value}),value:i.jsonData.tracesToMetrics?.spanEndTimeShift||""}))),i.jsonData.tracesToMetrics?.queries?.map((I,N)=>r.createElement("div",{key:N,className:C.queryRow},r.createElement(m._,{label:"Link Label",labelWidth:10},r.createElement(s.I,{label:"Link Label",type:"text",allowFullScreen:!0,value:I.name,onChange:R=>{let W=i.jsonData.tracesToMetrics?.queries.slice()??[];W[N].name=R.currentTarget.value,(0,e.tp)({onOptionsChange:E,options:i},"tracesToMetrics",{...i.jsonData.tracesToMetrics,queries:W})}})),r.createElement(m._,{label:"Query",labelWidth:10,tooltip:"The Prometheus query that will run when navigating from a trace to metrics. Interpolate tags using the `$__tags` keyword.",grow:!0},r.createElement(s.I,{label:"Query",type:"text",allowFullScreen:!0,value:I.query,onChange:R=>{let W=i.jsonData.tracesToMetrics?.queries.slice()??[];W[N].query=R.currentTarget.value,(0,e.tp)({onOptionsChange:E,options:i},"tracesToMetrics",{...i.jsonData.tracesToMetrics,queries:W})}})),r.createElement(p.zx,{variant:"destructive",title:"Remove query",icon:"times",type:"button",onClick:()=>{let R=i.jsonData.tracesToMetrics?.queries.slice();R?.splice(N,1),(0,e.tp)({onOptionsChange:E,options:i},"tracesToMetrics",{...i.jsonData.tracesToMetrics,queries:R})}}))),r.createElement(p.zx,{variant:"secondary",title:"Add query",icon:"plus",type:"button",onClick:()=>{(0,e.tp)({onOptionsChange:E,options:i},"tracesToMetrics",{...i.jsonData.tracesToMetrics,queries:[...i.jsonData.tracesToMetrics?.queries??[],{query:""}]})}},"Add query"))}const v=i=>({infoText:u.css`
    padding-bottom: ${i.spacing(2)};
    color: ${i.colors.text.secondary};
  `,row:u.css`
    label: row;
    align-items: baseline;
  `,queryRow:u.css`
    display: flex;
  `})},49427:(M,h,t)=>{"use strict";t.d(h,{et:()=>o,fy:()=>f,nO:()=>l,np:()=>p});var u=t(38685),r=t(5367),e=t(14582);function o(s){return s.sort((c,v)=>c[0]-v[0]),s.reduce((c,v)=>{if(!c.length)return[v];const i=c.slice(-1)[0],[E,C]=i,[I,N]=v;return N<C?c:I>C?[...c,v]:[...c.slice(0,-1),[E,N]]},[]).reduce((c,v)=>c+(v[1]-v[0]),0)}function l(s){const a={};let c;for(let v=0;c=s(v),!!c;v++){a[c.id]?a[c.id].span=c.span:a[c.id]={span:c.span,children:[]};for(const i of c.parentIds)i&&(a[i]?a[i].children.push(c.id):a[i]={span:void 0,children:[c.id]})}return a}function f(s,a,c){return{main:`${m(s)}ms (${m(s/a*100)}%)`,secondary:`${m(c)}ms (${m(c/s*100)}%)`}}function m(s){return parseFloat(s.toFixed(2))}function p(){const s=new u.v({fields:[{name:r.z.id,type:e.fS.string},{name:r.z.title,type:e.fS.string},{name:r.z.subTitle,type:e.fS.string},{name:r.z.mainStat,type:e.fS.string,config:{displayName:"Total time (% of trace)"}},{name:r.z.secondaryStat,type:e.fS.string,config:{displayName:"Self time (% of total)"}},{name:r.z.color,type:e.fS.number,config:{color:{mode:"continuous-GrYlRd"},displayName:"Self time / Trace duration"}}],meta:{preferredVisualisationType:"nodeGraph"}}),a=new u.v({fields:[{name:r.z.id,type:e.fS.string},{name:r.z.target,type:e.fS.string},{name:r.z.source,type:e.fS.string}],meta:{preferredVisualisationType:"nodeGraph"}});return[s,a]}},94053:(M,h,t)=>{"use strict";t.r(h),t.d(h,{plugin:()=>ye});var u=t(7238),r=t(52423),e=t(68404),o=t(72648);function l(){const g=(0,o.wW)(f);return e.createElement(e.Fragment,null,e.createElement("h2",{id:"jaeger-cheat-sheet"},"Jaeger Cheat Sheet"),e.createElement("p",null,"This cheat sheet provides a quick overview of the query types that are available. For more details about the Jaeger data source, check out"," ",e.createElement("a",{href:"https://grafana.com/docs/grafana/latest/datasources/jaeger",target:"_blank",rel:"noreferrer",className:g.anchorTag},"the documentation"),"."),e.createElement("hr",null),e.createElement("ul",{className:g.unorderedList},e.createElement("li",null,"Search - filter traces by service name. Addtionally, you can filter by tags or min/max duration, as well as limit the number of traces that are returned."),e.createElement("li",null,"TraceID - if you have a trace ID, simply enter the trace ID to see the trace."),e.createElement("li",null,"JSON File - you can upload a JSON file that contains a single trace to visualize it. If the file has multiple traces then the first trace is used for visualization. An example of a valid JSON file can be found in"," ",e.createElement("a",{href:"https://grafana.com/docs/grafana/latest/datasources/jaeger/#upload-json-trace-file",target:"_blank",rel:"noreferrer",className:g.anchorTag},"this section")," ","of the documentation.")))}const f=g=>({anchorTag:r.css`
    color: ${g.colors.text.link};
  `,unorderedList:r.css`
    list-style-type: none;
  `});var m=t(35645),p=t(12006),s=t(12580),a=t(90950),c=t(83437),v=t(48288),i=t(67089);const E=({options:g,onOptionsChange:n})=>e.createElement(e.Fragment,null,e.createElement(p.E,{defaultUrl:"http://localhost:16686",dataSourceConfig:g,showAccessOptions:!1,onChange:n}),m.v.featureToggles.secureSocksDatasourceProxy&&e.createElement(s.i,{options:g,onOptionsChange:n}),e.createElement("div",{className:"gf-form-group"},e.createElement(c.Z,{options:g,onOptionsChange:n})),m.v.featureToggles.traceToMetrics?e.createElement("div",{className:"gf-form-group"},e.createElement(v.F,{options:g,onOptionsChange:n})):null,e.createElement("div",{className:"gf-form-group"},e.createElement(a.n,{options:g,onOptionsChange:n})),e.createElement("div",{className:"gf-form-group"},e.createElement(i.SpanBarSettings,{options:g,onOptionsChange:n})));var C=t(30784),I=t(11543),N=t(81764),R=t(69659),W=t(2594),Q=t(63134),z=t(40885),ee=t(27303),V=t(53217),$=t(46967),te=t(659),ae=t(60499),re=t(3153),ne=t(27854),Z=t.n(ne);function se(g){if(!g)return"";const n=Z().parse(g);return Object.keys(n).forEach(d=>{const T=n[d];typeof T!="string"&&(n[d]=String(T))}),JSON.stringify(n)}function ie(g){if(!g)return"";try{return Z().stringify(JSON.parse(g))}catch{return g}}const H="e.g. 1.2s, 100ms, 500us",Y="All",oe={label:Y,value:void 0};function le({datasource:g,query:n,onChange:d}){const[T,S]=(0,e.useState)(),[D,O]=(0,e.useState)(),[b,U]=(0,e.useState)({services:!1,operations:!1}),F=(0,e.useCallback)(async(y,P,A="")=>{U(x=>({...x,[P]:!0}));try{const x=await g.metadataRequest(y);return x?x.sort().map(B=>({label:B,value:B})).filter(B=>B.value?(0,ee.C)(B.value,A).found:!1):[{label:`No ${P} found`,value:`No ${P} found`}]}catch(x){return x instanceof Error&&(0,re.WI)((0,te.$l)((0,ae.t_)("Error",x))),[]}finally{U(x=>({...x,[P]:!1}))}},[g]);return(0,e.useEffect)(()=>{(async()=>{const P=await F("/api/services","services");n.service&&(0,z.J)().containsTemplate(n.service)&&P.push((0,Q.E)(n.service)),S(P)})()},[g,F,n.service]),(0,e.useEffect)(()=>{const y=async()=>{const P=await F(`/api/services/${encodeURIComponent((0,z.J)().replace(n.service))}/operations`,"operations");n.operation&&(0,z.J)().containsTemplate(n.operation)&&P.push((0,Q.E)(n.operation)),O([oe,...P])};n.service&&y()},[g,n.service,F,n.operation]),e.createElement("div",{className:(0,r.css)({maxWidth:"500px"})},e.createElement(I.Z,null,e.createElement(N._,{label:"Service Name",labelWidth:14,grow:!0},e.createElement(V.Ph,{inputId:"service",options:T,onOpenMenu:()=>F("/api/services","services"),isLoading:b.services,value:T?.find(y=>y?.value===n.service)||void 0,placeholder:"Select a service",onChange:y=>d({...n,service:y?.value,operation:n.service!==y?.value?void 0:n.operation}),menuPlacement:"bottom",isClearable:!0,"aria-label":"select-service-name",allowCustomValue:!0}))),e.createElement(I.Z,null,e.createElement(N._,{label:"Operation Name",labelWidth:14,grow:!0,disabled:!n.service},e.createElement(V.Ph,{inputId:"operation",options:D,onOpenMenu:()=>F(`/api/services/${encodeURIComponent((0,z.J)().replace(n.service))}/operations`,"operations"),isLoading:b.operations,value:D?.find(y=>y.value===n.operation)||null,placeholder:"Select an operation",onChange:y=>d({...n,operation:y?.value||void 0}),menuPlacement:"bottom",isClearable:!0,"aria-label":"select-operation-name",allowCustomValue:!0}))),e.createElement(I.Z,null,e.createElement(N._,{label:"Tags",labelWidth:14,grow:!0,tooltip:"Values should be in logfmt."},e.createElement($.I,{id:"tags",value:ie(n.tags),placeholder:"http.status_code=200 error=true",onChange:y=>d({...n,tags:y.currentTarget.value})}))),e.createElement(I.Z,null,e.createElement(N._,{label:"Min Duration",labelWidth:14,grow:!0},e.createElement($.I,{id:"minDuration",name:"minDuration",value:n.minDuration||"",placeholder:H,onChange:y=>d({...n,minDuration:y.currentTarget.value})}))),e.createElement(I.Z,null,e.createElement(N._,{label:"Max Duration",labelWidth:14,grow:!0},e.createElement($.I,{id:"maxDuration",name:"maxDuration",value:n.maxDuration||"",placeholder:H,onChange:y=>d({...n,maxDuration:y.currentTarget.value})}))),e.createElement(I.Z,null,e.createElement(N._,{label:"Limit",labelWidth:14,grow:!0,tooltip:"Maximum number of returned results"},e.createElement($.I,{id:"limit",name:"limit",value:n.limit||"",type:"number",onChange:y=>d({...n,limit:y.currentTarget.value?parseInt(y.currentTarget.value,10):void 0})}))))}const Se=null;function ce({datasource:g,query:n,onChange:d,onRunQuery:T}){const S=(0,o.wW)(ue),D=b=>{const U={...n,query:b};d(U)},O=()=>{switch(n.queryType){case"search":return e.createElement(le,{datasource:g,query:n,onChange:d});case"upload":return e.createElement("div",{className:S.fileDropzoneContainer},e.createElement(C.Yo,{options:{multiple:!1},onLoad:b=>{g.uploadedJson=b,T()}}));default:return e.createElement(I.Z,null,e.createElement(N._,{label:"Trace ID",labelWidth:14,grow:!0},e.createElement(R.q,{query:n.query,onChange:D,onRunQuery:T,onBlur:()=>{},placeholder:"Enter a Trace ID (run with Shift+Enter)",portalOrigin:"jaeger"})))}};return e.createElement(e.Fragment,null,e.createElement("div",{className:S.container},e.createElement(I.Z,null,e.createElement(N._,{label:"Query type"},e.createElement(W.S,{options:[{value:"search",label:"Search"},{value:void 0,label:"TraceID"},{value:"upload",label:"JSON File"}],value:n.queryType,onChange:b=>d({...n,queryType:b}),size:"md"}))),O()))}const ue=g=>({container:r.css`
    width: 100%;
  `,fileDropzoneContainer:r.css`
    padding: ${g.spacing(2)};
  `});var J=t(82897),X=t(3363),j=t(53786),w=t(2101),me=t(94514),fe=t(21053),de=t(38685),pe=t(14582),ge=t(54899),he=t(8878),ve=t(19349),L=t(5367),K=t(49427);function k(g){const{nodes:n,edges:d}=Te(g),[T,S]=(0,K.np)();for(const D of n)T.add(D);for(const D of d)S.add(D);return[T,S]}function Te(g){const n=[],d=[],T=De(g.spans),S=(0,K.nO)(D=>{if(D>=g.spans.length)return;const O=g.spans[D];return{span:O,id:O.spanID,parentIds:O.references?.filter(b=>b.refType==="CHILD_OF").map(b=>b.spanID)||[]}});for(const D of g.spans){const O=g.processes[D.processID],b=S[D.spanID].children.map(A=>{const x=S[A].span;return[x.startTime,x.startTime+x.duration]}),U=(0,K.et)(b),F=D.duration-U,y=(0,K.fy)(D.duration/1e3,T/1e3,F/1e3);n.push({[L.z.id]:D.spanID,[L.z.title]:O?.serviceName??"",[L.z.subTitle]:D.operationName,[L.z.mainStat]:y.main,[L.z.secondaryStat]:y.secondary,[L.z.color]:F/T});const P=D.references?.find(A=>A.refType==="CHILD_OF")?.spanID;P&&S[P].span&&d.push({[L.z.id]:P+"--"+D.spanID,[L.z.target]:D.spanID,[L.z.source]:P})}return{nodes:n,edges:d}}function De(g){let n=0,d=1/0;for(const T of g)T.startTime<d&&(d=T.startTime),T.startTime+T.duration>n&&(n=T.startTime+T.duration);return n-d}var G=t(96606);class Ee extends u.MF{constructor(n,d=(0,ve.$t)(),T=(0,z.J)()){super(n),this.instanceSettings=n,this.timeSrv=d,this.templateSrv=T,this.uploadedJson=null,this.nodeGraph=n.jsonData.nodeGraph}async metadataRequest(n,d){return(await(0,X.n)(this._request(n,d,{hideFromInspector:!0}))).data.data}isSearchFormValid(n){return!!n.service}query(n){const d=n.targets[0];if(!d)return(0,j.of)({data:[_]});if(d.queryType==="search"&&!this.isSearchFormValid(d))return(0,j.of)({error:{message:"You must select a service."},data:[]});if(d.queryType!=="search"&&d.query)return this._request(`/api/traces/${encodeURIComponent(this.templateSrv.replace(d.query,n.scopedVars))}`).pipe((0,w.U)(D=>{const O=D?.data?.data?.[0];if(!O)return{data:[_]};let b=[(0,G.xM)(O)];return this.nodeGraph?.enabled&&b.push(...k(O)),{data:b}}));if(d.queryType==="upload"){if(!this.uploadedJson)return(0,j.of)({data:[]});try{const D=JSON.parse(this.uploadedJson).data[0];let O=[(0,G.xM)(D)];return this.nodeGraph?.enabled&&O.push(...k(D)),(0,j.of)({data:O})}catch{return(0,j.of)({error:{message:"The JSON file uploaded is not in a valid Jaeger format"},data:[]})}}let T=(0,J.pick)(this.applyVariables(d,n.scopedVars),["service","operation","tags","minDuration","maxDuration","limit"]),S=(0,J.pickBy)(T,J.identity);return S.operation===Y&&(S=(0,J.omit)(S,"operation")),S.tags&&(S={...S,tags:se(S.tags.toString())}),this._request("/api/traces",{...S,...this.getTimeRange(),lookback:"custom"}).pipe((0,w.U)(D=>({data:[(0,G.Wp)(D.data.data,this.instanceSettings)]})))}interpolateVariablesInQueries(n,d){return!n||n.length===0?[]:n.map(T=>({...T,datasource:this.getRef(),...this.applyVariables(T,d)}))}applyVariables(n,d){let T={...n};return n.tags&&this.templateSrv.containsTemplate(n.tags)&&(T={...n,tags:this.templateSrv.replace(n.tags,d)}),{...T,service:this.templateSrv.replace(n.service??"",d),operation:this.templateSrv.replace(n.operation??"",d),minDuration:this.templateSrv.replace(n.minDuration??"",d),maxDuration:this.templateSrv.replace(n.maxDuration??"",d)}}async testDatasource(){return(0,X.n)(this._request("/api/services").pipe((0,w.U)(n=>(n?.data?.data||[]).length>0?{status:"success",message:"Data source connected and services found."}:{status:"error",message:"Data source connected, but no services received. Verify that Jaeger is configured properly."}),(0,me.K)(n=>{let d="Jaeger: ";return n.statusText?d+=n.statusText:d+="Cannot connect to Jaeger",n.status&&(d+=`. ${n.status}`),n.data&&n.data.message?d+=`. ${n.data.message}`:n.data&&(d+=`. ${JSON.stringify(n.data)}`),(0,j.of)({status:"error",message:d})})))}getTimeRange(){const n=this.timeSrv.timeRange();return{start:q(n.from,!1),end:q(n.to,!0)}}getQueryDisplayText(n){return n.query||""}_request(n,d,T){const S=d?(0,he.tW)(d):"",D=`${this.instanceSettings.url}${n}${S.length?`?${S}`:""}`,O={...T,url:D};return(0,ge.i)().fetch(O)}}function q(g,n){return typeof g=="string"&&(g=fe.parse(g,n)),g.valueOf()*1e3}const _=new de.v({fields:[{name:"trace",type:pe.fS.trace,values:[]}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"jaeger"}}}),ye=new u.hf(Ee).setConfigEditor(E).setQueryEditor(ce).setQueryEditorHelp(l)},96606:(M,h,t)=>{"use strict";t.d(h,{Wp:()=>f,c6:()=>p,xM:()=>o});var u=t(38685),r=t(14582),e=t(67089);function o(s){const a=s.spans.map(v=>l(v,s.processes)),c=new u.v({fields:[{name:"traceID",type:r.fS.string},{name:"spanID",type:r.fS.string},{name:"parentSpanID",type:r.fS.string},{name:"operationName",type:r.fS.string},{name:"serviceName",type:r.fS.string},{name:"serviceTags",type:r.fS.other},{name:"startTime",type:r.fS.number},{name:"duration",type:r.fS.number},{name:"logs",type:r.fS.other},{name:"tags",type:r.fS.other},{name:"warnings",type:r.fS.other},{name:"stackTraces",type:r.fS.other}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"jaeger"}}});for(const v of a)c.add(v);return c}function l(s,a){return{spanID:s.spanID,traceID:s.traceID,parentSpanID:s.references?.find(c=>c.refType==="CHILD_OF")?.spanID,operationName:s.operationName,startTime:s.startTime/1e3,duration:s.duration/1e3,logs:s.logs.map(c=>({...c,timestamp:c.timestamp/1e3})),tags:s.tags,warnings:s.warnings??void 0,stackTraces:s.stackTraces,serviceName:a[s.processID].serviceName,serviceTags:a[s.processID].tags}}function f(s,a){const c=new u.v({fields:[{name:"traceID",type:r.fS.string,config:{unit:"string",displayNameFromDS:"Trace ID",links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:a.uid,datasourceName:a.name,query:{query:"${__value.raw}"}}}]}},{name:"traceName",type:r.fS.string,config:{displayNameFromDS:"Trace name"}},{name:"startTime",type:r.fS.time,config:{displayNameFromDS:"Start time"}},{name:"duration",type:r.fS.number,config:{displayNameFromDS:"Duration",unit:"\xB5s"}}],meta:{preferredVisualisationType:"table"}}),v=s.map(m).sort((i,E)=>E?.startTime-i?.startTime);for(const i of v)c.add(i);return c}function m(s){const a=(0,e.transformTraceData)(s);if(a)return{traceID:a.traceID,startTime:a.startTime/1e3,duration:a.duration,traceName:a.traceName}}function p(s){let a={traceID:"",spans:[],processes:{},warnings:null},c=[];for(let v=0;v<s.length;v++){const i=s.get(v);a.traceID||(a.traceID=i.traceID),c.find(E=>E===i.serviceName)||(c.push(i.serviceName),a.processes[`p${c.length}`]={serviceName:i.serviceName,tags:i.serviceTags}),a.spans.push({traceID:i.traceID,spanID:i.spanID,duration:i.duration*1e3,references:i.parentSpanID?[{refType:"CHILD_OF",spanID:i.parentSpanID,traceID:i.traceID}]:[],flags:0,logs:i.logs.map(E=>({...E,timestamp:E.timestamp*1e3})),operationName:i.operationName,processID:Object.keys(a.processes).find(E=>a.processes[E].serviceName===i.serviceName)||"",startTime:i.startTime*1e3,tags:i.tags,warnings:i.warnings?i.warnings:null})}return{data:[a],total:0,limit:0,offset:0,errors:null}}},57739:(M,h)=>{h=M.exports=function(t){var u;return t==null&&(t={}),function(r,e,o){if(r._body)return o();var l=r.header("content-type")===t.contentType;if(!l)return o();r._body=!0,r.body=r.body||{};var f;f="",r.setEncoding("utf8"),r.on("data",function(m){return f+=m}),r.on("end",function(){try{var m=[];f.trim().split(`
`).forEach(function(p){m.push(t.parser(p))}),r.body=m}catch(p){return p.body=f,p.status=400,o(p)}return o()})}}},26362:(M,h,t)=>{var u=t(20703),r=t(9702),e=t(96137).Readable,o=t(96137).PassThrough,l=t(27854);h=M.exports=function(f){f==null&&(f={});var m=f.contentType||"application/logplex-1";return function(p,s,a){if(p._body)return a();var c=p.header("content-type")===m;return c&&(p._body=!0,p.body=new o({objectMode:!0}),p.pipe(l.streamParser()).pipe(p.body)),a()}}},30148:(M,h)=>{h.debug=!1,h.parse=function(t){var u="",r="",e=!0,o=!1,l=!1,f=!1,m=!1,p={},s=h.debug;t[t.length-1]==`
`&&(t=t.slice(0,t.length-1));for(var a=0;a<=t.length;a++){if(t[a]==" "&&!f||a==t.length){if(o&&u.length>0?p[u]=!0:l&&(r=="true"?r=!0:r=="false"?r=!1:r===""&&!m&&(r=null),p[u]=r,r=""),a==t.length)break;o=!1,l=!1,f=!1,m=!1}t[a]=="="&&!f?(s&&console.log("split"),o=!1,l=!0):t[a]=="\\"?(a++,r+=t[a],s&&console.log("escape: "+t[a])):t[a]=='"'?(m=!0,f=!f,s&&console.log("in quote: "+f)):t[a]!=" "&&!l&&!o?(s&&console.log("start key with: "+t[a]),o=!0,u=t[a]):o?(s&&console.log("add to key: "+t[a]),u+=t[a]):l&&(s&&console.log("add to value: "+t[a]),r+=t[a])}return p}},35021:(M,h,t)=>{h.log=function(u,r){this.stream=this.stream||process.stdout,r==null&&(r=this.stream);var e=Object.assign({},this.defaultData,u);if(this.timers)for(var o in this.timers){var l=new Date().getTime();e[o]=(l-this.timers[o]).toString()+"ms"}r.write(this.stringify(e)+`
`)},h.time=function(o){var r=t(27854),e=new Date().getTime(),o=o||"elapsed",l=new r;return l.stream=this.stream,l.defaultData=this.defaultData,l.timers=Object.assign({},this.timers),l.timers[o]=e,l},h.namespace=function(u){var r=t(27854),e=new r,o=Object.assign({},this.defaultData,u);return e.stream=this.stream,e.defaultData=o,e.timers=this.timers,e},h.error=function(u,r){this.maxErrorLines=this.maxErrorLines||10,r===void 0&&(r=Math.random().toString().slice(2,12));var e=this.namespace({error:!0,id:r,now:new Date().toISOString()});if(e.log({message:u.message}),u.stack){var o=u.stack.split(`
`);for(var l in o){if(l>=this.maxErrorLines)break;e.log({line:l,trace:o[l]})}}}},88464:(M,h)=>{var t=function(e,o){if(typeof e.path=="function")var l=e.path();else var l=e.originalUrl||e.path||e.url;var f=e.header&&e.header("x-forwarded-for"),m=e.header&&e.header("x-request-id"),p=e.ip||f||e.connection.remoteAddress,s={ip:p,time:new Date().toISOString(),method:e.method,path:l,status:o.statusCode};return m&&(s.request_id=m),o.get&&(s.content_length=o.get("content-length"),s.content_type=o.get("content-type")),s},u=function(e,o,l){return function(f,m,p){var s=l(f,m);e.log(s),p()}},r=function(e,o,l){return function(f,m,p){var s=o.elapsed||"elapsed",a=e.time(s),c=m.end;m.end=function(v,i){var E=l(f,m);m.end=c,m.end(v,i),a.log(E)},p()}};h.init=function(e,o,l){return this.logger=e,!l&&!o?(l=t,o={}):l||(typeof o=="function"?(l=o,o={}):l=t),o=o||{},o.immediate?u(e,o,l):r(e,o,l)},h.commonFormatter=t},60233:(M,h,t)=>{var u=t(20703),r=t(9702),e=t(96137).PassThrough;h.streamParser=function(l){var l=l||{},f=new e,m=this,p=r(function(s){s!==""&&this.queue(m.parse(s))});return f.on("pipe",function(s){s.unpipe&&s.unpipe(this),this.transformStream=s.pipe(u()).pipe(p)}),f.pipe=function(s,a){return this.transformStream.pipe(s,a)},f},h.streamStringify=function(f){var l=this,f=f||{};if(f.hasOwnProperty("delimiter"))var m=f.delimiter;else var m=`
`;return r(function(p){this.queue(l.stringify(p)+m)},function(){this.queue(null)})}},14476:(M,h)=>{h.stringify=function(t){var u="";for(var r in t){var e=t[r],o=!1;e==null?(o=!0,e=""):e=e.toString();var l=e.indexOf(" ")>-1||e.indexOf("=")>-1,f=e.indexOf('"')>-1||e.indexOf("\\")>-1;f&&(e=e.replace(/["\\]/g,"\\$&")),l&&(e='"'+e+'"'),e===""&&!o&&(e='""'),u+=r+"="+e+" "}return u.substring(0,u.length-1)}},27854:(M,h,t)=>{function u(){}M.exports=u;var r=t(60233),e=t(57739),o=t(26362),l=t(30148),f=t(35021),m=t(88464),p=t(14476);Object.assign(u.prototype,f),Object.assign(u.prototype,r),u.prototype.stringify=p.stringify,u.prototype.parse=l.parse,u.prototype.bodyParser=function(s){s||(s={});var a=s.contentType||"application/logplex-1";return e({contentType:a,parser:this.parse})},u.prototype.bodyParserStream=function(s){s||(s={});var a=s.contentType||"application/logplex-1";return o({contentType:a})},u.prototype.requestLogger=function(s,a){return m.init(this,s,a)},u.prototype.requestLogger.commonFormatter=m.commonFormatter,Object.assign(u,u.prototype)},20703:(M,h,t)=>{var u=t(9702),r=t(55011).StringDecoder;M.exports=e;function e(o,l){var f=new r,m="";typeof o=="function"&&(l=o,o=null),o||(o=/\r?\n/);function p(a,c){if(l){try{c=l(c)}catch(v){return a.emit("error",v)}typeof c<"u"&&a.queue(c)}else a.queue(c)}function s(a,c){var v=(m+c).split(o);m=v.pop();for(var i=0;i<v.length;i++){var E=v[i];p(a,E)}}return u(function(a){s(this,f.write(a))},function(){f.end&&s(this,f.end()),m!=null&&p(this,m),this.queue(null)})}},9702:(M,h,t)=>{var u=t(55068);h=M.exports=r,r.through=r;function r(e,o,l){e=e||function(i){this.queue(i)},o=o||function(){this.queue(null)};var f=!1,m=!1,p=[],s=!1,a=new u;a.readable=a.writable=!0,a.paused=!1,a.autoDestroy=!(l&&l.autoDestroy===!1),a.write=function(i){return e.call(this,i),!a.paused};function c(){for(;p.length&&!a.paused;){var i=p.shift();if(i===null)return a.emit("end");a.emit("data",i)}}a.queue=a.push=function(i){return s||(i===null&&(s=!0),p.push(i),c()),a},a.on("end",function(){a.readable=!1,!a.writable&&a.autoDestroy&&process.nextTick(function(){a.destroy()})});function v(){a.writable=!1,o.call(a),!a.readable&&a.autoDestroy&&a.destroy()}return a.end=function(i){if(!f)return f=!0,arguments.length&&a.write(i),v(),a},a.destroy=function(){if(!m)return m=!0,f=!0,p.length=0,a.writable=a.readable=!1,a.emit("close"),a},a.pause=function(){if(!a.paused)return a.paused=!0,a},a.resume=function(){return a.paused&&(a.paused=!1,a.emit("resume")),c(),a.paused||a.emit("drain"),a},a}}}]);

//# sourceMappingURL=4053.7d3aaed7ce043fa4a88b.js.map