Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions docs/api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2596,19 +2596,6 @@ components:
repeatVariable:
type: string
type: object
DashboardLink:
properties:
name:
type: string
renderVariables:
type: boolean
targetBlank:
type: boolean
tooltip:
type: string
url:
type: string
type: object
DashboardtypesAxes:
properties:
isLogScale:
Expand Down Expand Up @@ -2747,6 +2734,7 @@ components:
datasources:
additionalProperties:
$ref: '#/components/schemas/DashboardtypesDatasourceSpec'
nullable: true
type: object
display:
$ref: '#/components/schemas/DashboardtypesDisplay'
Expand All @@ -2758,7 +2746,8 @@ components:
type: array
links:
items:
$ref: '#/components/schemas/DashboardLink'
$ref: '#/components/schemas/DashboardtypesLink'
nullable: true
type: array
panels:
additionalProperties:
Expand Down Expand Up @@ -3029,6 +3018,19 @@ components:
- solid
- dashed
type: string
DashboardtypesLink:
properties:
name:
type: string
renderVariables:
type: boolean
targetBlank:
type: boolean
tooltip:
type: string
url:
type: string
type: object
DashboardtypesListOrder:
enum:
- asc
Expand Down Expand Up @@ -3389,7 +3391,8 @@ components:
$ref: '#/components/schemas/DashboardtypesDisplay'
links:
items:
$ref: '#/components/schemas/DashboardLink'
$ref: '#/components/schemas/DashboardtypesLink'
nullable: true
type: array
plugin:
$ref: '#/components/schemas/DashboardtypesPanelPlugin'
Expand Down Expand Up @@ -6334,6 +6337,7 @@ components:
- delta
- cumulative
- unspecified
- ""
type: string
MetrictypesTimeAggregation:
enum:
Expand All @@ -6346,6 +6350,7 @@ components:
- count_distinct
- rate
- increase
- ""
type: string
MetrictypesType:
enum:
Expand Down Expand Up @@ -8596,6 +8601,7 @@ components:
TelemetrytypesSource:
enum:
- meter
- ""
type: string
TelemetrytypesTelemetryFieldKey:
properties:
Expand Down
67 changes: 38 additions & 29 deletions frontend/src/api/generated/services/sigNoz.schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3300,29 +3300,6 @@ export interface DashboardGridLayoutSpecDTO {
repeatVariable?: string;
}

export interface DashboardLinkDTO {
/**
* @type string
*/
name?: string;
/**
* @type boolean
*/
renderVariables?: boolean;
/**
* @type boolean
*/
targetBlank?: boolean;
/**
* @type string
*/
tooltip?: string;
/**
* @type string
*/
url?: string;
}

export interface DashboardtypesAxesDTO {
/**
* @type boolean
Expand Down Expand Up @@ -3631,6 +3608,7 @@ export enum Querybuildertypesv5QueryBuilderQueryGithubComSigNozSignozPkgTypesQue
}
export enum TelemetrytypesSourceDTO {
meter = 'meter',
'' = '',
}
export interface Querybuildertypesv5QueryBuilderQueryGithubComSigNozSignozPkgTypesQuerybuildertypesQuerybuildertypesv5LogAggregationDTO {
/**
Expand Down Expand Up @@ -3730,6 +3708,7 @@ export enum MetrictypesTemporalityDTO {
delta = 'delta',
cumulative = 'cumulative',
unspecified = 'unspecified',
'' = '',
}
export enum MetrictypesTimeAggregationDTO {
latest = 'latest',
Expand All @@ -3741,6 +3720,7 @@ export enum MetrictypesTimeAggregationDTO {
count_distinct = 'count_distinct',
rate = 'rate',
increase = 'increase',
'' = '',
}
export interface Querybuildertypesv5MetricAggregationDTO {
comparisonSpaceAggregationParam?: MetrictypesComparisonSpaceAggregationParamDTO;
Expand Down Expand Up @@ -4034,10 +4014,16 @@ export interface DashboardtypesDatasourceSpecDTO {
plugin?: DashboardtypesDatasourcePluginDTO;
}

export type DashboardtypesDashboardSpecDTODatasources = {
export type DashboardtypesDashboardSpecDTODatasourcesAnyOf = {
[key: string]: DashboardtypesDatasourceSpecDTO;
};

/**
* @nullable
*/
export type DashboardtypesDashboardSpecDTODatasources =
DashboardtypesDashboardSpecDTODatasourcesAnyOf | null;

export enum DashboardtypesPanelKindDTO {
Panel = 'Panel',
}
Expand All @@ -4052,6 +4038,29 @@ export interface DashboardtypesDisplayDTO {
name: string;
}

export interface DashboardtypesLinkDTO {
/**
* @type string
*/
name?: string;
/**
* @type boolean
*/
renderVariables?: boolean;
/**
* @type boolean
*/
targetBlank?: boolean;
/**
* @type string
*/
tooltip?: string;
/**
* @type string
*/
url?: string;
}

export enum DashboardtypesPanelPluginVariantGithubComSigNozSignozPkgTypesDashboardtypesTimeSeriesPanelSpecDTOKind {
'signoz/TimeSeriesPanel' = 'signoz/TimeSeriesPanel',
}
Expand Down Expand Up @@ -4613,9 +4622,9 @@ export interface DashboardtypesQueryDTO {
export interface DashboardtypesPanelSpecDTO {
display: DashboardtypesDisplayDTO;
/**
* @type array
* @type array,null
*/
links?: DashboardLinkDTO[];
links?: DashboardtypesLinkDTO[] | null;
plugin: DashboardtypesPanelPluginDTO;
/**
* @type array
Expand Down Expand Up @@ -4789,7 +4798,7 @@ export type DashboardtypesVariableDTO =

export interface DashboardtypesDashboardSpecDTO {
/**
* @type object
* @type object,null
*/
datasources?: DashboardtypesDashboardSpecDTODatasources;
display: DashboardtypesDisplayDTO;
Expand All @@ -4802,9 +4811,9 @@ export interface DashboardtypesDashboardSpecDTO {
*/
layouts: DashboardtypesLayoutDTO[];
/**
* @type array
* @type array,null
*/
links?: DashboardLinkDTO[];
links?: DashboardtypesLinkDTO[] | null;
/**
* @type object
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ComponentType } from 'react';
import type {
DashboardLinkDTO,
DashboardtypesLinkDTO,
DashboardtypesAxesDTO,
DashboardtypesBarChartVisualizationDTO,
DashboardtypesHistogramBucketsDTO,
Expand Down Expand Up @@ -120,7 +120,7 @@ export const SECTION_REGISTRY: {
[SectionKind.ContextLinks]: {
Component: ContextLinksSection,
// Panel-level slice (spec.links), not under the plugin spec — no cast needed.
get: (spec): DashboardLinkDTO[] | undefined => spec.links,
get: (spec): DashboardtypesLinkDTO[] | undefined => spec.links ?? undefined,
update: (spec, links): PanelSpec => ({ ...spec, links }),
},
// One editor for every threshold variant (label / comparison / table); the kind's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DialogWrapper } from '@signozhq/ui/dialog';
import { Switch } from '@signozhq/ui/switch';
import { Typography } from '@signozhq/ui/typography';
import { Input } from 'antd';
import type { DashboardLinkDTO } from 'api/generated/services/sigNoz.schemas';
import type { DashboardtypesLinkDTO } from 'api/generated/services/sigNoz.schemas';

import type { UrlParam, VariableItem } from './types';
import {
Expand All @@ -21,10 +21,10 @@ import styles from './ContextLinksSection.module.scss';
interface ContextLinkDialogProps {
open: boolean;
/** The link being edited, or null when adding a new one. */
initialLink: DashboardLinkDTO | null;
initialLink: DashboardtypesLinkDTO | null;
variables: VariableItem[];
onOpenChange: (open: boolean) => void;
onSave: (link: DashboardLinkDTO) => void;
onSave: (link: DashboardtypesLinkDTO) => void;
}

const URL_ERROR = 'URL must start with http(s)://, /, or {{variable}}/';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Pencil, Trash2 } from '@signozhq/icons';
import { Button } from '@signozhq/ui/button';
import { Typography } from '@signozhq/ui/typography';
import type { DashboardLinkDTO } from 'api/generated/services/sigNoz.schemas';
import type { DashboardtypesLinkDTO } from 'api/generated/services/sigNoz.schemas';

import styles from './ContextLinksSection.module.scss';

interface ContextLinkListItemProps {
link: DashboardLinkDTO;
link: DashboardtypesLinkDTO;
index: number;
onEdit: () => void;
onRemove: () => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { Plus } from '@signozhq/icons';
import { Button } from '@signozhq/ui/button';
import type { DashboardLinkDTO } from 'api/generated/services/sigNoz.schemas';
import type { DashboardtypesLinkDTO } from 'api/generated/services/sigNoz.schemas';
import type {
SectionEditorProps,
SectionKind,
Expand Down Expand Up @@ -34,7 +34,7 @@ function ContextLinksSection({
const removeAt = (index: number): void =>
onChange(links.filter((_, i) => i !== index));

const handleSave = (link: DashboardLinkDTO): void => {
const handleSave = (link: DashboardtypesLinkDTO): void => {
onChange(
dialog.index === null
? [...links, link]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fireEvent, render, screen } from '@testing-library/react';
import type { DashboardLinkDTO } from 'api/generated/services/sigNoz.schemas';
import type { DashboardtypesLinkDTO } from 'api/generated/services/sigNoz.schemas';

import ContextLinksSection from '../ContextLinksSection';

Expand All @@ -12,11 +12,11 @@ jest.mock('../useContextLinkVariables', () => ({
],
}));

const LINKS: DashboardLinkDTO[] = [
const LINKS: DashboardtypesLinkDTO[] = [
{ name: 'Docs', url: 'https://signoz.io', targetBlank: true },
];

const lastCall = (fn: jest.Mock): DashboardLinkDTO[] =>
const lastCall = (fn: jest.Mock): DashboardtypesLinkDTO[] =>
fn.mock.calls[fn.mock.calls.length - 1][0];

describe('ContextLinksSection', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {
DashboardLinkDTO,
DashboardtypesLinkDTO,
DashboardtypesAxesDTO,
DashboardtypesBarChartVisualizationDTO,
DashboardtypesComparisonThresholdDTO,
Expand Down Expand Up @@ -89,7 +89,7 @@ export interface SectionSpecMap {
// the `controls` bag gates which fields each kind writes.
[SectionKind.Visualization]: DashboardtypesBarChartVisualizationDTO;
[SectionKind.Thresholds]: AnyThreshold[]; // spec.plugin.spec.thresholds (variant picks the editor)
[SectionKind.ContextLinks]: DashboardLinkDTO[]; // spec.links (PANEL-level)
[SectionKind.ContextLinks]: DashboardtypesLinkDTO[]; // spec.links (PANEL-level)
[SectionKind.Columns]: TelemetrytypesTelemetryFieldKeyDTO[]; // spec.plugin.spec.selectFields (List)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DashboardLinkDTO } from 'api/generated/services/sigNoz.schemas';
import type { DashboardtypesLinkDTO } from 'api/generated/services/sigNoz.schemas';
import { resolveTexts } from 'hooks/dashboard/useContextVariables';

import { resolveContextLinkUrl } from './resolveContextLinkUrl';
Expand All @@ -15,7 +15,7 @@ export interface ResolvedDrilldownLink {
* label + URL, drops links without a URL, and skips substitution when `renderVariables === false`.
*/
export function resolvePanelContextLinks(
links: DashboardLinkDTO[] | undefined,
links: DashboardtypesLinkDTO[] | undefined,
processedVariables: Record<string, string>,
): ResolvedDrilldownLink[] {
const usable = (links ?? []).filter((link) => !!link.url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Loader,
ScrollText,
} from '@signozhq/icons';
import type { DashboardLinkDTO } from 'api/generated/services/sigNoz.schemas';
import type { DashboardtypesLinkDTO } from 'api/generated/services/sigNoz.schemas';
import { getAggregateColumnHeader } from 'container/QueryTable/Drilldown/drilldownUtils';
import ContextMenu from 'periscope/components/ContextMenu';
import type { DrilldownContext } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/drilldown';
Expand All @@ -27,7 +27,7 @@ interface DrilldownAggregateMenuProps {
/** While dashboard variables resolve, the actions show a spinner and are disabled. */
isResolving?: boolean;
/** Panel's context links; resolved against the clicked point + variables here. */
links: DashboardLinkDTO[] | undefined;
links: DashboardtypesLinkDTO[] | undefined;
/** Whether the clicked point exposes group-by fields to bind to dashboard variables. */
canSetDashboardVariables: boolean;
onViewLogs: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export function useDrilldown(
context={context}
query={v1Query}
isResolving={isResolving}
links={panel.spec.links}
links={panel.spec.links ?? undefined}
canSetDashboardVariables={dashboardVariables.hasFieldVariables}
onViewLogs={(): void => navigate('view_logs')}
onViewTraces={(): void => navigate('view_traces')}
Expand Down
8 changes: 8 additions & 0 deletions pkg/modules/rawdataexport/implrawdataexport/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net/http"
"reflect"
"slices"
"strconv"
"time"
Expand Down Expand Up @@ -285,6 +286,13 @@ func constructCSVRecordFromQueryResponse(data map[string]any, headerToIndexMappi
for key, value := range data {
if index, exists := headerToIndexMapping[key]; exists && value != nil {

if rv := reflect.ValueOf(value); rv.Kind() == reflect.Pointer {
if rv.IsNil() {
continue
}
value = rv.Elem().Interface()
}

var valueStr string
switch v := value.(type) {
case string:
Expand Down
Loading
Loading