mirror of
https://github.com/grafana/grafana.git
synced 2025-09-24 17:43:47 +08:00
Explore: Add trace UI to show traces from tracing datasources (#23047)
* Add integration with Jeager Add Jaeger datasource and modify derived fields in loki to allow for opening a trace in Jager in separate split. Modifies build so that this branch docker images are pushed to docker hub Add a traceui dir with docker-compose and provision files for demoing.:wq * Enable docker logger plugin to send logs to loki * Add placeholder zipkin datasource * Fixed rebase issues, added enhanceDataFrame to non-legacy code path * Trace selector for jaeger query field * Fix logs default mode for Loki * Fix loading jaeger query field services on split * Updated grafana image in traceui/compose file * Fix prettier error * Hide behind feature flag, clean up unused code. * Fix tests * Fix tests * Cleanup code and review feedback * Remove traceui directory * Remove circle build changes * Fix feature toggles object * Fix merge issues * Add trace ui in Explore * WIP * WIP * WIP * Make jaeger datasource return trace data instead of link * Allow js in jest tests * Return data from Jaeger datasource * Take yarn.lock from master * Fix missing component * Update yarn lock * Fix some ts and lint errors * Fix merge * Fix type errors * Make tests pass again * Add tests * Fix es5 compatibility Co-authored-by: David Kaltschmidt <david.kaltschmidt@gmail.com>
This commit is contained in:
58
packages/jaeger-ui-components/src/url/ReferenceLink.tsx
Normal file
58
packages/jaeger-ui-components/src/url/ReferenceLink.tsx
Normal file
@ -0,0 +1,58 @@
|
||||
// Copyright (c) 2019 The Jaeger Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import React from 'react';
|
||||
import { SpanReference } from '../types/trace';
|
||||
import ExternalLinkContext from './externalLinkContext';
|
||||
|
||||
type ReferenceLinkProps = {
|
||||
reference: SpanReference;
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
focusSpan: (spanID: string) => void;
|
||||
onClick?: () => void;
|
||||
};
|
||||
|
||||
export default function ReferenceLink(props: ReferenceLinkProps) {
|
||||
const { reference, children, className, focusSpan, ...otherProps } = props;
|
||||
delete otherProps.onClick;
|
||||
if (reference.span) {
|
||||
return (
|
||||
<a role="button" onClick={() => focusSpan(reference.spanID)} className={className} {...otherProps}>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ExternalLinkContext.Consumer>
|
||||
{createLinkToExternalSpan => {
|
||||
if (!createLinkToExternalSpan) {
|
||||
throw new Error("ExternalLinkContext does not have a value, you probably forgot to setup it's provider");
|
||||
}
|
||||
return (
|
||||
<a
|
||||
href={createLinkToExternalSpan(reference.traceID, reference.spanID)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={className}
|
||||
{...otherProps}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
}}
|
||||
</ExternalLinkContext.Consumer>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user