"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[573],{28239:(e,a,t)=>{t.d(a,{n:()=>r});var s,n=t(36636),o=(t(68404),t(43215)),i=t(69783),l=t(45916);function r(e){var a;let{options:t,onOptionsChange:n}=e;const r=(0,i.useStyles)(c);return(0,l.jsxs)("div",{className:r.container,children:[s||(s=(0,l.jsx)("h3",{className:"page-heading",children:"Node Graph"})),(0,l.jsx)(i.InlineFieldRow,{className:r.row,children:(0,l.jsx)(i.InlineField,{tooltip:"Enables the Node Graph visualization in the trace viewer.",label:"Enable Node Graph",labelWidth:26,children:(0,l.jsx)(i.InlineSwitch,{id:"enableNodeGraph",value:null===(a=t.jsonData.nodeGraph)||void 0===a?void 0:a.enabled,onChange:e=>(0,o.updateDatasourcePluginJsonDataOption)({onOptionsChange:n,options:t},"nodeGraph",Object.assign({},t.jsonData.nodeGraph,{enabled:e.currentTarget.checked}))})})})]})}const c=e=>({container:n.css` label: container; width: 100%; `,row:n.css` label: row; align-items: baseline; `})},76038:(e,a,t)=>{t.d(a,{Z:()=>h});var s,n,o,i=t(36636),l=(t(68404),t(43215)),r=t(90923),c=t(69783),d=t(45916);const u=e=>{let{values:a,onChange:t,id:i,keyPlaceholder:l="Key",valuePlaceholder:r="Value (optional)"}=e;const u=(0,c.useStyles)(p);return(0,d.jsx)("div",{className:u.wrapper,children:a.length?a.map(((e,o)=>(0,d.jsxs)("div",{className:u.pair,children:[(0,d.jsx)(c.SegmentInput,{id:`${i}-key-${o}`,placeholder:l,value:e.key,onChange:e=>{t(a.map(((a,t)=>(t===o&&(a.key=String(e)),a))))}}),(0,d.jsx)(c.InlineLabel,{"aria-label":"equals",className:u.operator,width:3,children:"="}),(0,d.jsx)(c.SegmentInput,{id:`${i}-value-${o}`,placeholder:r,value:e.value,onChange:e=>{t(a.map(((a,t)=>(t===o&&(a.value=String(e)),a))))}}),(0,d.jsx)("button",{onClick:()=>t([...a.slice(0,o),...a.slice(o+1)]),className:"gf-form-label query-part","aria-label":"Remove tag",children:s||(s=(0,d.jsx)(c.Icon,{name:"times"}))}),o===a.length-1?(0,d.jsx)("button",{onClick:()=>t([...a,{key:"",value:""}]),className:"gf-form-label query-part","aria-label":"Add tag",children:n||(n=(0,d.jsx)(c.Icon,{name:"plus"}))}):null]},o))):(0,d.jsx)("button",{onClick:()=>t([...a,{key:"",value:""}]),className:"gf-form-label query-part","aria-label":"Add tag",children:o||(o=(0,d.jsx)(c.Icon,{name:"plus"}))})})},p=e=>({wrapper:i.css` display: flex; flex-direction: column; gap: ${e.spacing.xs} 0; `,pair:i.css` display: flex; justify-content: start; align-items: center; `,operator:i.css` color: ${e.palette.orange}; `});var g;function h(e){var a,t,s,n,o,p,h,v,m,T,D,b,x,y;let{options:f,onOptionsChange:I}=e;const w=(0,c.useStyles)(j);return(0,d.jsxs)("div",{className:(0,i.css)({width:"100%"}),children:[g||(g=(0,d.jsx)("h3",{className:"page-heading",children:"Trace to logs"})),(0,d.jsx)("div",{className:w.infoText,children:"Trace to logs lets you navigate from a trace span to the selected data source's logs."}),(0,d.jsx)(c.InlineFieldRow,{children:(0,d.jsx)(c.InlineField,{tooltip:"The data source the trace is going to navigate to",label:"Data source",labelWidth:26,children:(0,d.jsx)(r.DataSourcePicker,{inputId:"trace-to-logs-data-source-picker",filter:e=>"loki"===e.type||"grafana-splunk-datasource"===e.type,current:null===(a=f.jsonData.tracesToLogs)||void 0===a?void 0:a.datasourceUid,noDefault:!0,width:40,onChange:e=>{var a;return(0,l.updateDatasourcePluginJsonDataOption)({onOptionsChange:I,options:f},"tracesToLogs",Object.assign({},f.jsonData.tracesToLogs,{datasourceUid:e.uid,tags:null===(a=f.jsonData.tracesToLogs)||void 0===a?void 0:a.tags}))}})})}),null!==(t=f.jsonData.tracesToLogs)&&void 0!==t&&t.mapTagNamesEnabled?(0,d.jsx)(c.InlineFieldRow,{children:(0,d.jsx)(c.InlineField,{tooltip:"Tags that will be used in the Loki query. Default tags: 'cluster', 'hostname', 'namespace', 'pod'",label:"Tags",labelWidth:26,children:(0,d.jsx)(u,{keyPlaceholder:"Tag",values:null!==(s=null!==(n=null===(o=f.jsonData.tracesToLogs)||void 0===o?void 0:o.mappedTags)&&void 0!==n?n:null===(p=f.jsonData.tracesToLogs)||void 0===p||null===(h=p.tags)||void 0===h?void 0:h.map((e=>({key:e}))))&&void 0!==s?s:[],onChange:e=>(0,l.updateDatasourcePluginJsonDataOption)({onOptionsChange:I,options:f},"tracesToLogs",Object.assign({},f.jsonData.tracesToLogs,{mappedTags:e}))})})}):(0,d.jsx)(c.InlineFieldRow,{children:(0,d.jsx)(c.InlineField,{tooltip:"Tags that will be used in the Loki query. Default tags: 'cluster', 'hostname', 'namespace', 'pod'",label:"Tags",labelWidth:26,children:(0,d.jsx)(c.TagsInput,{tags:null===(v=f.jsonData.tracesToLogs)||void 0===v?void 0:v.tags,width:40,onChange:e=>(0,l.updateDatasourcePluginJsonDataOption)({onOptionsChange:I,options:f},"tracesToLogs",Object.assign({},f.jsonData.tracesToLogs,{tags:e}))})})}),(0,d.jsx)(c.InlineFieldRow,{children:(0,d.jsx)(c.InlineField,{label:"Map tag names",labelWidth:26,grow:!0,tooltip:"Map trace tag names to log label names. Ex: k8s.pod.name -> pod",children:(0,d.jsx)(c.InlineSwitch,{id:"mapTagNames",value:null!==(m=null===(T=f.jsonData.tracesToLogs)||void 0===T?void 0:T.mapTagNamesEnabled)&&void 0!==m&&m,onChange:e=>(0,l.updateDatasourcePluginJsonDataOption)({onOptionsChange:I,options:f},"tracesToLogs",Object.assign({},f.jsonData.tracesToLogs,{mapTagNamesEnabled:e.currentTarget.checked}))})})}),(0,d.jsx)(c.InlineFieldRow,{children:(0,d.jsx)(c.InlineField,{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)",children:(0,d.jsx)(c.Input,{type:"text",placeholder:"1h",width:40,onChange:e=>(0,l.updateDatasourcePluginJsonDataOption)({onOptionsChange:I,options:f},"tracesToLogs",Object.assign({},f.jsonData.tracesToLogs,{spanStartTimeShift:e.currentTarget.value})),value:(null===(D=f.jsonData.tracesToLogs)||void 0===D?void 0:D.spanStartTimeShift)||""})})}),(0,d.jsx)(c.InlineFieldRow,{children:(0,d.jsx)(c.InlineField,{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",children:(0,d.jsx)(c.Input,{type:"text",placeholder:"1h",width:40,onChange:e=>(0,l.updateDatasourcePluginJsonDataOption)({onOptionsChange:I,options:f},"tracesToLogs",Object.assign({},f.jsonData.tracesToLogs,{spanEndTimeShift:e.currentTarget.value})),value:(null===(b=f.jsonData.tracesToLogs)||void 0===b?void 0:b.spanEndTimeShift)||""})})}),(0,d.jsx)(c.InlineFieldRow,{children:(0,d.jsx)(c.InlineField,{label:"Filter by Trace ID",labelWidth:26,grow:!0,tooltip:"Filters logs by Trace ID. Appends '|=' to the query.",children:(0,d.jsx)(c.InlineSwitch,{id:"filterByTraceID",value:null===(x=f.jsonData.tracesToLogs)||void 0===x?void 0:x.filterByTraceID,onChange:e=>(0,l.updateDatasourcePluginJsonDataOption)({onOptionsChange:I,options:f},"tracesToLogs",Object.assign({},f.jsonData.tracesToLogs,{filterByTraceID:e.currentTarget.checked}))})})}),(0,d.jsx)(c.InlineFieldRow,{children:(0,d.jsx)(c.InlineField,{label:"Filter by Span ID",labelWidth:26,grow:!0,tooltip:"Filters logs by Span ID. Appends '|=' to the query.",children:(0,d.jsx)(c.InlineSwitch,{id:"filterBySpanID",value:null===(y=f.jsonData.tracesToLogs)||void 0===y?void 0:y.filterBySpanID,onChange:e=>(0,l.updateDatasourcePluginJsonDataOption)({onOptionsChange:I,options:f},"tracesToLogs",Object.assign({},f.jsonData.tracesToLogs,{filterBySpanID:e.currentTarget.checked}))})})})]})}const j=e=>({infoText:i.css` padding-bottom: ${e.spacing.md}; color: ${e.colors.textSemiWeak}; `})},67211:(e,a,t)=>{t.d(a,{F:()=>c});var s,n=t(36636),o=(t(68404),t(43215)),i=t(90923),l=t(69783),r=t(45916);function c(e){var a,t,c,u;let{options:p,onOptionsChange:g}=e;const h=(0,l.useStyles)(d);return(0,r.jsxs)("div",{className:(0,n.css)({width:"100%"}),children:[s||(s=(0,r.jsx)("h3",{className:"page-heading",children:"Trace to metrics"})),(0,r.jsx)("div",{className:h.infoText,children:"Trace to metrics lets you navigate from a trace span to the selected data source."}),(0,r.jsxs)(l.InlineFieldRow,{className:h.row,children:[(0,r.jsx)(l.InlineField,{tooltip:"The data source the trace is going to navigate to",label:"Data source",labelWidth:26,children:(0,r.jsx)(i.DataSourcePicker,{inputId:"trace-to-metrics-data-source-picker",pluginId:"prometheus",current:null===(a=p.jsonData.tracesToMetrics)||void 0===a?void 0:a.datasourceUid,noDefault:!0,width:40,onChange:e=>(0,o.updateDatasourcePluginJsonDataOption)({onOptionsChange:g,options:p},"tracesToMetrics",Object.assign({},p.jsonData.tracesToMetrics,{datasourceUid:e.uid}))})}),null!==(t=p.jsonData.tracesToMetrics)&&void 0!==t&&t.datasourceUid?(0,r.jsx)(l.Button,{type:"button",variant:"secondary",size:"sm",fill:"text",onClick:()=>{(0,o.updateDatasourcePluginJsonDataOption)({onOptionsChange:g,options:p},"tracesToMetrics",Object.assign({},p.jsonData.tracesToMetrics,{datasourceUid:void 0}))},children:"Clear"}):null]}),null===(c=p.jsonData.tracesToMetrics)||void 0===c||null===(u=c.queries)||void 0===u?void 0:u.map(((e,a)=>(0,r.jsxs)("div",{className:h.queryRow,children:[(0,r.jsx)(l.InlineField,{label:"Link Label",labelWidth:10,children:(0,r.jsx)(l.Input,{label:"Link Label",type:"text",allowFullScreen:!0,value:e.name,onChange:e=>{var t,s;let n=null!==(t=null===(s=p.jsonData.tracesToMetrics)||void 0===s?void 0:s.queries.slice())&&void 0!==t?t:[];n[a].name=e.currentTarget.value,(0,o.updateDatasourcePluginJsonDataOption)({onOptionsChange:g,options:p},"tracesToMetrics",Object.assign({},p.jsonData.tracesToMetrics,{queries:n}))}})}),(0,r.jsx)(l.InlineField,{label:"Query",labelWidth:10,tooltip:"The Prometheus query that will run when navigating from a trace to metrics",grow:!0,children:(0,r.jsx)(l.Input,{label:"Query",type:"text",allowFullScreen:!0,value:e.query,onChange:e=>{var t,s;let n=null!==(t=null===(s=p.jsonData.tracesToMetrics)||void 0===s?void 0:s.queries.slice())&&void 0!==t?t:[];n[a].query=e.currentTarget.value,(0,o.updateDatasourcePluginJsonDataOption)({onOptionsChange:g,options:p},"tracesToMetrics",Object.assign({},p.jsonData.tracesToMetrics,{queries:n}))}})}),(0,r.jsx)(l.Button,{variant:"destructive",title:"Remove query",icon:"times",type:"button",onClick:()=>{var e;let t=null===(e=p.jsonData.tracesToMetrics)||void 0===e?void 0:e.queries.slice();null==t||t.splice(a,1),(0,o.updateDatasourcePluginJsonDataOption)({onOptionsChange:g,options:p},"tracesToMetrics",Object.assign({},p.jsonData.tracesToMetrics,{queries:t}))}})]},a))),(0,r.jsx)(l.Button,{variant:"secondary",title:"Add query",icon:"plus",type:"button",onClick:()=>{var e,a;(0,o.updateDatasourcePluginJsonDataOption)({onOptionsChange:g,options:p},"tracesToMetrics",Object.assign({},p.jsonData.tracesToMetrics,{queries:[...null!==(e=null===(a=p.jsonData.tracesToMetrics)||void 0===a?void 0:a.queries)&&void 0!==e?e:[],{query:""}]}))},children:"Add query"})]})}const d=e=>({infoText:n.css` padding-bottom: ${e.spacing.md}; color: ${e.colors.textSemiWeak}; `,row:n.css` label: row; align-items: baseline; `,queryRow:n.css` display: flex; `})}}]); //# sourceMappingURL=573.78fa17f424a8e5277ac5.js.map