6549.f792862f9957ffda6109.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. "use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[6549],{16618:(e,t,a)=>{a.d(t,{E:()=>F});var s=a(36636),n=a(3574),r=a(68404),o=a(87723),i=a(43215),l=a(16695),d=a(90923),c=a(69783),p=a(78837),m=a(31359),u=a(28857),h=a(94546),g=a(93829),f=a(71623),v=a(45916);const y=e=>s.css`
  2. margin: 0;
  3. margin-left: ${e.spacing.md};
  4. font-size: ${e.typography.size.sm};
  5. color: ${e.colors.textWeak};
  6. `,x=e=>{let{children:t}=e;const a=(0,c.useStyles)(y);return(0,v.jsx)("p",{className:a,children:t})};var b=a(1667);const D=e=>{var t;let{options:a,onOptionsChange:s,panel:n,data:r,dataFrames:o,transformId:l,transformationOptions:d,selectedDataFrame:p,onDataFrameChange:m,downloadForExcel:u,toggleDownloadForExcel:h}=e;const g=(0,b.S)(),y=null==n?void 0:n.getTransformations(),D=Boolean(null==y?void 0:y.length)&&"join by time"!==l,T=n&&!(null!==(t=n.plugin)&&void 0!==t&&t.fieldConfigRegistry.isEmpty());let w=o;p===i.DataTransformerID.seriesToColumns&&(w=r);const j=[...d,...w.map(((e,t)=>({value:t,label:`${(0,i.getFrameDisplayName)(e)} (${t})`})))];return(0,v.jsx)("div",{className:g.dataDisplayOptions,children:(0,v.jsx)(f.t,{id:"Data options",index:0,title:"Data options",headerElement:(0,v.jsx)(x,{children:function(){if(!r)return"";const e=[];return p===i.DataTransformerID.seriesToColumns?e.push("Series joined by time"):r.length>1&&e.push((0,i.getFrameDisplayName)(r[p])),(a.withTransforms||a.withFieldConfig)&&(a.withTransforms&&e.push("Panel transforms"),a.withTransforms&&a.withFieldConfig,a.withFieldConfig&&e.push("Formatted data")),u&&e.push("Excel header"),e.join(", ")}()}),isOpen:!1,children:(0,v.jsx)("div",{className:g.options,"data-testid":"dataOptions",children:(0,v.jsxs)(c.VerticalGroup,{spacing:"none",children:[r.length>1&&(0,v.jsx)(c.Field,{label:"Show data frame",children:(0,v.jsx)(c.Select,{options:j,value:p,onChange:m,width:30,"aria-label":"Select dataframe"})}),(0,v.jsxs)(c.HorizontalGroup,{children:[D&&s&&(0,v.jsx)(c.Field,{label:"Apply panel transformations",description:"Table data is displayed with transformations defined in the panel Transform tab.",children:(0,v.jsx)(c.Switch,{value:!!a.withTransforms,onChange:()=>s(Object.assign({},a,{withTransforms:!a.withTransforms}))})}),T&&s&&(0,v.jsx)(c.Field,{label:"Formatted data",description:"Table data is formatted with options defined in the Field and Override tabs.",children:(0,v.jsx)(c.Switch,{id:"formatted-data-toggle",value:!!a.withFieldConfig,onChange:()=>s(Object.assign({},a,{withFieldConfig:!a.withFieldConfig}))})}),(0,v.jsx)(c.Field,{label:"Download for Excel",description:"Adds header to CSV for use with Excel",children:(0,v.jsx)(c.Switch,{id:"excel-toggle",value:u,onChange:h})})]})]})})})})};var T,w;function j(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class F extends r.PureComponent{constructor(e){var t,a;super(e),t=this,j(this,"exportCsv",(function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{panel:s}=t.props,{transformId:r}=t.state,o=(0,i.toCSV)([e],a),l=new Blob([String.fromCharCode(65279),o],{type:"text/csv;charset=utf-8"}),d=s?s.getDisplayTitle():"Explore",c=r!==i.DataTransformerID.noop?"-as-"+r.toLocaleLowerCase():"",p=`${d}-data${c}-${(0,i.dateTimeFormat)(new Date)}.csv`;(0,n.saveAs)(l,p)})),j(this,"exportLogsAsTxt",(()=>{var e;const{data:t,panel:a,app:s}=this.props;(0,d.reportInteraction)("grafana_logs_download_logs_clicked",{app:s,format:"logs"});const r=(0,m.aB)(t||[],void 0);let o="";null===(e=r.meta)||void 0===e||e.forEach((e=>{const t=`${e.label}: ${JSON.stringify(e.value)}\n`;o+=t})),o+="\n\n",r.rows.forEach((e=>{const t=(0,i.dateTimeFormatISO)(e.timeEpochMs)+"\t"+e.entry+"\n";o+=t}));const l=new Blob([o],{type:"text/plain;charset=utf-8"}),c=`${a?a.getDisplayTitle():"Explore"}-logs-${(0,i.dateTimeFormat)(new Date)}.txt`;(0,n.saveAs)(l,c)})),j(this,"exportTracesAsJson",(()=>{var e,t;const{data:a,panel:s}=this.props;if(a)for(const r of a){var n;if("trace"===(null===(n=r.meta)||void 0===n?void 0:n.preferredVisualisationType))switch(null===(e=r.meta)||void 0===e||null===(t=e.custom)||void 0===t?void 0:t.traceFormat){case"jaeger":{let e=(0,u.c6)(new i.MutableDataFrame(r));this.saveTraceJson(e,s);break}case"zipkin":{let e=(0,g.H)(new i.MutableDataFrame(r));this.saveTraceJson(e,s);break}default:{let e=(0,h.g9)(new i.MutableDataFrame(r));this.saveTraceJson(e,s);break}}}})),j(this,"saveTraceJson",((e,t)=>{const a=new Blob([JSON.stringify(e)],{type:"application/json"}),s=`${t?t.getDisplayTitle():"Explore"}-traces-${(0,i.dateTimeFormat)(new Date)}.json`;(0,n.saveAs)(a,s)})),j(this,"onDataFrameChange",(e=>{this.setState({transformId:e.value===i.DataTransformerID.seriesToColumns?i.DataTransformerID.seriesToColumns:i.DataTransformerID.noop,dataFrameIndex:"number"==typeof e.value?e.value:0,selectedDataFrame:e.value})})),j(this,"toggleDownloadForExcel",(()=>{this.setState((e=>({downloadForExcel:!e.downloadForExcel})))})),this.state={selectedDataFrame:0,dataFrameIndex:0,transformId:i.DataTransformerID.noop,transformationOptions:N(),transformedData:null!==(a=e.data)&&void 0!==a?a:[],downloadForExcel:!1}}componentDidUpdate(e,t){if(this.props.data)if(this.props.options.withTransforms)this.setState({transformedData:this.props.data});else if(e.data===this.props.data&&t.transformId===this.state.transformId);else{const e=this.state.transformationOptions.find((e=>e.value===this.state.transformId));if(e&&e.transformer.id!==i.DataTransformerID.noop){const t=this.state.selectedDataFrame,a=this.state.dataFrameIndex,s=(0,i.transformDataFrame)([e.transformer],this.props.data).subscribe((e=>{this.setState({transformedData:e,selectedDataFrame:t,dataFrameIndex:a},(()=>s.unsubscribe()))}));return}this.setState({transformedData:this.props.data})}else this.setState({transformedData:[]})}getProcessedData(){const{options:e,panel:t,timeZone:a}=this.props,s=this.state.transformedData;return e.withFieldConfig&&t?(0,i.applyFieldOverrides)({data:s,theme:p.vc.theme2,fieldConfig:t.fieldConfig,timeZone:a,replaceVariables:e=>e}):(0,i.applyRawFieldOverrides)(s)}render(){const{isLoading:e,options:t,data:a,panel:n,onOptionsChange:r,app:i}=this.props,{dataFrameIndex:p,transformId:m,transformationOptions:u,selectedDataFrame:h,downloadForExcel:g}=this.state,f=(0,b.S)();if(e)return T||(T=(0,v.jsxs)("div",{children:[(0,v.jsx)(c.Spinner,{inline:!0})," Loading"]}));const y=this.getProcessedData();if(!y||!y.length)return w||(w=(0,v.jsx)("div",{children:"No Data"}));const x=y[p]?p:0,j=y[x],F=y.some((e=>{var t;return"logs"===(null==e||null===(t=e.meta)||void 0===t?void 0:t.preferredVisualisationType)})),N=y.some((e=>{var t;return"trace"===(null==e||null===(t=e.meta)||void 0===t?void 0:t.preferredVisualisationType)}));return(0,v.jsxs)("div",{className:f.wrap,"aria-label":l.wl.components.PanelInspector.Data.content,children:[(0,v.jsxs)("div",{className:f.toolbar,children:[(0,v.jsx)(D,{data:a,panel:n,options:t,dataFrames:y,transformId:m,transformationOptions:u,selectedDataFrame:h,downloadForExcel:g,onOptionsChange:r,onDataFrameChange:this.onDataFrameChange,toggleDownloadForExcel:this.toggleDownloadForExcel}),(0,v.jsx)(c.Button,{variant:"primary",onClick:()=>{F&&(0,d.reportInteraction)("grafana_logs_download_clicked",{app:i,format:"csv"}),this.exportCsv(y[p],{useExcelHeader:this.state.downloadForExcel})},className:s.css`
  7. margin-bottom: 10px;
  8. `,children:"Download CSV"}),F&&(0,v.jsx)(c.Button,{variant:"primary",onClick:this.exportLogsAsTxt,className:s.css`
  9. margin-bottom: 10px;
  10. margin-left: 10px;
  11. `,children:"Download logs"}),N&&(0,v.jsx)(c.Button,{variant:"primary",onClick:this.exportTracesAsJson,className:s.css`
  12. margin-bottom: 10px;
  13. margin-left: 10px;
  14. `,children:"Download traces"})]}),(0,v.jsx)("div",{className:f.content,children:(0,v.jsx)(o.Z,{children:e=>{let{width:t,height:a}=e;return 0===t?null:(0,v.jsx)("div",{style:{width:t,height:a},children:(0,v.jsx)(c.Table,{width:t,height:a,data:j,showTypeIcons:!0})})}})})]})}}function N(){return[{value:i.DataTransformerID.seriesToColumns,label:"Series joined by time",transformer:{id:i.DataTransformerID.seriesToColumns,options:{byField:"Time"}}}]}},77967:(e,t,a)=>{a.d(t,{l:()=>r});a(68404);var s=a(69783),n=a(45916);const r=e=>{let{error:t}=e;if(!t)return null;if(t.data)return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h4",{children:t.data.message}),(0,n.jsx)(s.JSONFormatter,{json:t,open:2})]});if(t.message){const{msg:e,json:a}=(e=>{try{const[t,a]=e.split(/(\{.+)/);return{msg:t,json:JSON.parse(a)}}catch{return{msg:e}}})(t.message);return a?(0,n.jsxs)(n.Fragment,{children:[""!==e&&(0,n.jsx)("h3",{children:e}),(0,n.jsx)(s.JSONFormatter,{json:a,open:5})]}):(0,n.jsx)("div",{children:e})}return(0,n.jsx)(s.JSONFormatter,{json:t,open:2})}},81669:(e,t,a)=>{a.d(t,{W:()=>h});var s,n=a(68404),r=a(87723),o=a(43215),i=a(16695),l=a(69783),d=a(98163),c=a(1667),p=a(45916);function m(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}!function(e){e.PanelJSON="panel",e.PanelData="data",e.DataFrames="frames"}(s||(s={}));const u=[{label:"Panel JSON",description:"The model saved in the dashboard JSON that configures how everything works.",value:s.PanelJSON},{label:"Panel data",description:"The raw model passed to the panel visualization",value:s.PanelData},{label:"DataFrame JSON",description:"JSON formatted DataFrames",value:s.DataFrames}];class h extends n.PureComponent{constructor(e){super(e),m(this,"hasPanelJSON",void 0),m(this,"onSelectChanged",(e=>{const t=g(this.getJSONObject(e.value));this.setState({text:t,show:e.value})})),m(this,"onTextChanged",(e=>{this.setState({text:e})})),m(this,"onApplyPanelModel",(()=>{const{panel:e,dashboard:t,onClose:a}=this.props;if(this.hasPanelJSON){try{if(t.meta.canEdit){const a=JSON.parse(this.state.text);t.shouldUpdateDashboardPanelFromJSON(a,e),e.restoreModel(a),e.refresh(),d.h$.emit(o.AppEvents.alertSuccess,["Panel model updated"])}else d.h$.emit(o.AppEvents.alertError,["Unable to apply"])}catch(e){console.error("Error applying updates",e),d.h$.emit(o.AppEvents.alertError,["Invalid JSON text"])}a()}})),this.hasPanelJSON=!(!e.panel||!e.dashboard),this.state={show:this.hasPanelJSON?s.PanelJSON:s.DataFrames,text:this.hasPanelJSON?g(e.panel.getSaveModel()):g(e.data)}}getJSONObject(e){const{data:t,panel:a}=this.props;return e===s.PanelData?t:e===s.DataFrames?function(e){const t=[];if(null!=e&&e.series)for(const a of e.series)t.push((0,o.dataFrameToJSON)(a));if(null!=e&&e.annotations)for(const s of e.annotations){var a;const e=(0,o.dataFrameToJSON)(s);null!==(a=e.schema)&&void 0!==a&&a.meta||(e.schema.meta={}),e.schema.meta.dataTopic=o.DataTopic.Annotations,t.push(e)}return t}(t):this.hasPanelJSON&&e===s.PanelJSON?a.getSaveModel():{note:`Unknown Object: ${e}`}}render(){const{dashboard:e}=this.props,{show:t,text:a}=this.state,n=this.hasPanelJSON?u:u.slice(1,u.length),o=u.find((e=>e.value===t)),d=t===s.PanelJSON,m=e&&e.meta.canEdit,h=(0,c.S)();return(0,p.jsxs)("div",{className:h.wrap,children:[(0,p.jsxs)("div",{className:h.toolbar,"aria-label":i.wl.components.PanelInspector.Json.content,children:[(0,p.jsx)(l.Field,{label:"Select source",className:"flex-grow-1",children:(0,p.jsx)(l.Select,{inputId:"select-source-dropdown",options:n,value:o,onChange:this.onSelectChanged})}),this.hasPanelJSON&&d&&m&&(0,p.jsx)(l.Button,{className:h.toolbarItem,onClick:this.onApplyPanelModel,children:"Apply"})]}),(0,p.jsx)("div",{className:h.content,children:(0,p.jsx)(r.Z,{disableWidth:!0,children:e=>{let{height:t}=e;return(0,p.jsx)(l.CodeEditor,{width:"100%",height:t,language:"json",showLineNumbers:!0,showMiniMap:(a&&a.length)>100,value:a||"",readOnly:!d,onBlur:this.onTextChanged})}})})]})}}function g(e){return JSON.stringify(e,null,2)}},59970:(e,t,a)=>{a.d(t,{f:()=>p});a(68404);var s=a(16695),n=a(36636),r=a(43215),o=a(69783),i=a(45916);const l=e=>{let{timeZone:t,name:a,stats:s}=e;const n=(0,o.useTheme2)(),r=c(n);return s&&s.length?(0,i.jsxs)("div",{className:r.wrapper,children:[(0,i.jsx)("div",{className:"section-heading",children:a}),(0,i.jsx)("table",{className:"filter-table width-30",children:(0,i.jsx)("tbody",{children:s.map(((e,a)=>(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:e.displayName}),(0,i.jsx)("td",{className:r.cell,children:d(e,t,n)})]},`${e.displayName}-${a}`)))})})]}):null};function d(e,t,a){const s=(0,r.getDisplayProcessor)({field:{type:r.FieldType.number,config:e},theme:a,timeZone:t});return(0,r.formattedValueToString)(s(e.value))}const c=(0,o.stylesFactory)((e=>({wrapper:n.css`
  15. padding-bottom: ${e.spacing(2)};
  16. `,cell:n.css`
  17. text-align: right;
  18. `}))),p=e=>{var t;let{data:a,timeZone:n}=e;if(!a.request)return null;let r=[];const o=a.request.endTime?a.request.endTime-a.request.startTime:-1,d=(null===(t=a.timings)||void 0===t?void 0:t.dataProcessingTime)||-1;let c=0;for(const e of a.series)c+=e.length;o>0&&r.push({displayName:"Total request time",value:o,unit:"ms"}),d>0&&r.push({displayName:"Data processing time",value:d,unit:"ms"}),r.push({displayName:"Number of queries",value:a.request.targets.length}),r.push({displayName:"Total number rows",value:c});let p=[];for(const e of a.series)e.meta&&e.meta.stats&&(p=p.concat(e.meta.stats));return(0,i.jsxs)("div",{"aria-label":s.wl.components.PanelInspector.Stats.content,children:[(0,i.jsx)(l,{timeZone:n,name:"Stats",stats:r}),(0,i.jsx)(l,{timeZone:n,name:"Data source stats",stats:p})]})}},73723:(e,t,a)=>{a.d(t,{D:()=>T});var s,n,r,o,i,l=a(36636),d=a(68404),c=a(99918),p=a(43215),m=a(16695),u=a(90747),h=a(90923),g=a(69783),f=a(5831),v=a(28659),y=a(64593),x=a(1667),b=a(45916);function D(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class T extends d.PureComponent{constructor(e){super(e),D(this,"formattedJson",void 0),D(this,"subs",new c.w0),D(this,"onPanelRefresh",(()=>{this.setState((e=>Object.assign({},e,{dsQuery:{isLoading:!0,response:{}}})))})),D(this,"setFormattedJson",(e=>{this.formattedJson=e})),D(this,"getTextForClipboard",(()=>JSON.stringify(this.formattedJson,null,2))),D(this,"onClipboardSuccess",(()=>{f.Z.emit(p.AppEvents.alertSuccess,["Content copied to clipboard"])})),D(this,"onToggleExpand",(()=>{this.setState((e=>Object.assign({},e,{allNodesExpanded:!this.state.allNodesExpanded})))})),D(this,"onToggleMocking",(()=>{this.setState((e=>Object.assign({},e,{isMocking:!this.state.isMocking})))})),D(this,"getNrOfOpenNodes",(()=>null===this.state.allNodesExpanded?3:this.state.allNodesExpanded?20:1)),D(this,"setMockedResponse",(e=>{const t=e.target.value;this.setState((e=>Object.assign({},e,{mockedResponse:t})))})),this.state={executedQueries:[],allNodesExpanded:null,isMocking:!1,mockedResponse:"",dsQuery:{isLoading:!1,response:{}}}}componentDidMount(){const{panel:e}=this.props;this.subs.add(v.ae.getInspectorStream().subscribe({next:e=>this.onDataSourceResponse(e)})),e&&(this.subs.add(e.events.subscribe(h.RefreshEvent,this.onPanelRefresh)),this.updateQueryList())}componentDidUpdate(e){this.props.data!==e.data&&this.updateQueryList()}updateQueryList(){const{data:e}=this.props,t=[];if(null!=e&&e.length){let a;e.forEach(((e,s)=>{var n;const r=null===(n=e.meta)||void 0===n?void 0:n.executedQueryString;if(r){var o;const s=e.refId||"?";(null===(o=a)||void 0===o?void 0:o.refId)===s?(a.frames++,a.rows+=e.length):(a={refId:s,frames:0,rows:e.length,query:r},t.push(a))}}))}this.setState({executedQueries:t})}componentWillUnmount(){this.subs.unsubscribe()}onDataSourceResponse(e){var t;null!==(t=e.config)&&void 0!==t&&t.hideFromInspector||((e=Object.assign({},e)).headers&&delete e.headers,e.config&&(e.request=e.config,delete e.config,delete e.request.transformRequest,delete e.request.transformResponse,delete e.request.paramSerializer,delete e.request.jsonpCallbackParam,delete e.request.headers,delete e.request.requestId,delete e.request.inspect,delete e.request.retry,delete e.request.timeout),e.data&&(e.response=e.data,delete e.config,delete e.data,delete e.status,delete e.statusText,delete e.ok,delete e.url,delete e.redirected,delete e.type,delete e.$$config),this.setState((t=>Object.assign({},t,{dsQuery:{isLoading:!1,response:e}}))))}renderExecutedQueries(e){if(!e.length)return null;const t={refId:l.css`
  19. font-weight: ${h.config.theme.typography.weight.semibold};
  20. color: ${h.config.theme.colors.textBlue};
  21. margin-right: 8px;
  22. `};return(0,b.jsx)("div",{children:e.map((e=>(0,b.jsxs)(u.Stack,{gap:1,direction:"column",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("span",{className:t.refId,children:[e.refId,":"]}),e.frames>1&&(0,b.jsxs)("span",{children:[e.frames," frames, "]}),(0,b.jsxs)("span",{children:[e.rows," rows"]})]}),(0,b.jsx)("pre",{children:e.query})]},e.refId)))})}render(){const{allNodesExpanded:e,executedQueries:t}=this.state,{panel:a,onRefreshQuery:l}=this.props,{response:d,isLoading:c}=this.state.dsQuery,p=this.getNrOfOpenNodes(),u=(0,x.S)(),h=Object.keys(d).length>0;return a&&!(0,y.sY)(a.plugin)?null:(0,b.jsxs)("div",{className:u.wrap,children:[(0,b.jsxs)("div",{"aria-label":m.wl.components.PanelInspector.Query.content,children:[s||(s=(0,b.jsx)("h3",{className:"section-heading",children:"Query inspector"})),n||(n=(0,b.jsx)("p",{className:"small muted",children:"Query inspector allows you to view raw request and response. To collect this data Grafana needs to issue a new query. Click refresh button below to trigger a new query."}))]}),this.renderExecutedQueries(t),(0,b.jsxs)("div",{className:u.toolbar,children:[(0,b.jsx)(g.Button,{icon:"sync",onClick:l,"aria-label":m.wl.components.PanelInspector.Query.refreshButton,children:"Refresh"}),h&&e&&(0,b.jsx)(g.Button,{icon:"minus",variant:"secondary",className:u.toolbarItem,onClick:this.onToggleExpand,children:"Collapse all"}),h&&!e&&(0,b.jsx)(g.Button,{icon:"plus",variant:"secondary",className:u.toolbarItem,onClick:this.onToggleExpand,children:"Expand all"}),h&&(0,b.jsx)(g.ClipboardButton,{getText:this.getTextForClipboard,onClipboardCopy:this.onClipboardSuccess,className:u.toolbarItem,icon:"copy",variant:"secondary",children:"Copy to clipboard"}),r||(r=(0,b.jsx)("div",{className:"flex-grow-1"}))]}),(0,b.jsxs)("div",{className:u.content,children:[c&&(o||(o=(0,b.jsx)(g.LoadingPlaceholder,{text:"Loading query inspector..."}))),!c&&h&&(0,b.jsx)(g.JSONFormatter,{json:d,open:p,onDidRender:this.setFormattedJson}),!c&&!h&&(i||(i=(0,b.jsx)("p",{className:"muted",children:"No request and response collected yet. Hit refresh button"})))]})]})}}},1667:(e,t,a)=>{a.d(t,{S:()=>o});var s=a(36636),n=a(69783),r=a(78837);const o=(0,n.stylesFactory)((()=>({wrap:s.css`
  23. display: flex;
  24. flex-direction: column;
  25. height: 100%;
  26. width: 100%;
  27. flex: 1 1 0;
  28. `,toolbar:s.css`
  29. display: flex;
  30. width: 100%;
  31. flex-grow: 0;
  32. align-items: center;
  33. justify-content: flex-end;
  34. margin-bottom: ${r.vc.theme.spacing.sm};
  35. `,toolbarItem:s.css`
  36. margin-left: ${r.vc.theme.spacing.md};
  37. `,content:s.css`
  38. flex-grow: 1;
  39. height: 100%;
  40. overflow: scroll;
  41. `,editor:s.css`
  42. font-family: monospace;
  43. height: 100%;
  44. flex-grow: 1;
  45. `,viewer:s.css`
  46. overflow: scroll;
  47. `,dataFrameSelect:s.css`
  48. flex-grow: 2;
  49. `,leftActions:s.css`
  50. display: flex;
  51. flex-grow: 1;
  52. max-width: 85%;
  53. @media (max-width: 1345px) {
  54. max-width: 75%;
  55. }
  56. `,options:s.css`
  57. padding-top: ${r.vc.theme.spacing.sm};
  58. `,dataDisplayOptions:s.css`
  59. flex-grow: 1;
  60. min-width: 300px;
  61. margin-right: ${r.vc.theme.spacing.sm};
  62. `,selects:s.css`
  63. display: flex;
  64. > * {
  65. margin-right: ${r.vc.theme.spacing.sm};
  66. }
  67. `})))},56303:(e,t,a)=>{a.d(t,{l:()=>d});var s=a(68404),n=a(48435),r=a(90923),o=a(359),i=a(45916);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class d extends s.PureComponent{constructor(){super(...arguments),l(this,"onRemoveQuery",(e=>{this.props.onQueriesChange(this.props.queries.filter((t=>t!==e)))})),l(this,"onDragStart",(e=>{const{queries:t,dsSettings:a}=this.props;(0,r.reportInteraction)("query_row_reorder_started",{startIndex:e.source.index,numberOfQueries:t.length,datasourceType:a.type})})),l(this,"onDragEnd",(e=>{const{queries:t,onQueriesChange:a,dsSettings:s}=this.props;if(!e||!e.destination)return;const n=e.source.index,o=e.destination.index;if(n===o)return void(0,r.reportInteraction)("query_row_reorder_canceled",{startIndex:n,endIndex:o,numberOfQueries:t.length,datasourceType:s.type});const i=Array.from(t),[l]=i.splice(n,1);i.splice(o,0,l),a(i),(0,r.reportInteraction)("query_row_reorder_ended",{startIndex:n,endIndex:o,numberOfQueries:t.length,datasourceType:s.type})}))}onChangeQuery(e,t){const{queries:a,onQueriesChange:s}=this.props;s(a.map(((a,s)=>s===t?e:a)))}onDataSourceChange(e,t){const{queries:a,onQueriesChange:s}=this.props;s(a.map(((a,s)=>{if(s!==t)return a;const n={type:e.type,uid:e.uid};if(a.datasource){const t=(0,r.getDataSourceSrv)().getInstanceSettings(a.datasource);if((null==t?void 0:t.type)===e.type)return Object.assign({},a,{datasource:n})}return{refId:a.refId,hide:a.hide,datasource:n}})))}render(){const{dsSettings:e,data:t,queries:a,app:s,history:r,eventBus:l}=this.props;return(0,i.jsx)(n.Z5,{onDragStart:this.onDragStart,onDragEnd:this.onDragEnd,children:(0,i.jsx)(n.bK,{droppableId:"transformations-list",direction:"vertical",children:n=>(0,i.jsxs)("div",Object.assign({ref:n.innerRef},n.droppableProps,{children:[a.map(((n,d)=>{const p=c(n,e),m=e.meta.mixed?e=>this.onDataSourceChange(e,d):void 0;return(0,i.jsx)(o.x,{id:n.refId,index:d,data:t,query:n,dataSource:p,onChangeDataSource:m,onChange:e=>this.onChangeQuery(e,d),onRemoveQuery:this.onRemoveQuery,onAddQuery:this.props.onAddQuery,onRunQuery:this.props.onRunQueries,queries:a,app:s,history:r,eventBus:l},n.refId)})),n.placeholder]}))})})}}const c=(e,t)=>{if(!e.datasource)return t;return(0,r.getDataSourceSrv)().getInstanceSettings(e.datasource)||t}},28857:(e,t,a)=>{a.d(t,{Wp:()=>o,c6:()=>l,xM:()=>r});var s=a(43215),n=a(31241);function r(e){const t=e.spans.map((t=>{return a=t,s=e.processes,{spanID:a.spanID,traceID:a.traceID,parentSpanID:null===(n=a.references)||void 0===n||null===(r=n.find((e=>"CHILD_OF"===e.refType)))||void 0===r?void 0:r.spanID,operationName:a.operationName,startTime:a.startTime/1e3,duration:a.duration/1e3,logs:a.logs.map((e=>Object.assign({},e,{timestamp:e.timestamp/1e3}))),tags:a.tags,warnings:null!==(o=a.warnings)&&void 0!==o?o:void 0,stackTraces:a.stackTraces,serviceName:s[a.processID].serviceName,serviceTags:s[a.processID].tags};var a,s,n,r,o})),a=new s.MutableDataFrame({fields:[{name:"traceID",type:s.FieldType.string},{name:"spanID",type:s.FieldType.string},{name:"parentSpanID",type:s.FieldType.string},{name:"operationName",type:s.FieldType.string},{name:"serviceName",type:s.FieldType.string},{name:"serviceTags",type:s.FieldType.other},{name:"startTime",type:s.FieldType.number},{name:"duration",type:s.FieldType.number},{name:"logs",type:s.FieldType.other},{name:"tags",type:s.FieldType.other},{name:"warnings",type:s.FieldType.other},{name:"stackTraces",type:s.FieldType.other}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"jaeger"}}});for(const e of t)a.add(e);return a}function o(e,t){const a=new s.MutableDataFrame({fields:[{name:"traceID",type:s.FieldType.string,config:{unit:"string",displayNameFromDS:"Trace ID",links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:t.uid,datasourceName:t.name,query:{query:"${__value.raw}"}}}]}},{name:"traceName",type:s.FieldType.string,config:{displayNameFromDS:"Trace name"}},{name:"startTime",type:s.FieldType.time,config:{displayNameFromDS:"Start time"}},{name:"duration",type:s.FieldType.number,config:{displayNameFromDS:"Duration",unit:"µs"}}],meta:{preferredVisualisationType:"table"}}),n=e.map(i).sort(((e,t)=>(null==t?void 0:t.startTime)-(null==e?void 0:e.startTime)));for(const e of n)a.add(e);return a}function i(e){const t=(0,n.R1)(e);if(t)return{traceID:t.traceID,startTime:t.startTime/1e3,duration:t.duration,traceName:t.traceName}}function l(e){let t={traceID:"",spans:[],processes:{},warnings:null},a=[];for(let s=0;s<e.length;s++){const n=e.get(s);t.traceID||(t.traceID=n.traceID),a.find((e=>e===n.serviceName))||(a.push(n.serviceName),t.processes[`p${a.length}`]={serviceName:n.serviceName,tags:n.serviceTags}),t.spans.push({traceID:n.traceID,spanID:n.spanID,duration:1e3*n.duration,references:n.parentSpanID?[{refType:"CHILD_OF",spanID:n.parentSpanID,traceID:n.traceID}]:[],flags:0,logs:n.logs.map((e=>Object.assign({},e,{timestamp:1e3*e.timestamp}))),operationName:n.operationName,processID:Object.keys(t.processes).find((e=>t.processes[e].serviceName===n.serviceName))||"",startTime:1e3*n.startTime,tags:n.tags,warnings:n.warnings?n.warnings:null})}return{data:[t],total:0,limit:0,offset:0,errors:null}}},93829:(e,t,a)=>{a.d(t,{H:()=>c,m:()=>r});var s=a(82897),n=a(43215);function r(e){const t=e.map(o),a=new n.MutableDataFrame({fields:[{name:"traceID",type:n.FieldType.string},{name:"spanID",type:n.FieldType.string},{name:"parentSpanID",type:n.FieldType.string},{name:"operationName",type:n.FieldType.string},{name:"serviceName",type:n.FieldType.string},{name:"serviceTags",type:n.FieldType.other},{name:"startTime",type:n.FieldType.number},{name:"duration",type:n.FieldType.number},{name:"logs",type:n.FieldType.other},{name:"tags",type:n.FieldType.other}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"zipkin"}}});for(const e of t)a.add(e);return a}function o(e){var t,a,s,n;const r={traceID:e.traceId,spanID:e.id,parentSpanID:e.parentId,operationName:e.name,serviceName:(null===(t=e.localEndpoint)||void 0===t?void 0:t.serviceName)||(null===(a=e.remoteEndpoint)||void 0===a?void 0:a.serviceName)||"unknown",serviceTags:l(e),startTime:e.timestamp/1e3,duration:e.duration/1e3,logs:null!==(s=null===(n=e.annotations)||void 0===n?void 0:n.map(i))&&void 0!==s?s:[],tags:Object.keys(e.tags||{}).reduce(((t,a)=>"error"===a?(t.push({key:"error",value:!0}),t.push({key:"errorValue",value:e.tags.error}),t):(t.push({key:a,value:e.tags[a]}),t)),[])};var o,d;e.kind&&(r.tags=[{key:"kind",value:e.kind},...null!==(o=r.tags)&&void 0!==o?o:[]]);e.shared&&(r.tags=[{key:"shared",value:e.shared},...null!==(d=r.tags)&&void 0!==d?d:[]]);return r}function i(e){return{timestamp:e.timestamp,fields:[{key:"annotation",value:e.value}]}}function l(e){const t=e.localEndpoint||e.remoteEndpoint;return t?[d("ipv4",t.ipv4),d("ipv6",t.ipv6),d("port",t.port),d("endpointType",e.localEndpoint?"local":"remote")].filter(s.identity):[]}function d(e,t){if(t)return{key:e,value:t}}const c=e=>{let t=[];for(let n=0;n<e.length;n++){var a,s;const r=e.get(n);t.push(Object.assign({traceId:r.traceID,parentId:r.parentSpanID,name:r.operationName,id:r.spanID,timestamp:1e3*r.startTime,duration:1e3*r.duration},p(r),{annotations:r.logs.length?r.logs.map((e=>({timestamp:e.timestamp,value:e.fields[0].value}))):void 0,tags:r.tags.length?r.tags.filter((e=>"kind"!==e.key&&"endpointType"!==e.key&&"shared"!==e.key)).reduce(((e,t)=>"error"===t.key?Object.assign({},e,{[t.key]:r.tags.find((e=>"errorValue"===e.key)).value||""}):Object.assign({},e,{[t.key]:t.value})),{}):void 0,kind:null===(a=r.tags.find((e=>"kind"===e.key)))||void 0===a?void 0:a.value,shared:null===(s=r.tags.find((e=>"shared"===e.key)))||void 0===s?void 0:s.value}))}return t},p=e=>{var t,a,s,n;const r="local"===(null===(t=e.serviceTags.find((e=>"endpointType"===e.key)))||void 0===t?void 0:t.value)?"localEndpoint":"remoteEndpoint";return"unknown"!==e.serviceName?{[r]:{serviceName:e.serviceName,ipv4:null===(a=e.serviceTags.find((e=>"ipv4"===e.key)))||void 0===a?void 0:a.value,ipv6:null===(s=e.serviceTags.find((e=>"ipv6"===e.key)))||void 0===s?void 0:s.value,port:null===(n=e.serviceTags.find((e=>"port"===e.key)))||void 0===n?void 0:n.value}}:void 0}}}]);
  68. //# sourceMappingURL=6549.f792862f9957ffda6109.js.map