Skip to content

Commit b94e8d8

Browse files
authored
Merge pull request #7 from softwaremill/feature/session-detail-analytics
Feature/session detail analytics
2 parents 2370886 + 977f2d4 commit b94e8d8

File tree

34 files changed

+2555
-1652
lines changed

34 files changed

+2555
-1652
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ docs/plans/
88
screenshots/
99
.idea/
1010
docs/superpowers/
11+
.superpowers/
1112
PROJECT_DESCRIPTION.md

Cargo.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CREATE TABLE model_pricing (
2+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
3+
model TEXT NOT NULL,
4+
input_per_mtok DOUBLE PRECISION NOT NULL,
5+
output_per_mtok DOUBLE PRECISION NOT NULL,
6+
cache_read_per_mtok DOUBLE PRECISION NOT NULL,
7+
cache_write_per_mtok DOUBLE PRECISION NOT NULL,
8+
effective_from TIMESTAMPTZ NOT NULL,
9+
effective_until TIMESTAMPTZ,
10+
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
11+
);
12+
13+
CREATE INDEX idx_model_pricing_lookup
14+
ON model_pricing(model, effective_from);
15+
16+
-- Seed with current Anthropic rates
17+
INSERT INTO model_pricing (model, input_per_mtok, output_per_mtok, cache_read_per_mtok, cache_write_per_mtok, effective_from)
18+
VALUES
19+
('opus', 15.00, 75.00, 1.50, 18.75, '2025-01-01T00:00:00Z'),
20+
('sonnet', 3.00, 15.00, 0.30, 3.75, '2025-01-01T00:00:00Z'),
21+
('haiku', 0.80, 4.00, 0.08, 1.00, '2025-01-01T00:00:00Z');

crates/tracevault-server/src/api/auth.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -237,19 +237,7 @@ pub async fn login(
237237
.await
238238
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
239239

240-
// Audit with nil org_id since login is org-agnostic now
241-
crate::audit::log(
242-
&state.pool,
243-
crate::audit::user_action(
244-
Uuid::nil(),
245-
user_id,
246-
"user.login",
247-
"user",
248-
Some(user_id),
249-
None,
250-
),
251-
)
252-
.await;
240+
// Login is org-agnostic — skip audit log (audit_log requires a valid org_id)
253241

254242
Ok(Json(LoginResponse {
255243
token: raw_token,

crates/tracevault-server/src/api/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ pub mod github;
99
pub mod orgs;
1010
pub mod policies;
1111
pub mod repos;
12+
pub mod session_detail;
1213
pub mod traces;

0 commit comments

Comments
 (0)