Skip to content

Commit

Permalink
Add UI for instrumented spans of Cloudflare bindings (#217)
Browse files Browse the repository at this point in the history
* Add Cloudflare assets

* Add logic to put cloudflare binding icons in UI when a span comes from a cf binding

* Fix some layout on the timeline

* Add D1 sql query

* Another layout fix for rendering json bodies from history

* Start adding richer data to CF spans

* Start adding more smarts to the cf binding sections

* Add args sections for r2 ai etc

* Remove unused imports

* Fix CloudflareAI logo import

* Update wrangler across projects

* Add model smarts to the ai spans

* Factor out the cloudflare spans into separate files

* Improve KV span component

* Format and typecheck

* Update beta version of client lib

* Remove cl
  • Loading branch information
brettimus authored Sep 1, 2024
1 parent 5e783db commit 616b436
Show file tree
Hide file tree
Showing 32 changed files with 639 additions and 84 deletions.
2 changes: 1 addition & 1 deletion examples/ai-request-generation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240821.1",
"wrangler": "^3.72.3"
"wrangler": "^3.73.0"
}
}
2 changes: 1 addition & 1 deletion examples/goose-quotes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"devDependencies": {
"@cloudflare/workers-types": "^4.20240821.1",
"drizzle-kit": "^0.23.0",
"wrangler": "^3.72.3"
"wrangler": "^3.73.0"
},
"homepage": "https://github.com/fiberplane/fpx/examples/goose-quotes#readme"
}
2 changes: 1 addition & 1 deletion examples/goosify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240821.1",
"wrangler": "^3.72.3"
"wrangler": "^3.73.0"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"pkg-pr-new": "^0.0.20",
"rimraf": "^5.0.7",
"typescript": "^5.5.4",
"wrangler": "^3.62.0"
"wrangler": "^3.73.0"
}
}
2 changes: 1 addition & 1 deletion packages/client-library-otel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "Fiberplane<[email protected]>",
"type": "module",
"main": "dist/index.js",
"version": "0.1.0-beta.11",
"version": "0.1.0-beta.12",
"dependencies": {
"@opentelemetry/api": "~1.9.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.52.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/client-library-otel/src/patch/cf-bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function proxyD1Binding(o: object, bindingName: string) {
if (typeof d1Value === "function" && isSendingQuery) {
return measure(
{
name: "D1 Call",
name: "D1 Query",
attributes: getCfBindingAttributes(
"D1Database",
bindingName,
Expand Down
82 changes: 33 additions & 49 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"vite": "^5.2.0",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0",
"wrangler": "^3.57.0"
"vitest": "^1.6.0"
}
}
3 changes: 3 additions & 0 deletions studio/src/assets/CloudflareAILogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions studio/src/assets/CloudflareD1Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions studio/src/assets/CloudflareKVLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions studio/src/assets/CloudflareR2Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ export const KeyValueRow = ({
entry,
sensitiveKeys = [],
keyCellClassName,
valueCellClassName,
}: {
entry: [string | ReactNode, string | ReactNode];
sensitiveKeys?: string[] | ((key: string) => boolean);
keyCellClassName?: string;
valueCellClassName?: string;
}) => {
const [key, value] = entry;

Expand All @@ -40,7 +42,9 @@ export const KeyValueRow = ({
>
{key}
</TableCell>
<TableCell className="font-mono align-middle h-full">
<TableCell
className={cn("font-mono align-middle h-full", valueCellClassName)}
>
<div className="flex items-center w-full">
{isSensitive && (
<Tooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function KeyValueTable({
className,
sensitiveKeys = [],
keyCellClassName,
valueCellClassName,
}: {
keyValue:
| Record<string, string>
Expand All @@ -25,6 +26,7 @@ export function KeyValueTable({
className?: string;
sensitiveKeys?: string[] | ((key: string) => boolean);
keyCellClassName?: string;
valueCellClassName?: string;
}) {
const isEmpty = Array.isArray(keyValue)
? keyValue.length === 0
Expand All @@ -41,6 +43,7 @@ export function KeyValueTable({
entry={entry}
sensitiveKeys={sensitiveKeys}
keyCellClassName={keyCellClassName}
valueCellClassName={valueCellClassName}
/>
))
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ const Content = ({ item }: { item: Waterfall[0] }) => {
);
}

return <GenericSpan span={item.span} key={item.span.span_id} />;
return (
<GenericSpan
span={item.span}
key={item.span.span_id}
vendorInfo={item.vendorInfo}
/>
);
};

function getId(item: Waterfall[0]) {
Expand Down
Loading

0 comments on commit 616b436

Please sign in to comment.