Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix-req-res-panel
Browse files Browse the repository at this point in the history
  • Loading branch information
flenter committed Jan 17, 2025
2 parents ccb2145 + 7aaa7cd commit 6813d14
Show file tree
Hide file tree
Showing 108 changed files with 6,920 additions and 766 deletions.
1,392 changes: 818 additions & 574 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}
},
{
"include": ["studio"],
"include": ["studio", "lilo/lilo-frontend"],
"linter": {
"enabled": true,
"rules": {
Expand Down Expand Up @@ -72,7 +72,8 @@
"packages/client-library-otel",
"api",
"honc-code-gen",
"fp-services"
"fp-services",
"lilo/lilo-worker"
],
"linter": {
"enabled": true,
Expand Down Expand Up @@ -102,10 +103,12 @@
"honc-code-gen/storage/**/*",
// Client library and website related
"dist",
"lilo/lilo-frontend/dist",
"lilo/lilo-worker/public",
"www/",
".astro",
// ignore all tsconfig.json files
"tsconfig.json",
"tsconfig*.json",
// ignore any test data files
"test-data/*.js",
// fpx-workers build files
Expand Down
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ allow = [
"MIT",
"MPL-2.0",
"OpenSSL",
"Unicode-DFS-2016",
"Unicode-3.0",
]
confidence-threshold = 0.8
exceptions = []
Expand Down
2 changes: 1 addition & 1 deletion examples/python-fastapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def read_root():
return {"Hello": "World"}


@measure(name="loop")
@measure()
def loop(n: int = 10) -> None:
for i in range(n):
sleep(0.1)
Expand Down
2 changes: 1 addition & 1 deletion examples/python-fastapi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"fastapi[standard]>=0.115.6",
"fpxpy>=0.2.0",
"fpxpy>=0.3.1",
]

[dependency-groups]
Expand Down
123 changes: 64 additions & 59 deletions examples/python-fastapi/uv.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fp-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@cloudflare/workers-types": "^4.20241112.0",
"drizzle-kit": "^0.24.2",
"drizzle-kit": "^0.30.0",
"wrangler": "^3.91.0"
}
}
14 changes: 7 additions & 7 deletions fpx-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ fpx-macros = { version = "0.1.0", path = "../fpx-macros" }
futures-util = { version = "0.3", default-features = false }
hex = { version = "0.4", default-features = false, features = ["alloc"] }
http = { version = "1.1", default-features = false }
libsql = { version = "0.5", default-features = false, optional = true }
opentelemetry = { version = "0.24", default-features = false }
opentelemetry_sdk = { version = "0.24", default-features = false }
opentelemetry-proto = { version = "0.7", default-features = false, features = [
libsql = { version = "0.6", default-features = false, optional = true }
opentelemetry = { version = "0.27", default-features = false }
opentelemetry_sdk = { version = "0.27", default-features = false }
opentelemetry-proto = { version = "0.27", default-features = false, features = [
"trace",
"gen-tonic-messages",
"with-serde",
Expand All @@ -34,22 +34,22 @@ schemars = { workspace = true, default-features = false, features = ["derive"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = { version = "1.0", default-features = false }
strum = { version = "0.26", default-features = false, features = ["derive"] }
thiserror = { version = "1.0", default-features = false }
thiserror = { version = "2.0", default-features = false }
time = { version = "0.3", default-features = false, features = [
"serde-human-readable",
] }
tokio = { version = "1.40", default-features = false }
tower = { version = "0.4", default-features = false }
tower-http = { version = "0.5", default-features = false, features = [
"compression-br",
"compression-gzip",
"decompression-br",
"decompression-gzip",
] }
tower = { version = "0.4", default-features = false }
tracing = { version = "0.1", default-features = false, features = [
"attributes",
] }
tracing-opentelemetry = { version = "0.25", default-features = false }
tracing-opentelemetry = { version = "0.28", default-features = false }
url = { version = "2.5", default-features = false }
wasm-bindgen = { version = "0.2", default-features = false, optional = true }

Expand Down
4 changes: 2 additions & 2 deletions fpx-workers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ tracing-subscriber = { version = "0.3", default-features = false, features = [
"ansi",
] }
tracing-web = { version = "0.1", default-features = false }
worker = { version = "0.3", features = ["http", "axum", "d1"] }
worker-macros = { version = "0.3", features = ["http"] }
wasm-bindgen = { version = "0.2", default-features = false }
worker = { version = "0.5", features = ["http", "axum", "d1"] }
worker-macros = { version = "0.5", features = ["http"] }
33 changes: 20 additions & 13 deletions fpx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,33 @@ axum = { workspace = true, default-features = false, features = [
"tracing",
"ws",
] }
clap = { workspace = true, features = ["derive", "env"] }
bytes = { version = "1.6" }
futures-util = { version = "0.3" }
fpx-macros = { version = "0.1.0", path = "../fpx-macros" }
clap = { workspace = true, features = ["derive", "env"] }
fpx-lib = { version = "0.1.0", path = "../fpx-lib", features = ["libsql"] }
fpx-macros = { version = "0.1.0", path = "../fpx-macros" }
futures-util = { version = "0.3" }
hex = { version = "0.4" }
http = { version = "1.1" }
http-body-util = { version = "0.1" }
include_dir = { version = "0.7.3" }
libsql = { version = "0.5", default-features = false, features = ["core", "serde"] }
libsql = { version = "0.6", default-features = false, features = [
"core",
"serde",
] }
once_cell = { version = "1.19" }
opentelemetry = { version = "0.24" }
opentelemetry_sdk = { version = "0.24", features = ["rt-tokio"] }
opentelemetry-otlp = { version = "0.17", features = [
opentelemetry = { version = "0.27" }
opentelemetry_sdk = { version = "0.27", features = ["rt-tokio"] }
opentelemetry-otlp = { version = "0.27", features = [
"http-json",
"reqwest-client",
"reqwest-rustls-webpki-roots",
] }
opentelemetry-proto = { version = "0.7", features = [
opentelemetry-proto = { version = "0.27", features = [
"gen-tonic-messages",
"with-serde",
"with-schemars",
] }
prost = { version = "0.13" }
rand = { version = "0.8.5" }
reqwest = { version = "0.12", default-features = false, features = [
"charset",
Expand All @@ -52,9 +56,9 @@ reqwest = { version = "0.12", default-features = false, features = [
schemars = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
strum = { version = "0.26", features = ["derive"] }
serde_with = { version = "3.8.1" }
thiserror = { version = "1.0" }
strum = { version = "0.26", features = ["derive"] }
thiserror = { version = "2.0" }
time = { version = "0.3.17", features = ["serde-human-readable"] }
tokio = { version = "1.40", features = ["rt-multi-thread", "signal", "fs"] }
tokio-tungstenite = { version = "0.21", features = [
Expand All @@ -64,13 +68,16 @@ toml = { version = "0.8" }
tonic = { version = "0.12" }
tower = { version = "0.4" }
tracing = { version = "0.1" }
tracing-opentelemetry = { version = "0.25" }
tracing-opentelemetry = { version = "0.28" }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
url = { version = "2.5" }
prost = { version = "0.13" }

[target.'cfg(windows)'.dependencies]
libsql = { version = "0.5", default-features = false, features = ["core", "serde", "replication"] }
libsql = { version = "0.6", default-features = false, features = [
"core",
"serde",
"replication",
] }

[dev-dependencies]
test-log = { version = "0.2", default-features = false, features = ["trace"] }
25 changes: 10 additions & 15 deletions fpx/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use anyhow::{Context, Result};
use clap::Parser;
use opentelemetry::trace::TracerProvider;
use opentelemetry::KeyValue;
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_sdk::trace::Config;
use opentelemetry_otlp::{SpanExporter, WithExportConfig};
use opentelemetry_sdk::{runtime, Resource};
use std::env;
use std::path::PathBuf;
Expand Down Expand Up @@ -45,20 +44,16 @@ fn setup_tracing(args: &commands::Args) -> Result<()> {
let log_layer = tracing_subscriber::fmt::layer();

let trace_layer = if args.enable_tracing {
let exporter = SpanExporter::builder()
.with_tonic()
.with_endpoint(args.otlp_endpoint.to_string())
.build()?;

// This tracer is responsible for sending the actual traces.
let tracer_provider = opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(
opentelemetry_otlp::new_exporter()
.tonic()
.with_endpoint(args.otlp_endpoint.to_string()),
)
.with_trace_config(
Config::default()
.with_resource(Resource::new(vec![KeyValue::new("service.name", "fpx")])),
)
.install_batch(runtime::Tokio)
.context("unable to install tracer")?;
let tracer_provider = opentelemetry_sdk::trace::TracerProvider::builder()
.with_resource(Resource::new(vec![KeyValue::new("service.name", "fpx")]))
.with_batch_exporter(exporter, runtime::Tokio)
.build();

opentelemetry::global::set_tracer_provider(tracer_provider.clone());

Expand Down
2 changes: 1 addition & 1 deletion fpxpy/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "fpxpy"
version = "0.3.0"
version = "0.3.1"
authors = [
{ name = "Fiberplane", email = "[email protected]" },
{ name = "mellowagain", email = "[email protected]" },
Expand Down
3 changes: 2 additions & 1 deletion fpxpy/src/fpxpy/JSONSpanExporter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Implementation of the JSON Span Exporter"""

from dataclasses import dataclass
from .logger import logger
from typing import Any, List, Optional

import requests
Expand All @@ -11,6 +10,8 @@
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
from opentelemetry.trace import Link, SpanKind, Status

from .logger import logger


@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
Expand Down
7 changes: 2 additions & 5 deletions fpxpy/src/fpxpy/logger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from typing import List, Optional, Callable
from typing import Callable, Optional

from opentelemetry.trace import get_current_span

logger = logging.getLogger("fpxpy")
Expand All @@ -8,10 +9,6 @@
class LogSnooper(logging.Handler):
"""Snoop on log messages by storing them in a list"""

def __init__(self):
super().__init__()
self.messages: List[str] = []

def emit(self, record: logging.LogRecord) -> None:
span = get_current_span()

Expand Down
12 changes: 12 additions & 0 deletions fpxpy/src/fpxpy/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ def measure(
) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...


@overload
def measure(
*, # Force named parameters after name
span_kind: SpanKind = SpanKind.INTERNAL,
on_start: Optional[OnStartCallback[Any]] = None,
on_success: Optional[Callable[[Span, Any], None]] = None,
on_error: Optional[Callable[[Span, Exception], None]] = None,
check_result: Optional[Callable[[Any], None]] = None,
attributes: Optional[Attributes] = None,
) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...


@overload
def measure(
name: Optional[str],
Expand Down
7 changes: 3 additions & 4 deletions fpxpy/src/fpxpy/test_tracing.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import io

from time import sleep
from typing import List

import pytest
from time import sleep
from fastapi import FastAPI, HTTPException
from fastapi.testclient import TestClient
from opentelemetry.sdk.trace.export import SpanExporter
from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.sdk.trace.export import SpanExporter
from opentelemetry.trace import SpanKind

from .tracing import __internal_setup_span_instrumentation
from .measure import measure
from .tracing import __internal_setup_span_instrumentation


class SpanCollectorExporter(SpanExporter):
Expand Down
4 changes: 0 additions & 4 deletions fpxpy/src/fpxpy/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
from .measure import measure
from .utils import get_response_attributes, set_request_attributes

# logger = logging.getLogger()
# logging.basicConfig(level=logging.INFO)
# logger = logging.getLogger(__name__)


def get_or_set_tracer_provider(service_name: str) -> TracerProvider:
"""
Expand Down
2 changes: 1 addition & 1 deletion fpxpy/uv.lock

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

2 changes: 1 addition & 1 deletion honc-code-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@langchain/langgraph": "^0.2.28",
"ai": "^3.4.33",
"dotenv": "^16.4.7",
"drizzle-kit": "^0.24.2",
"drizzle-kit": "^0.30.0",
"drizzle-orm": "^0.33.0",
"drizzle-zod": "^0.5.1",
"hono": "^4.6.13",
Expand Down
27 changes: 27 additions & 0 deletions lilo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Lilo

This is a dashboard + external API for "Lilo" - a tool for generating API testing workflows from user stories.

There's more info in each of the `README.md` files in the `lilo-worker` and `lilo-frontend` directories.

For the record:

- `lilo-worker` is the backend, and it has both an internal API and an external API
- `lilo-frontend` is the dashboard that talks to the internal API, and links to the external API reference (powered by Scalar)

The frontend also imports `hono/client` to talk to the internal API. It also needs to import some types from `lilo-worker`, but it does so in kind of a janky way because I'm not great at configuring separate typescript projects to talk to each other.

## Setup

Run the backend:
```bash
cd lilo-worker
# follow setup instructions
pnpm dev
```

Run the frontend:
```bash
cd lilo-frontend
pnpm dev
```
24 changes: 24 additions & 0 deletions lilo/lilo-frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Loading

0 comments on commit 6813d14

Please sign in to comment.