Skip to content

Commit feabfd3

Browse files
committed
fix source lint for ai
1 parent e6330c2 commit feabfd3

File tree

1 file changed

+17
-6
lines changed
  • packages/api/src/routers/api

1 file changed

+17
-6
lines changed

packages/api/src/routers/api/ai.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ router.post(
268268
connection: connectionId,
269269
where: '',
270270
groupBy: '',
271-
timestampValueExpression: source.timestampValueExpression,
271+
timestampValueExpression: source.timestampValueExpression ?? '',
272272
dateRange: [new Date(Date.now() - ms('60m')), new Date()],
273273
};
274274
const keyValues = await metadata.getKeyValues({
@@ -298,15 +298,26 @@ Here are some guidelines:
298298
299299
The user is looking to do a query on their data source named: ${source.name} of type ${source.kind}.
300300
301-
The ${source.kind === SourceKind.Log ? 'log level' : 'span status code'} is stored in ${source.severityTextExpression}.
302-
You can identify services via ${source.serviceNameExpression}
301+
${
302+
source.kind === SourceKind.Log
303+
? `The log level is stored in ${source.severityTextExpression}.`
304+
: source.kind === SourceKind.Trace
305+
? `The span status code is stored in ${source.statusCodeExpression}.`
306+
: ''
307+
}
308+
309+
${'serviceNameExpression' in source ? `You can identify services via ${source.serviceNameExpression}` : ''}
310+
303311
${
304312
source.kind === SourceKind.Trace
305313
? `Duration of spans can be queried via ${source.durationExpression} which is expressed in 10^-${source.durationPrecision} seconds of precision.
306314
Span names under ${source.spanNameExpression} and span kinds under ${source.spanKindExpression}`
307-
: `The log body can be queried via ${source.bodyExpression}`
315+
: source.kind === SourceKind.Log
316+
? `The log body can be queried via ${source.bodyExpression}`
317+
: ''
308318
}
309-
Various log/span-specific attributes as a Map can be found under ${source.eventAttributesExpression} while resource attributes that follow the OpenTelemetry semantic convention can be found under ${source.resourceAttributesExpression}
319+
${'eventAttributesExpression' in source ? `Various log/span-specific attributes as a Map can be found under ${source.eventAttributesExpression}.` : ''}
320+
${'resourceAttributesExpression' in source ? `Resource attributes that follow the OpenTelemetry semantic convention can be found under ${source.resourceAttributesExpression}.` : ''}
310321
You must use the full field name ex. "column['key']" or "column.key" as it appears.
311322
312323
The following is a list of properties and example values that exist in the source:
@@ -386,7 +397,7 @@ ${JSON.stringify(allFieldsWithKeys.slice(0, 200).map(f => ({ field: f.key, type:
386397
connection: connectionId,
387398
where: '',
388399
groupBy: resObject.groupBy,
389-
timestampValueExpression: source.timestampValueExpression,
400+
timestampValueExpression: source.timestampValueExpression ?? '',
390401
dateRange,
391402
granularity: 'auto',
392403
};

0 commit comments

Comments
 (0)