Skip to content

Commit 3e77ce1

Browse files
committed
fix: ci check
Signed-off-by: sun <sunchang_long@163.com>
1 parent ea1dbc3 commit 3e77ce1

4 files changed

Lines changed: 12 additions & 16 deletions

File tree

greptimedb/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/perses/plugins/greptimedb
22

3-
go 1.26.0
3+
go 1.25.7
44

55
require github.com/perses/perses v0.53.1
66

greptimedb/schemas/datasources/greptimedb-datasource/greptimedb-datasource.cue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
kind: #kind
2424
spec: {
2525
commonProxy.#baseHTTPDatasourceSpec
26+
2627
// headers are forwarded on GreptimeDB SQL API requests (e.g. Authorization).
2728
// Used with directUrl when the Perses server is not proxying traffic; the host app may inject
2829
// headers at datasource init instead of storing credentials in dashboard JSON.

greptimedb/src/model/greptimedb-client.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ describe('readErrorResponse (via greptimedbQuery)', () => {
5050
const result = await greptimedbQuery({ query: 'SELECT 1' }, queryOptions);
5151

5252
expect(result.status).toBe('error');
53-
expect(result.error).toBe(
54-
`GreptimeDB error: 400 Bad Request - ${JSON.stringify(GREPTIMEDB_SQL_ERROR_JSON)}`
55-
);
53+
expect(result.error).toBe(`GreptimeDB error: 400 Bad Request - ${JSON.stringify(GREPTIMEDB_SQL_ERROR_JSON)}`);
5654
});
5755

5856
it('formats non-JSON errors via response.text()', async () => {

greptimedb/src/queries/greptimedb-trace-query/get-greptimedb-trace-data.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ function buildColumnIndexMap(columns: GreptimeDBColumnSchema[] | undefined): Col
103103

104104
/** GreptimeDB /v1/sql includes data_type on every column_schemas entry. */
105105
function getColumnDataType(columns: GreptimeDBColumnSchema[], index: number): string {
106-
const dataType = columns[index].data_type;
106+
const column = columns[index];
107+
if (!column) {
108+
throw new Error(`GreptimeDB SQL response missing column at index ${index}`);
109+
}
110+
const dataType = column.data_type;
107111
if (!dataType) {
108-
throw new Error(
109-
`GreptimeDB SQL response missing data_type for column "${columns[index]?.name ?? String(index)}"`
110-
);
112+
throw new Error(`GreptimeDB SQL response missing data_type for column "${column.name}"`);
111113
}
112114
return dataType;
113115
}
@@ -271,9 +273,7 @@ function buildSearchResult(records: GreptimeDBRecords | undefined): TraceSearchR
271273

272274
function isIntegerGreptimeDataType(dataType: string): boolean {
273275
const normalized = dataType.toLowerCase();
274-
return (
275-
normalized.includes('int') || normalized.includes('uint') || normalized === 'bigint'
276-
);
276+
return normalized.includes('int') || normalized.includes('uint') || normalized === 'bigint';
277277
}
278278

279279
/**
@@ -381,9 +381,7 @@ function convertRowsToTrace(records: GreptimeDBRecords | undefined): otlptracev1
381381
const durationIndex = map.duration_nano ?? map.duration_ns;
382382

383383
const startTimeUnixNano =
384-
(startIndex !== undefined
385-
? (toNanoString(row[startIndex], getColumnDataType(columns, startIndex)) ?? '0')
386-
: '0');
384+
startIndex !== undefined ? (toNanoString(row[startIndex], getColumnDataType(columns, startIndex)) ?? '0') : '0';
387385
const endTimeUnixNano =
388386
(endIndex !== undefined
389387
? (toNanoString(row[endIndex], getColumnDataType(columns, endIndex)) ?? '0')
@@ -408,8 +406,7 @@ function convertRowsToTrace(records: GreptimeDBRecords | undefined): otlptracev1
408406
// span_events / span_links: JSON columns (data_type Json). Only events need OTLP time parsing.
409407
const spanEvents = parseJsonArray(getCell(row, map, ['span_events'])).map((event) => {
410408
const e = event as Record<string, unknown>;
411-
const eventTime =
412-
otlpEventTimeToNanoString(e.timeUnixNano ?? e.time_unix_nano) ?? startTimeUnixNano;
409+
const eventTime = otlpEventTimeToNanoString(e.timeUnixNano ?? e.time_unix_nano) ?? startTimeUnixNano;
413410
const eventName = getString(e.name) ?? 'event';
414411
const attrs = e.attributes as Record<string, unknown> | undefined;
415412
const attributes = attrs

0 commit comments

Comments
 (0)