Skip to content

Commit 6532732

Browse files
karthikscale3dylanzuber-scale3alizenhomdabiras3Dabira12
authored
Release 3.0.12 (#300)
* Pagination bug * Bug fix * Update package * Bugfixes * Add migration file * adding ability to add to dataset from traces tab * fixing z-index bug * fixing llm parsing, disable button for non llm traces * cleaning up api providers page * more bug fixes, auditing models * adding api key auth to create project api key (#270) * Improvements to prompt playground (#272) * fixing static text area, fixing overlap * creating custo ui for playground taces * fetching traces on dialog open * fixes * fixes * fixes --------- Co-authored-by: Karthik Kalyanaraman <[email protected]> * fix * fix * support for o1-preview and o1-mini (#275) * fixing live prompt bug (#277) * DSPy enhancements (#280) * DSPy experiments * LiteLLM support * eval charts * experiment metrics * empty state * minor fix * fix * clearing invite form fields on send (#279) * Track project creation count metrics (#271) * adding posthog * bug fixes, adding new env vars * adding posthog api key to dockerfile * updating read me * removing sensitive data * removing more data * adding sign up count by team * minor * update * fixes --------- Co-authored-by: Karthik Kalyanaraman <[email protected]> * minor * minor (#282) * add vercel ai pricing (#283) * fix (#284) * Fixes (#289) * Add `Gemini` Cost table (#291) * add gemini cost tables * remove protobuf helper * Fixing token counts if `output_tokens` is `0` + adding embedding cost tables (#292) * make tracing endpoint `route.ts` oTel compatible backend. (#298) * make tracing endpoint `route.ts` oTel compatible backend. * handle null events * fallback for status code * remove console statement * Upload csv feature (#265) * all changes for upload csv feature * upddated package.json.lock * updated package.lock.json * update package lock * fixes * validation --------- Co-authored-by: Oluwadabira Akinwumi <[email protected]> Co-authored-by: Karthik Kalyanaraman <[email protected]> * Update package lock (#299) * all changes for upload csv feature * upddated package.json.lock * updated package.lock.json * update package lock * fixes * validation * validation --------- Co-authored-by: Oluwadabira Akinwumi <[email protected]> --------- Co-authored-by: dylan <[email protected]> Co-authored-by: dylanzuber-scale3 <[email protected]> Co-authored-by: Ali Waleed <[email protected]> Co-authored-by: dabiras3 <[email protected]> Co-authored-by: Oluwadabira Akinwumi <[email protected]>
1 parent 2fab20e commit 6532732

File tree

12 files changed

+19620
-18037
lines changed

12 files changed

+19620
-18037
lines changed

app/(protected)/project/[project_id]/datasets/dataset/[dataset_id]/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { PathBreadCrumbs } from "@/components/dataset/path-breadcrumbs";
44
import { ExpandingTextArea } from "@/components/playground/common";
5+
import { UploadCsv } from "@/components/project/dataset/upload-csv";
56
import { CreateData } from "@/components/project/dataset/create-data";
67
import DatasetRowSkeleton from "@/components/project/dataset/dataset-row-skeleton";
78
import { DeleteData } from "@/components/project/dataset/delete-data";
@@ -394,6 +395,7 @@ export default function Dataset() {
394395
<div className="flex justify-between items-center">
395396
<div className="flex gap-4 items-center w-fit">
396397
<CreateData projectId={projectId} datasetId={dataset_id} />
398+
<UploadCsv projectId={projectId} datasetId={dataset_id}/>
397399
<DownloadDataset
398400
projectId={projectId}
399401
datasetId={dataset_id}

app/api/project/route.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,9 @@ export async function POST(req: NextRequest) {
8989
});
9090
}
9191

92-
const session = await getServerSession(authOptions);
93-
const userEmail = session?.user?.email ?? "anonymous";
9492
await captureEvent(project.id, "project_created", {
95-
project_name: project.name,
93+
project_name: name,
94+
project_description: description,
9695
project_type: projectType,
9796
});
9897
}

app/api/trace/common.proto

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Copyright 2019, OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package opentelemetry.proto.common.v1;
18+
19+
option csharp_namespace = "OpenTelemetry.Proto.Common.V1";
20+
option java_multiple_files = true;
21+
option java_package = "io.opentelemetry.proto.common.v1";
22+
option java_outer_classname = "CommonProto";
23+
option go_package = "go.opentelemetry.io/proto/otlp/common/v1";
24+
25+
// AnyValue is used to represent any type of attribute value. AnyValue may contain a
26+
// primitive value such as a string or integer or it may contain an arbitrary nested
27+
// object containing arrays, key-value lists and primitives.
28+
message AnyValue {
29+
// The value is one of the listed fields. It is valid for all values to be unspecified
30+
// in which case this AnyValue is considered to be "empty".
31+
oneof value {
32+
string string_value = 1;
33+
bool bool_value = 2;
34+
int64 int_value = 3;
35+
double double_value = 4;
36+
ArrayValue array_value = 5;
37+
KeyValueList kvlist_value = 6;
38+
bytes bytes_value = 7;
39+
}
40+
}
41+
42+
// ArrayValue is a list of AnyValue messages. We need ArrayValue as a message
43+
// since oneof in AnyValue does not allow repeated fields.
44+
message ArrayValue {
45+
// Array of values. The array may be empty (contain 0 elements).
46+
repeated AnyValue values = 1;
47+
}
48+
49+
// KeyValueList is a list of KeyValue messages. We need KeyValueList as a message
50+
// since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need
51+
// a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to
52+
// avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches
53+
// are semantically equivalent.
54+
message KeyValueList {
55+
// A collection of key/value pairs of key-value pairs. The list may be empty (may
56+
// contain 0 elements).
57+
// The keys MUST be unique (it is not allowed to have more than one
58+
// value with the same key).
59+
repeated KeyValue values = 1;
60+
}
61+
62+
// KeyValue is a key-value pair that is used to store Span attributes, Link
63+
// attributes, etc.
64+
message KeyValue {
65+
string key = 1;
66+
AnyValue value = 2;
67+
}
68+
69+
// InstrumentationScope is a message representing the instrumentation scope information
70+
// such as the fully qualified name and version.
71+
message InstrumentationScope {
72+
// An empty instrumentation scope name means the name is unknown.
73+
string name = 1;
74+
string version = 2;
75+
76+
// Additional attributes that describe the scope. [Optional].
77+
// Attribute keys MUST be unique (it is not allowed to have more than one
78+
// attribute with the same key).
79+
repeated KeyValue attributes = 3;
80+
uint32 dropped_attributes_count = 4;
81+
}

app/api/trace/resource.proto

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2019, OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package opentelemetry.proto.resource.v1;
18+
19+
import "common.proto";
20+
21+
option csharp_namespace = "OpenTelemetry.Proto.Resource.V1";
22+
option java_multiple_files = true;
23+
option java_package = "io.opentelemetry.proto.resource.v1";
24+
option java_outer_classname = "ResourceProto";
25+
option go_package = "go.opentelemetry.io/proto/otlp/resource/v1";
26+
27+
// Resource information.
28+
message Resource {
29+
// Set of attributes that describe the resource.
30+
// Attribute keys MUST be unique (it is not allowed to have more than one
31+
// attribute with the same key).
32+
repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;
33+
34+
// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
35+
// no attributes were dropped.
36+
uint32 dropped_attributes_count = 2;
37+
}

app/api/trace/route.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,20 @@ import {
99
import { getServerSession } from "next-auth";
1010
import { redirect } from "next/navigation";
1111
import { NextRequest, NextResponse } from "next/server";
12+
import protobuf from "protobufjs";
13+
import path from "path";
1214

1315
export async function POST(req: NextRequest) {
1416
try {
15-
const data = await req.json();
17+
const contentType = req.headers.get("content-type");
18+
19+
let data;
20+
if (contentType === "application/x-protobuf") {
21+
data = await decodeProtobuf(req);
22+
} else {
23+
data = await req.json();
24+
}
25+
1626
const apiKey = req.headers.get("x-api-key");
1727
const userAgent = req.headers.get("user-agent");
1828

@@ -26,7 +36,8 @@ export async function POST(req: NextRequest) {
2636

2737
// Normalize and prepare data for Clickhouse
2838
let normalized = [];
29-
if (userAgent?.toLowerCase().includes("otel-otlp") ||
39+
if (
40+
userAgent?.toLowerCase().includes("otel-otlp") ||
3041
userAgent?.toLowerCase().includes("opentelemetry")
3142
) {
3243
// coming from an OTEL exporter
@@ -136,3 +147,27 @@ export async function GET(req: NextRequest) {
136147
});
137148
}
138149
}
150+
151+
async function decodeProtobuf(req: NextRequest) {
152+
// Load the Protobuf schema
153+
const loadProtobuf = async () => {
154+
return protobuf.load(path.resolve("app/api/trace", "trace.proto"));
155+
};
156+
157+
// Get raw data from the request body as ArrayBuffer
158+
const arrayBuffer = await req.arrayBuffer();
159+
const uint8Array = new Uint8Array(arrayBuffer); // Convert to Uint8Array
160+
161+
// Load and decode the Protobuf schema
162+
const root = await loadProtobuf();
163+
164+
const TracesData = root.lookupType("opentelemetry.proto.trace.v1.TracesData");
165+
166+
// Decode the Protobuf binary data
167+
const decodedData = TracesData.decode(uint8Array);
168+
169+
// Do something with decoded data (e.g., store in a database)
170+
171+
const data = JSON.parse(JSON.stringify(decodedData, null, 2));
172+
return data;
173+
}

0 commit comments

Comments
 (0)