mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 09:26:43 -06:00
Tempo: Added spss config - spans per span set (#74832)
* Added spss config - spans per span set * Set default spss when calling Tempo
This commit is contained in:
parent
c4bc90ff5b
commit
dc44ac7b78
@ -55,6 +55,10 @@ export interface TempoQuery extends common.DataQuery {
|
||||
* @deprecated Query traces by span name
|
||||
*/
|
||||
spanName?: string;
|
||||
/**
|
||||
* Defines the maximum number of spans per spanset that are returned from Tempo
|
||||
*/
|
||||
spss?: number;
|
||||
}
|
||||
|
||||
export const defaultTempoQuery: Partial<TempoQuery> = {
|
||||
|
@ -125,6 +125,9 @@ type TempoQuery struct {
|
||||
|
||||
// @deprecated Query traces by span name
|
||||
SpanName *string `json:"spanName,omitempty"`
|
||||
|
||||
// Defines the maximum number of spans per spanset that are returned from Tempo
|
||||
Spss *int64 `json:"spss,omitempty"`
|
||||
}
|
||||
|
||||
// TempoQueryType search = Loki search, nativeSearch = Tempo search for backwards compatibility
|
||||
|
@ -44,6 +44,8 @@ composableKinds: DataQuery: {
|
||||
serviceMapIncludeNamespace?: bool
|
||||
// Defines the maximum number of traces that are returned from Tempo
|
||||
limit?: int64
|
||||
// Defines the maximum number of spans per spanset that are returned from Tempo
|
||||
spss?: int64
|
||||
filters: [...#TraceqlFilter]
|
||||
// Filters that are used to query the metrics summary
|
||||
groupBy?: [...#TraceqlFilter]
|
||||
|
@ -52,6 +52,10 @@ export interface TempoQuery extends common.DataQuery {
|
||||
* @deprecated Query traces by span name
|
||||
*/
|
||||
spanName?: string;
|
||||
/**
|
||||
* Defines the maximum number of spans per spanset that are returned from Tempo
|
||||
*/
|
||||
spss?: number;
|
||||
}
|
||||
|
||||
export const defaultTempoQuery: Partial<TempoQuery> = {
|
||||
|
@ -68,6 +68,7 @@ import { getErrorMessage } from './utils';
|
||||
import { TempoVariableSupport } from './variables';
|
||||
|
||||
export const DEFAULT_LIMIT = 20;
|
||||
export const DEFAULT_SPSS = 3; // spans per span set
|
||||
|
||||
enum FeatureName {
|
||||
streaming = 'streaming',
|
||||
@ -352,6 +353,7 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
|
||||
this._request('/api/search', {
|
||||
q: queryValue,
|
||||
limit: options.targets[0].limit ?? DEFAULT_LIMIT,
|
||||
spss: options.targets[0].spss ?? DEFAULT_SPSS,
|
||||
start: options.range.from.unix(),
|
||||
end: options.range.to.unix(),
|
||||
}).pipe(
|
||||
@ -405,6 +407,7 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
|
||||
this._request('/api/search', {
|
||||
q: queryValue,
|
||||
limit: options.targets[0].limit ?? DEFAULT_LIMIT,
|
||||
spss: options.targets[0].spss ?? DEFAULT_SPSS,
|
||||
start: options.range.from.unix(),
|
||||
end: options.range.to.unix(),
|
||||
}).pipe(
|
||||
|
@ -17,7 +17,7 @@ import {
|
||||
import { getGrafanaLiveSrv } from '@grafana/runtime';
|
||||
|
||||
import { SearchStreamingState } from './dataquery.gen';
|
||||
import { TempoDatasource } from './datasource';
|
||||
import { DEFAULT_SPSS, TempoDatasource } from './datasource';
|
||||
import { createTableFrameFromTraceQlQuery } from './resultTransformer';
|
||||
import { SearchMetrics, TempoJsonData, TempoQuery } from './types';
|
||||
export async function getLiveStreamKey(): Promise<string> {
|
||||
@ -45,6 +45,7 @@ export function doTempoChannelStream(
|
||||
path: `search/${key}`,
|
||||
data: {
|
||||
...query,
|
||||
SpansPerSpanSet: query.spss ?? DEFAULT_SPSS,
|
||||
timeRange: {
|
||||
from: range.from.toISOString(),
|
||||
to: range.to.toISOString(),
|
||||
|
@ -4,7 +4,7 @@ import { EditorField, EditorRow } from '@grafana/experimental';
|
||||
import { AutoSizeInput } from '@grafana/ui';
|
||||
import { QueryOptionGroup } from 'app/plugins/datasource/prometheus/querybuilder/shared/QueryOptionGroup';
|
||||
|
||||
import { DEFAULT_LIMIT } from '../datasource';
|
||||
import { DEFAULT_LIMIT, DEFAULT_SPSS } from '../datasource';
|
||||
import { TempoQuery } from '../types';
|
||||
|
||||
interface Props {
|
||||
@ -20,8 +20,11 @@ export const TempoQueryBuilderOptions = React.memo<Props>(({ onChange, query })
|
||||
const onLimitChange = (e: React.FormEvent<HTMLInputElement>) => {
|
||||
onChange({ ...query, limit: parseInt(e.currentTarget.value, 10) });
|
||||
};
|
||||
const onSpssChange = (e: React.FormEvent<HTMLInputElement>) => {
|
||||
onChange({ ...query, spss: parseInt(e.currentTarget.value, 10) });
|
||||
};
|
||||
|
||||
const collapsedInfoList = [`Limit: ${query.limit || DEFAULT_LIMIT}`];
|
||||
const collapsedInfoList = [`Limit: ${query.limit || DEFAULT_LIMIT}`, `Spans Limit: ${query.spss || DEFAULT_SPSS}`];
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -38,6 +41,17 @@ export const TempoQueryBuilderOptions = React.memo<Props>(({ onChange, query })
|
||||
value={query.limit}
|
||||
/>
|
||||
</EditorField>
|
||||
<EditorField label="Span Limit" tooltip="Maximum number of spans to return for each span set.">
|
||||
<AutoSizeInput
|
||||
className="width-4"
|
||||
placeholder="auto"
|
||||
type="number"
|
||||
min={1}
|
||||
defaultValue={query.spss || DEFAULT_SPSS}
|
||||
onCommitChange={onSpssChange}
|
||||
value={query.spss}
|
||||
/>
|
||||
</EditorField>
|
||||
</QueryOptionGroup>
|
||||
</EditorRow>
|
||||
</>
|
||||
|
Loading…
Reference in New Issue
Block a user