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MAClE+K,OAAM,UAAEtN,EAAKmN,KAAKxD,MAAMyE,GAAmC,WAAVA,EAAEhB,aAA7C,aAAE,EAA8D7K,SAI1E,OAAO2E,GAIHgH,EAAelO,IAA6D,YAChF,MAAMoN,EACiF,WAArF,UAAApN,EAAK8M,YAAYnD,MAAMyE,GAAmC,iBAAVA,EAAEhB,aAAlD,eAA2E7K,OACvE,gBACA,iBACN,MAA4B,YAArBvC,EAAKyD,YACR,CACE,CAAC2J,GAAM,CACL3J,YAAazD,EAAKyD,YAClBiK,KAAI,UAAE1N,EAAK8M,YAAYnD,MAAMyE,GAAmC,SAAVA,EAAEhB,aAApD,aAAE,EAAmE7K,MACzEoL,KAAI,UAAE3N,EAAK8M,YAAYnD,MAAMyE,GAAmC,SAAVA,EAAEhB,aAApD,aAAE,EAAmE7K,MACzEqL,KAAI,UAAE5N,EAAK8M,YAAYnD,MAAMyE,GAAmC,SAAVA,EAAEhB,aAApD,aAAE,EAAmE7K,aAG7EhC,I,gDCpLN,QALe,SAAU8N,IACrB,QAAc,WACVA","sources":["webpack://grafana/./public/app/core/utils/tracing.ts","webpack://grafana/./public/app/plugins/datasource/zipkin/constants.ts","webpack://grafana/./public/app/plugins/datasource/zipkin/QueryField.tsx","webpack://grafana/./public/app/plugins/datasource/zipkin/utils/graphTransform.ts","webpack://grafana/./public/app/plugins/datasource/zipkin/datasource.ts","webpack://grafana/./public/app/plugins/datasource/zipkin/module.ts","webpack://grafana/./public/app/plugins/datasource/zipkin/ConfigEditor.tsx","webpack://grafana/./public/app/plugins/datasource/zipkin/utils/transforms.ts","webpack://grafana/./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/useMount.js"],"sourcesContent":["/**\n * Get non overlapping duration of the ranges as they can overlap or have gaps.\n */\nimport { FieldType, MutableDataFrame, NodeGraphDataFrameFieldNames as Fields } from '@grafana/data';\n\nexport function getNonOverlappingDuration(ranges: Array<[number, number]>): number {\n ranges.sort((a, b) => a[0] - b[0]);\n const mergedRanges = ranges.reduce((acc, range) => {\n if (!acc.length) {\n return [range];\n }\n const tail = acc.slice(-1)[0];\n const [prevStart, prevEnd] = tail;\n const [start, end] = range;\n if (end < prevEnd) {\n // In this case the range is completely inside the prev range so we can just ignore it.\n return acc;\n }\n\n if (start > prevEnd) {\n // There is no overlap so we can just add it to stack\n return [...acc, range];\n }\n\n // We know there is overlap and current range ends later than previous so we can just extend the range\n return [...acc.slice(0, -1), [prevStart, end]] as Array<[number, number]>;\n }, [] as Array<[number, number]>);\n\n return mergedRanges.reduce((acc, range) => {\n return acc + (range[1] - range[0]);\n }, 0);\n}\n\n/**\n * Returns a map of the spans with children array for easier processing. It will also contain empty spans in case\n * span is missing but other spans are it's children. This is more generic because it needs to allow iterating over\n * both arrays and dataframe views.\n */\nexport function makeSpanMap<T>(getSpan: (index: number) => { span: T; id: string; parentIds: string[] } | undefined): {\n [id: string]: { span: T; children: string[] };\n} {\n const spanMap: { [id: string]: { span?: T; children: string[] } } = {};\n\n let span;\n for (let index = 0; (span = getSpan(index)), !!span; index++) {\n if (!spanMap[span.id]) {\n spanMap[span.id] = {\n span: span.span,\n children: [],\n };\n } else {\n spanMap[span.id].span = span.span;\n }\n\n for (const parentId of span.parentIds) {\n if (parentId) {\n if (!spanMap[parentId]) {\n spanMap[parentId] = {\n span: undefined,\n children: [span.id],\n };\n } else {\n spanMap[parentId].children.push(span.id);\n }\n }\n }\n }\n return spanMap as { [id: string]: { span: T; children: string[] } };\n}\n\nexport function getStats(duration: number, traceDuration: number, selfDuration: number) {\n return {\n main: `${toFixedNoTrailingZeros(duration)}ms (${toFixedNoTrailingZeros((duration / traceDuration) * 100)}%)`,\n secondary: `${toFixedNoTrailingZeros(selfDuration)}ms (${toFixedNoTrailingZeros(\n (selfDuration / duration) * 100\n )}%)`,\n };\n}\n\nfunction toFixedNoTrailingZeros(n: number) {\n return parseFloat(n.toFixed(2));\n}\n\n/**\n * Create default frames used when returning data for node graph.\n */\nexport function makeFrames() {\n const nodesFrame = new MutableDataFrame({\n fields: [\n { name: Fields.id, type: FieldType.string },\n { name: Fields.title, type: FieldType.string },\n { name: Fields.subTitle, type: FieldType.string },\n { name: Fields.mainStat, type: FieldType.string, config: { displayName: 'Total time (% of trace)' } },\n { name: Fields.secondaryStat, type: FieldType.string, config: { displayName: 'Self time (% of total)' } },\n {\n name: Fields.color,\n type: FieldType.number,\n config: { color: { mode: 'continuous-GrYlRd' }, displayName: 'Self time / Trace duration' },\n },\n ],\n meta: {\n preferredVisualisationType: 'nodeGraph',\n },\n });\n\n const edgesFrame = new MutableDataFrame({\n fields: [\n { name: Fields.id, type: FieldType.string },\n { name: Fields.target, type: FieldType.string },\n { name: Fields.source, type: FieldType.string },\n ],\n meta: {\n preferredVisualisationType: 'nodeGraph',\n },\n });\n\n return [nodesFrame, edgesFrame];\n}\n","export const apiPrefix = '/api/v2';\n","import { css } from '@emotion/css';\nimport { fromPairs } from 'lodash';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { useAsyncFn, useMount, useMountedState } from 'react-use';\nimport { AsyncState } from 'react-use/lib/useAsyncFn';\n\nimport { GrafanaTheme2, QueryEditorProps } from '@grafana/data';\nimport {\n ButtonCascader,\n CascaderOption,\n FileDropzone,\n InlineField,\n InlineFieldRow,\n RadioButtonGroup,\n useTheme2,\n QueryField,\n useStyles2,\n} from '@grafana/ui';\nimport { notifyApp } from 'app/core/actions';\nimport { createErrorNotification } from 'app/core/copy/appNotification';\nimport { dispatch } from 'app/store/store';\n\nimport { apiPrefix } from './constants';\nimport { ZipkinDatasource } from './datasource';\nimport { ZipkinQuery, ZipkinQueryType, ZipkinSpan } from './types';\n\ntype Props = QueryEditorProps<ZipkinDatasource, ZipkinQuery>;\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n tracesCascader: css({\n label: 'tracesCascader',\n marginRight: theme.spacing(1),\n }),\n };\n};\n\nexport const ZipkinQueryField = ({ query, onChange, onRunQuery, datasource }: Props) => {\n const serviceOptions = useServices(datasource);\n const theme = useTheme2();\n const styles = useStyles2(getStyles);\n const { onLoadOptions, allOptions } = useLoadOptions(datasource);\n\n const onSelectTrace = useCallback(\n (values: string[], selectedOptions: CascaderOption[]) => {\n if (selectedOptions.length === 3) {\n const traceID = selectedOptions[2].value;\n onChange({ ...query, query: traceID });\n onRunQuery();\n }\n },\n [onChange, onRunQuery, query]\n );\n\n const onChangeQuery = (value: string) => {\n const nextQuery = { ...query, query: value };\n onChange(nextQuery);\n };\n\n let cascaderOptions = useMapToCascaderOptions(serviceOptions, allOptions);\n\n return (\n <>\n <InlineFieldRow>\n <InlineField label=\"Query type\">\n <RadioButtonGroup<ZipkinQueryType>\n options={[\n { value: 'traceID', label: 'TraceID' },\n { value: 'upload', label: 'JSON file' },\n ]}\n value={query.queryType || 'traceID'}\n onChange={(v) =>\n onChange({\n ...query,\n queryType: v,\n })\n }\n size=\"md\"\n />\n </InlineField>\n </InlineFieldRow>\n {query.queryType === 'upload' ? (\n <div className={css({ padding: theme.spacing(2) })}>\n <FileDropzone\n options={{ multiple: false }}\n onLoad={(result) => {\n datasource.uploadedJson = result;\n onRunQuery();\n }}\n />\n </div>\n ) : (\n <InlineFieldRow>\n <ButtonCascader\n options={cascaderOptions}\n onChange={onSelectTrace}\n loadData={onLoadOptions}\n variant=\"secondary\"\n buttonProps={{ className: styles.tracesCascader }}\n >\n Traces\n </ButtonCascader>\n <div className=\"gf-form gf-form--grow flex-shrink-1 min-width-15\">\n <QueryField\n query={query.query}\n onChange={onChangeQuery}\n onRunQuery={onRunQuery}\n placeholder={'Insert Trace ID (run with Shift+Enter)'}\n portalOrigin=\"zipkin\"\n />\n </div>\n </InlineFieldRow>\n )}\n </>\n );\n};\n\n// Exported for tests\nexport function useServices(datasource: ZipkinDatasource): AsyncState<CascaderOption[]> {\n const url = `${apiPrefix}/services`;\n\n const [servicesOptions, fetch] = useAsyncFn(async (): Promise<CascaderOption[]> => {\n try {\n const services: string[] | null = await datasource.metadataRequest(url);\n if (services) {\n return services.sort().map((service) => ({\n label: service,\n value: service,\n isLeaf: false,\n }));\n }\n return [];\n } catch (error) {\n dispatch(notifyApp(createErrorNotification('Failed to load services from Zipkin', error)));\n throw error;\n }\n }, [datasource]);\n\n useMount(() => {\n // We should probably call this periodically to get new services after mount.\n fetch();\n });\n\n return servicesOptions;\n}\n\ntype OptionsState = {\n [serviceName: string]: {\n [spanName: string]: {\n [traceId: string]: string;\n };\n };\n};\n\n// Exported for tests\nexport function useLoadOptions(datasource: ZipkinDatasource) {\n const isMounted = useMountedState();\n const [allOptions, setAllOptions] = useState({} as OptionsState);\n\n const [, fetchSpans] = useAsyncFn(\n async function findSpans(service: string): Promise<void> {\n const url = `${apiPrefix}/spans`;\n try {\n // The response of this should have been full ZipkinSpan objects based on API docs but is just list\n // of span names.\n // TODO: check if this is some issue of version used or something else\n const response: string[] = await datasource.metadataRequest(url, { serviceName: service });\n if (isMounted()) {\n setAllOptions((state) => {\n const spanOptions = fromPairs(response.map((span: string) => [span, undefined]));\n return {\n ...state,\n [service]: spanOptions as any,\n };\n });\n }\n } catch (error) {\n dispatch(notifyApp(createErrorNotification('Failed to load spans from Zipkin', error)));\n throw error;\n }\n },\n [datasource, allOptions]\n );\n\n const [, fetchTraces] = useAsyncFn(\n async function findTraces(serviceName: string, spanName: string): Promise<void> {\n const url = `${apiPrefix}/traces`;\n const search = {\n serviceName,\n spanName,\n // See other params and default here https://zipkin.io/zipkin-api/#/default/get_traces\n };\n try {\n // This should return just root traces as there isn't any nesting\n const traces: ZipkinSpan[][] = await datasource.metadataRequest(url, search);\n if (isMounted()) {\n const newTraces = traces.length\n ? fromPairs(\n traces.map((trace) => {\n const rootSpan = trace.find((span) => !span.parentId)!;\n\n return [`${rootSpan.name} [${Math.floor(rootSpan.duration / 1000)} ms]`, rootSpan.traceId];\n })\n )\n : noTracesOptions;\n\n setAllOptions((state) => {\n const spans = state[serviceName];\n return {\n ...state,\n [serviceName]: {\n ...spans,\n [spanName]: newTraces,\n },\n };\n });\n }\n } catch (error) {\n dispatch(notifyApp(createErrorNotification('Failed to load spans from Zipkin', error)));\n throw error;\n }\n },\n [datasource]\n );\n\n const onLoadOptions = useCallback(\n (selectedOptions: CascaderOption[]) => {\n const service = selectedOptions[0].value;\n if (selectedOptions.length === 1) {\n fetchSpans(service);\n } else if (selectedOptions.length === 2) {\n const spanName = selectedOptions[1].value;\n fetchTraces(service, spanName);\n }\n },\n [fetchSpans, fetchTraces]\n );\n\n return {\n onLoadOptions,\n allOptions,\n };\n}\n\nfunction useMapToCascaderOptions(services: AsyncState<CascaderOption[]>, allOptions: OptionsState) {\n return useMemo(() => {\n let cascaderOptions: CascaderOption[] = [];\n\n if (services.value && services.value.length) {\n cascaderOptions = services.value.map((services) => {\n return {\n ...services,\n children:\n allOptions[services.value] &&\n Object.keys(allOptions[services.value]).map((spanName) => {\n return {\n label: spanName,\n value: spanName,\n isLeaf: false,\n children:\n allOptions[services.value][spanName] &&\n Object.keys(allOptions[services.value][spanName]).map((traceName) => {\n return {\n label: traceName,\n value: allOptions[services.value][spanName][traceName],\n };\n }),\n };\n }),\n };\n });\n } else if (services.value && !services.value.length) {\n cascaderOptions = noTracesFoundOptions;\n }\n\n return cascaderOptions;\n }, [services, allOptions]);\n}\n\nconst NO_TRACES_KEY = '__NO_TRACES__';\nconst noTracesFoundOptions = [\n {\n label: 'No traces found',\n value: 'no_traces',\n isLeaf: true,\n\n // Cannot be disabled because then cascader shows 'loading' for some reason.\n // disabled: true,\n },\n];\n\nconst noTracesOptions = {\n '[No traces in time range]': NO_TRACES_KEY,\n};\n","import { DataFrame, NodeGraphDataFrameFieldNames as Fields } from '@grafana/data';\n\nimport { getNonOverlappingDuration, getStats, makeFrames, makeSpanMap } from '../../../../core/utils/tracing';\nimport { ZipkinSpan } from '../types';\n\ninterface Node {\n [Fields.id]: string;\n [Fields.title]: string;\n [Fields.subTitle]: string;\n [Fields.mainStat]: string;\n [Fields.secondaryStat]: string;\n [Fields.color]: number;\n}\n\ninterface Edge {\n [Fields.id]: string;\n [Fields.target]: string;\n [Fields.source]: string;\n}\n\nexport function createGraphFrames(data: ZipkinSpan[]): DataFrame[] {\n const { nodes, edges } = convertTraceToGraph(data);\n const [nodesFrame, edgesFrame] = makeFrames();\n\n for (const node of nodes) {\n nodesFrame.add(node);\n }\n\n for (const edge of edges) {\n edgesFrame.add(edge);\n }\n\n return [nodesFrame, edgesFrame];\n}\n\nfunction convertTraceToGraph(spans: ZipkinSpan[]): { nodes: Node[]; edges: Edge[] } {\n const nodes: Node[] = [];\n const edges: Edge[] = [];\n\n const traceDuration = findTraceDuration(spans);\n const spanMap = makeSpanMap((index) => {\n if (index >= spans.length) {\n return undefined;\n }\n return {\n span: spans[index],\n id: spans[index].id,\n parentIds: spans[index].parentId ? [spans[index].parentId!] : [],\n };\n });\n\n for (const span of spans) {\n const ranges: Array<[number, number]> = spanMap[span.id].children.map((c) => {\n const span = spanMap[c].span;\n return [span.timestamp, span.timestamp + span.duration];\n });\n const childrenDuration = getNonOverlappingDuration(ranges);\n const selfDuration = span.duration - childrenDuration;\n const stats = getStats(span.duration / 1000, traceDuration / 1000, selfDuration / 1000);\n\n nodes.push({\n [Fields.id]: span.id,\n [Fields.title]: span.localEndpoint?.serviceName || span.remoteEndpoint?.serviceName || 'unknown',\n [Fields.subTitle]: span.name,\n [Fields.mainStat]: stats.main,\n [Fields.secondaryStat]: stats.secondary,\n [Fields.color]: selfDuration / traceDuration,\n });\n\n if (span.parentId && spanMap[span.parentId].span) {\n edges.push({\n [Fields.id]: span.parentId + '--' + span.id,\n [Fields.target]: span.id,\n [Fields.source]: span.parentId,\n });\n }\n }\n\n return { nodes, edges };\n}\n\n/**\n * Get the duration of the whole trace as it isn't a part of the response data.\n * Note: Seems like this should be the same as just longest span, but this is probably safer.\n */\nfunction findTraceDuration(spans: ZipkinSpan[]): number {\n let traceEndTime = 0;\n let traceStartTime = Infinity;\n\n for (const span of spans) {\n if (span.timestamp < traceStartTime) {\n traceStartTime = span.timestamp;\n }\n\n if (span.timestamp + span.duration > traceEndTime) {\n traceEndTime = span.timestamp + span.duration;\n }\n }\n return traceEndTime - traceStartTime;\n}\n","import { lastValueFrom, Observable, of } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport {\n DataQueryRequest,\n DataQueryResponse,\n DataSourceApi,\n DataSourceInstanceSettings,\n DataSourceJsonData,\n FieldType,\n MutableDataFrame,\n ScopedVars,\n} from '@grafana/data';\nimport { BackendSrvRequest, FetchResponse, getBackendSrv, getTemplateSrv, TemplateSrv } from '@grafana/runtime';\nimport { NodeGraphOptions } from 'app/core/components/NodeGraphSettings';\n\nimport { serializeParams } from '../../../core/utils/fetch';\n\nimport { apiPrefix } from './constants';\nimport { ZipkinQuery, ZipkinSpan } from './types';\nimport { createGraphFrames } from './utils/graphTransform';\nimport { transformResponse } from './utils/transforms';\n\nexport interface ZipkinJsonData extends DataSourceJsonData {\n nodeGraph?: NodeGraphOptions;\n}\n\nexport class ZipkinDatasource extends DataSourceApi<ZipkinQuery, ZipkinJsonData> {\n uploadedJson: string | ArrayBuffer | null = null;\n nodeGraph?: NodeGraphOptions;\n constructor(\n private instanceSettings: DataSourceInstanceSettings<ZipkinJsonData>,\n private readonly templateSrv: TemplateSrv = getTemplateSrv()\n ) {\n super(instanceSettings);\n this.nodeGraph = instanceSettings.jsonData.nodeGraph;\n }\n\n query(options: DataQueryRequest<ZipkinQuery>): Observable<DataQueryResponse> {\n const target = options.targets[0];\n if (target.queryType === 'upload') {\n if (!this.uploadedJson) {\n return of({ data: [] });\n }\n\n try {\n const traceData = JSON.parse(this.uploadedJson as string);\n return of(responseToDataQueryResponse({ data: traceData }, this.nodeGraph?.enabled));\n } catch (error) {\n return of({ error: { message: 'JSON is not valid Zipkin format' }, data: [] });\n }\n }\n\n if (target.query) {\n const query = this.applyVariables(target, options.scopedVars);\n return this.request<ZipkinSpan[]>(`${apiPrefix}/trace/${encodeURIComponent(query.query)}`).pipe(\n map((res) => responseToDataQueryResponse(res, this.nodeGraph?.enabled))\n );\n }\n return of(emptyDataQueryResponse);\n }\n\n async metadataRequest(url: string, params?: Record<string, any>): Promise<any> {\n const res = await lastValueFrom(this.request(url, params, { hideFromInspector: true }));\n return res.data;\n }\n\n async testDatasource(): Promise<{ status: string; message: string }> {\n await this.metadataRequest(`${apiPrefix}/services`);\n return { status: 'success', message: 'Data source is working' };\n }\n\n getQueryDisplayText(query: ZipkinQuery): string {\n return query.query;\n }\n\n interpolateVariablesInQueries(queries: ZipkinQuery[], scopedVars: ScopedVars): ZipkinQuery[] {\n if (!queries || queries.length === 0) {\n return [];\n }\n\n return queries.map((query) => {\n return {\n ...query,\n datasource: this.getRef(),\n ...this.applyVariables(query, scopedVars),\n };\n });\n }\n\n applyVariables(query: ZipkinQuery, scopedVars: ScopedVars) {\n const expandedQuery = { ...query };\n\n return {\n ...expandedQuery,\n query: this.templateSrv.replace(query.query ?? '', scopedVars),\n };\n }\n\n private request<T = any>(\n apiUrl: string,\n data?: any,\n options?: Partial<BackendSrvRequest>\n ): Observable<FetchResponse<T>> {\n const params = data ? serializeParams(data) : '';\n const url = `${this.instanceSettings.url}${apiUrl}${params.length ? `?${params}` : ''}`;\n const req = {\n ...options,\n url,\n };\n\n return getBackendSrv().fetch<T>(req);\n }\n}\n\nfunction responseToDataQueryResponse(response: { data: ZipkinSpan[] }, nodeGraph = false): DataQueryResponse {\n let data = response?.data ? [transformResponse(response?.data)] : [];\n if (nodeGraph) {\n data.push(...createGraphFrames(response?.data));\n }\n return {\n data,\n };\n}\n\nconst emptyDataQueryResponse = {\n data: [\n new MutableDataFrame({\n fields: [\n {\n name: 'trace',\n type: FieldType.trace,\n values: [],\n },\n ],\n meta: {\n preferredVisualisationType: 'trace',\n custom: {\n traceFormat: 'zipkin',\n },\n },\n }),\n ],\n};\n","import { DataSourcePlugin } from '@grafana/data';\n\nimport { ConfigEditor } from './ConfigEditor';\nimport { ZipkinQueryField } from './QueryField';\nimport { ZipkinDatasource } from './datasource';\n\nexport const plugin = new DataSourcePlugin(ZipkinDatasource)\n .setQueryEditor(ZipkinQueryField)\n .setConfigEditor(ConfigEditor);\n","import React from 'react';\n\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { DataSourceHttpSettings } from '@grafana/ui';\nimport { NodeGraphSettings } from 'app/core/components/NodeGraphSettings';\nimport { TraceToLogsSettings } from 'app/core/components/TraceToLogs/TraceToLogsSettings';\nimport { TraceToMetricsSettings } from 'app/core/components/TraceToMetrics/TraceToMetricsSettings';\n\nexport type Props = DataSourcePluginOptionsEditorProps;\n\nexport const ConfigEditor: React.FC<Props> = ({ options, onOptionsChange }) => {\n return (\n <>\n <DataSourceHttpSettings\n defaultUrl=\"http://localhost:9411\"\n dataSourceConfig={options}\n showAccessOptions={false}\n onChange={onOptionsChange}\n />\n\n <div className=\"gf-form-group\">\n <TraceToLogsSettings options={options} onOptionsChange={onOptionsChange} />\n </div>\n\n {config.featureToggles.traceToMetrics ? (\n <div className=\"gf-form-group\">\n <TraceToMetricsSettings options={options} onOptionsChange={onOptionsChange} />\n </div>\n ) : null}\n\n <div className=\"gf-form-group\">\n <NodeGraphSettings options={options} onOptionsChange={onOptionsChange} />\n </div>\n </>\n );\n};\n","import { identity } from 'lodash';\n\nimport { DataFrame, FieldType, MutableDataFrame, TraceKeyValuePair, TraceLog, TraceSpanRow } from '@grafana/data';\n\nimport { ZipkinAnnotation, ZipkinEndpoint, ZipkinSpan } from '../types';\n\n/**\n * Transforms response to Grafana trace data frame.\n */\nexport function transformResponse(zSpans: ZipkinSpan[]): DataFrame {\n const spanRows = zSpans.map(transformSpan);\n const frame = new MutableDataFrame({\n fields: [\n { name: 'traceID', type: FieldType.string },\n { name: 'spanID', type: FieldType.string },\n { name: 'parentSpanID', type: FieldType.string },\n { name: 'operationName', type: FieldType.string },\n { name: 'serviceName', type: FieldType.string },\n { name: 'serviceTags', type: FieldType.other },\n { name: 'startTime', type: FieldType.number },\n { name: 'duration', type: FieldType.number },\n { name: 'logs', type: FieldType.other },\n { name: 'tags', type: FieldType.other },\n ],\n meta: {\n preferredVisualisationType: 'trace',\n custom: {\n traceFormat: 'zipkin',\n },\n },\n });\n\n for (const span of spanRows) {\n frame.add(span);\n }\n\n return frame;\n}\n\nfunction transformSpan(span: ZipkinSpan): TraceSpanRow {\n const row = {\n traceID: span.traceId,\n spanID: span.id,\n parentSpanID: span.parentId,\n operationName: span.name,\n serviceName: span.localEndpoint?.serviceName || span.remoteEndpoint?.serviceName || 'unknown',\n serviceTags: serviceTags(span),\n startTime: span.timestamp / 1000,\n duration: span.duration / 1000,\n logs: span.annotations?.map(transformAnnotation) ?? [],\n tags: Object.keys(span.tags || {}).reduce<TraceKeyValuePair[]>((acc, key) => {\n // If tag is error we remap it to simple boolean so that the trace ui will show an error icon.\n if (key === 'error') {\n acc.push({\n key: 'error',\n value: true,\n });\n\n acc.push({\n key: 'errorValue',\n value: span.tags!['error'],\n });\n return acc;\n }\n acc.push({ key, value: span.tags![key] });\n return acc;\n }, []),\n };\n\n if (span.kind) {\n row.tags = [\n {\n key: 'kind',\n value: span.kind,\n },\n ...(row.tags ?? []),\n ];\n }\n\n if (span.shared) {\n row.tags = [\n {\n key: 'shared',\n value: span.shared,\n },\n ...(row.tags ?? []),\n ];\n }\n\n return row;\n}\n\n/**\n * Maps annotations as a log as that seems to be the closest thing.\n * See https://zipkin.io/zipkin-api/#/default/get_trace__traceId_\n */\nfunction transformAnnotation(annotation: ZipkinAnnotation): TraceLog {\n return {\n timestamp: annotation.timestamp,\n fields: [\n {\n key: 'annotation',\n value: annotation.value,\n },\n ],\n };\n}\n\nfunction serviceTags(span: ZipkinSpan): TraceKeyValuePair[] {\n const endpoint = span.localEndpoint || span.remoteEndpoint;\n if (!endpoint) {\n return [];\n }\n return [\n valueToTag('ipv4', endpoint.ipv4),\n valueToTag('ipv6', endpoint.ipv6),\n valueToTag('port', endpoint.port),\n valueToTag('endpointType', span.localEndpoint ? 'local' : 'remote'),\n ].filter(identity) as TraceKeyValuePair[];\n}\n\nfunction valueToTag<T>(key: string, value: T): TraceKeyValuePair<T> | undefined {\n if (!value) {\n return undefined;\n }\n return {\n key,\n value,\n };\n}\n\n/**\n * Transforms data frame to Zipkin response\n */\nexport const transformToZipkin = (data: MutableDataFrame): ZipkinSpan[] => {\n let response: ZipkinSpan[] = [];\n\n for (let i = 0; i < data.length; i++) {\n const span = data.get(i);\n response.push({\n traceId: span.traceID,\n parentId: span.parentSpanID,\n name: span.operationName,\n id: span.spanID,\n timestamp: span.startTime * 1000,\n duration: span.duration * 1000,\n ...getEndpoint(span),\n annotations: span.logs.length\n ? span.logs.map((l: TraceLog) => ({ timestamp: l.timestamp, value: l.fields[0].value }))\n : undefined,\n tags: span.tags.length\n ? span.tags\n .filter((t: TraceKeyValuePair) => t.key !== 'kind' && t.key !== 'endpointType' && t.key !== 'shared')\n .reduce((tags: { [key: string]: string }, t: TraceKeyValuePair) => {\n if (t.key === 'error') {\n return {\n ...tags,\n [t.key]: span.tags.find((t: TraceKeyValuePair) => t.key === 'errorValue').value || '',\n };\n }\n return { ...tags, [t.key]: t.value };\n }, {})\n : undefined,\n kind: span.tags.find((t: TraceKeyValuePair) => t.key === 'kind')?.value,\n shared: span.tags.find((t: TraceKeyValuePair) => t.key === 'shared')?.value,\n });\n }\n\n return response;\n};\n\n// Returns remote or local endpoint object\nconst getEndpoint = (span: any): { [key: string]: ZipkinEndpoint } | undefined => {\n const key =\n span.serviceTags.find((t: TraceKeyValuePair) => t.key === 'endpointType')?.value === 'local'\n ? 'localEndpoint'\n : 'remoteEndpoint';\n return span.serviceName !== 'unknown'\n ? {\n [key]: {\n serviceName: span.serviceName,\n ipv4: span.serviceTags.find((t: TraceKeyValuePair) => t.key === 'ipv4')?.value,\n ipv6: span.serviceTags.find((t: TraceKeyValuePair) => t.key === 'ipv6')?.value,\n port: span.serviceTags.find((t: TraceKeyValuePair) => t.key === 'port')?.value,\n },\n }\n : undefined;\n};\n","import useEffectOnce from './useEffectOnce';\nvar useMount = function (fn) {\n useEffectOnce(function () {\n fn();\n });\n};\nexport default useMount;\n"],"names":["getNonOverlappingDuration","ranges","sort","a","b","reduce","acc","range","length","tail","slice","prevStart","prevEnd","start","end","makeSpanMap","getSpan","spanMap","span","index","id","children","parentId","parentIds","push","undefined","getStats","duration","traceDuration","selfDuration","main","toFixedNoTrailingZeros","secondary","n","parseFloat","toFixed","makeFrames","MutableDataFrame","fields","name","Fields","type","FieldType","config","displayName","color","mode","meta","preferredVisualisationType","getStyles","theme","tracesCascader","css","label","marginRight","spacing","noTracesFoundOptions","value","isLeaf","noTracesOptions","createGraphFrames","data","nodes","edges","spans","traceEndTime","traceStartTime","Infinity","timestamp","findTraceDuration","map","c","childrenDuration","stats","localEndpoint","serviceName","remoteEndpoint","convertTraceToGraph","nodesFrame","edgesFrame","node","add","edge","ZipkinDatasource","DataSourceApi","constructor","instanceSettings","templateSrv","getTemplateSrv","super","this","nodeGraph","jsonData","query","options","target","targets","queryType","uploadedJson","of","traceData","JSON","parse","responseToDataQueryResponse","enabled","error","message","applyVariables","scopedVars","request","encodeURIComponent","pipe","res","emptyDataQueryResponse","url","params","lastValueFrom","hideFromInspector","metadataRequest","status","getQueryDisplayText","interpolateVariablesInQueries","queries","datasource","getRef","expandedQuery","replace","apiUrl","serializeParams","req","getBackendSrv","fetch","response","transformResponse","values","custom","traceFormat","plugin","DataSourcePlugin","setQueryEditor","onChange","onRunQuery","serviceOptions","servicesOptions","useAsyncFn","async","services","service","dispatch","notifyApp","createErrorNotification","useMount","useServices","useTheme2","styles","useStyles2","onLoadOptions","allOptions","isMounted","useMountedState","setAllOptions","useState","fetchSpans","state","spanOptions","fromPairs","fetchTraces","spanName","search","traces","newTraces","trace","rootSpan","find","Math","floor","traceId","useCallback","selectedOptions","useLoadOptions","onSelectTrace","traceID","cascaderOptions","useMemo","Object","keys","traceName","useMapToCascaderOptions","InlineFieldRow","InlineField","RadioButtonGroup","v","size","className","padding","FileDropzone","multiple","onLoad","result","ButtonCascader","loadData","variant","buttonProps","QueryField","nextQuery","placeholder","portalOrigin","setConfigEditor","onOptionsChange","DataSourceHttpSettings","defaultUrl","dataSourceConfig","showAccessOptions","TraceToLogsSettings","TraceToMetricsSettings","NodeGraphSettings","zSpans","spanRows","transformSpan","frame","row","spanID","parentSpanID","operationName","serviceTags","startTime","logs","annotations","transformAnnotation","tags","key","kind","shared","annotation","endpoint","valueToTag","ipv4","ipv6","port","filter","identity","transformToZipkin","i","get","getEndpoint","l","t","fn"],"sourceRoot":""}
|