Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Scale3-Labs/langtrace into release
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikscale3 committed Jun 7, 2024
2 parents 4187923 + 0a0cb33 commit f5ecb80
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# [Langtrace](https://www.langtrace.ai)
Open Source Observability for LLM applications

## Open Source & Open Telemetry(OTEL) Observability for LLM applications

Expand Down
16 changes: 16 additions & 0 deletions lib/services/trace_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export class TraceService implements ITraceService {

async GetSpanById(span_id: string, project_id: string): Promise<Span> {
try {
const tableExists = await this.client.checkTableExists(project_id);
if (!tableExists) {
return {} as Span;
}
const query = sql.select().from(project_id).where({ span_id });
const span: Span[] = await this.client.find<Span[]>(query);
return span[0];
Expand All @@ -127,6 +131,10 @@ export class TraceService implements ITraceService {

async GetTraceById(trace_id: string, project_id: string): Promise<Span[]> {
try {
const tableExists = await this.client.checkTableExists(project_id);
if (!tableExists) {
return [];
}
const query = sql.select().from(project_id).where({ trace_id });
const span: Span[] = await this.client.find<Span[]>(query);
return span;
Expand Down Expand Up @@ -305,6 +313,10 @@ export class TraceService implements ITraceService {

async GetFailedSpans(project_id: string): Promise<Span[]> {
try {
const tableExists = await this.client.checkTableExists(project_id);
if (!tableExists) {
return [];
}
const query = sql
.select()
.from(project_id)
Expand Down Expand Up @@ -403,6 +415,10 @@ export class TraceService implements ITraceService {
lastNHours = 168
): Promise<Span[]> {
try {
const tableExists = await this.client.checkTableExists(project_id);
if (!tableExists) {
return [];
}
const query = sql.select().from(project_id);
if (!lastNHours) {
return await this.client.find<Span[]>(query);
Expand Down

0 comments on commit f5ecb80

Please sign in to comment.