Commit Graph
77 Commits
Author SHA1 Message Date
moebiusbandandClaude Opus 4.8 0724b2dc60 Adopt cc-lib hierarchical JobData/Statistics structs
cc-lib changed JobData, ScopedJobStats and Job.Statistics from flat maps
to structs (a .Metrics map plus array-valued Groups) to represent
filesystem (and future interconnect) metric groups. Migrate all
construction, indexing and iteration to the new API across the archive
backends, metricstore query path, metric dispatcher, archiver, importer,
tagger, taskmanager, repository and API layers.

Semantics: DecodeJobStats now projects JobData.Groups into
ScopedJobStats.Groups, and the archiver derives per-filesystem node-scope
statistics into Job.Statistics.Groups. deepCopy, resampling and the
metric/scope filter are group-aware. The metricstore internal storage
(buffers, selector tree, checkpoint/parquet) is unchanged; all conversion
stays at the LoadData/archive-codec seam.

Note: requires the corresponding cc-lib release; bump the cc-lib
dependency version once tagged (a local go.mod replace was used during
development and is intentionally not committed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 19:14:12 +02:00
moebiusbandandClaude Opus 4.8 6d86690c76 Fix critical issues from follow-up security audit
A second-pass audit surfaced three severe issues missed by the previous
review, each a sibling code path of a bug class that was only partially
fixed before:

- auth: JWT session login (jwtSession.go) registered its authenticator
  even when CROSS_LOGIN_JWT_HS512_KEY was unset, leaving an empty HMAC
  key. golang-jwt verifies any HS256/HS512 signature against an empty
  key, allowing unauthenticated admin token forgery. Init() now refuses
  to register without a key, with a defense-in-depth empty-key guard in
  the keyfunc.

- repository: metric names from GraphQL ([String!]) were interpolated
  raw into json_extract(footprint, "$.<name>") SQL. SQLite parses
  double-quoted strings as literals, enabling SQL injection by any
  authenticated user. Validate metric names against ^[a-zA-Z0-9_]+$ in
  jobsMetricStatisticsHistogram and buildFloatJSONCondition.

- metricstore: cluster/host line-protocol tags flowed unvalidated into
  path.Join(RootDir, cluster, host) for checkpoint/WAL files, allowing
  arbitrary file write outside the checkpoint root via NATS
  (unauthenticated) or POST /api/write. Reject path-traversal sequences
  in DecodeLine before the tags become path components.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: b57246993ec1
2026-06-04 19:07:20 +02:00
Christoph Kluge 33beb3c806 fix: simplify stats query condition
- caused expensive subquery without need in frontend
2026-03-18 11:07:57 +01:00
moebiusband c449996559 Add context to log message
Entire-Checkpoint: 55d95cdef0d4
2026-03-18 09:43:41 +01:00
moebiusband f15f1452cc Inline jobstate literal in query
Entire-Checkpoint: 35f06df74b51
2026-03-13 15:16:07 +01:00
moebiusbandandClaude Opus 4.6 d586fe4b43 Optimize usage dashboard: partial indexes, request cache, parallel histograms
- Add migration 14: partial covering indexes WHERE job_state='running'
  for user/project/subcluster groupings (tiny B-tree vs full table)
- Inline literal state value in BuildWhereClause so SQLite matches
  partial indexes instead of parameterized placeholders
- Add per-request statsGroupCache (sync.Once per filter+groupBy key)
  so identical grouped stats queries execute only once per GQL operation
- Parallelize 4 histogram queries in AddHistograms using errgroup
- Consolidate frontend from 6 GQL aliases to 2, sort+slice top-10
  client-side via $derived

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 5b26a6e5ff10
2026-03-13 14:31:37 +01:00
moebiusband 96fc44a649 fix: Optimize project stat query 2026-03-13 06:06:38 +01:00
moebiusband 8e86e8720d Make stats query selective. Add stats index. Add paging to user list.
Entire-Checkpoint: d42431eee30d
2026-03-12 20:16:55 +01:00
moebiusband af78f06ced fix: Reduce complexity for groupBy stats queries
Entire-Checkpoint: fc899a70a751
2026-03-11 15:14:59 +01:00
moebiusband 00d2f97c4c fix: Large heap allocations in sqlite driver. Sanitize sqlite config and make it configurablex. Allow to cancel queries. 2026-03-11 11:14:37 +01:00
moebiusband 1cf99206a9 Merge branch 'hotfix' of github.com:ClusterCockpit/cc-backend into hotfix 2026-03-11 05:06:26 +01:00
moebiusband 5d3d77620e fix: Add defer.close for all queries 2026-03-11 05:04:20 +01:00
Christoph Kluge 5655639320 add subCluster jobFilter for statusDetail queries 2026-02-06 11:10:08 +01:00
Christoph Kluge a7a95bb866 add shortjobs and resource sums to project and user lists 2026-02-04 13:01:30 +01:00
Christoph Kluge e8c81ba7d4 various small dashboard fixes
- piechart color, idle count cap, metricHistoMaximum increased
2026-01-29 17:46:01 +01:00
moebiusband e1efc68476 Update dependencies. Rebuild graphql and swagger 2026-01-15 08:32:06 +01:00
moebiusband 8f0bb907ff Improve documentation and add more tests 2026-01-15 06:41:23 +01:00
moebiusband 11ec2267da Major refactor of metric data handling
- make the  internal memory store required and default
- Rename memorystore to metricstore
- Rename metricDataDispatcher to metricdispatch
- Remove metricdata package
- Introduce metricsync package for upstream metric data pull
2025-12-25 08:42:54 +01:00
moebiusband 8576ae458d Switch to cc-lib v2 2025-12-24 09:24:18 +01:00
moebiusband 1cd4a57bd3 Remove support for mysql/mariadb 2025-12-20 11:13:41 +01:00
moebiusband 8f4ef1e274 Refactor repository
Fix issues
Improve transaction API
Make hardcoded constants configurable
Make error messages consistent and always add context info
2025-11-20 06:58:45 +01:00
moebiusband 440cd59e50 Revert hpc_cluster to cluster. Refactor. 2025-10-16 14:32:06 +02:00
Christoph Kluge 6a43dfb0d7 Fix missing model.Aggregate entry, fix status queries and refresh 2025-10-14 18:43:00 +02:00
Jan EitzingerandGitHub df0e8eb228 Merge branch 'dev' into metricstore 2025-09-10 09:14:50 +02:00
Aditya Ujeniya af43901ca3 Trial and Test MetricStore components 2025-09-08 22:54:13 +02:00
Christoph Kluge 98b9f8e62d Add more information to status dash 2025-08-04 14:50:53 +02:00
moebiusband 639e1b9c6d Port to cc-lib. Extend legal header. 2025-06-30 12:06:35 +02:00
moebiusband 0373010497 Refactor and fix tagger test 2025-06-06 16:41:48 +02:00
moebiusband 3efee22536 Remove jobMeta and use job struct everywhere 2025-05-28 15:59:21 +02:00
Christoph Kluge 6ca14c55f2 fix: fix error in jobsMetricStatisticsHistogram calculation
- also reduces overhead, simplifies query
2025-04-25 18:09:21 +02:00
Christoph Kluge 64f60905b4 Drop change on zoom for selector with options
- Up to 7 days worth of runtime
- No zoomState issue and cached results
2025-01-24 14:06:43 +01:00
Christoph Kluge 9e6072fed2 Add 25th hour for runtime bracket 24-25h
- zoomstate does not work
- maxbins too hardcoded for runtimes > 25 hours
2025-01-24 10:39:33 +01:00
Christoph Kluge a3e5c424fd add zoom in metric histograms for running and completed states
- keeping last zoomstate doe snot work
2025-01-23 17:48:45 +01:00
Christoph Kluge 6683a350aa initial duration histogram zoom in frontend
- metric zoom todo
- keeping last zoomState does not work
2025-01-23 12:23:29 +01:00
Christoph Kluge 05bfa9b546 Prepare adaptive binCounts in backend 2025-01-22 12:07:12 +01:00
Christoph Kluge 817076bdbf initial prototyping 2025-01-16 12:25:49 +01:00
moebiusband 81b8d578f2 feat: Add buffered channel with worker thread for job start API
Fixes #293
Refactoring on the way
2024-11-25 16:44:50 +01:00
moebiusband ddeac6b9d9 Merge branch 'dev' of github.com:ClusterCockpit/cc-backend into dev 2024-11-21 15:54:58 +01:00
Christoph Kluge 311c088d3d removes debug logging 2024-11-21 15:47:09 +01:00
moebiusband a2584d6083 Merge branch 'dev' of github.com:ClusterCockpit/cc-backend into dev 2024-11-21 15:03:55 +01:00
moebiusband 35bd7739c6 fix: Replace reserved keywords in database schemas
Port migration to mariadb
2024-11-21 15:02:30 +01:00
Christoph Kluge fc1c54a141 fix: use left join to keep unmatched stats query result rows 2024-11-21 14:39:03 +01:00
Christoph Kluge 0b7cdde4a0 Merge branch 'dev' into sample_resolution_select
- Moved resample changes to metricDataDispatcher
- Added res argument to archiver, updateFootprintService
2024-09-05 17:26:43 +02:00
Christoph Kluge 5eb6f7d307 fix: user name join not required for normal jobStats 2024-09-02 18:45:33 +02:00
Christoph Kluge 8ded131666 Change user list name lookup to join 2024-09-02 17:54:25 +02:00
moebiusband 5b03cf826b feat: Add total energy and energy footprint 2024-08-29 07:26:49 +02:00
moebiusband e7231b0e13 Finish refactoring
Add new packages:
- metricDataDispatcher
- archiver
2024-08-28 10:03:04 +02:00
Christoph Kluge 6a1cb51c2f Refactor svelte frontend
- Adapt to new metricConfig logic
- Footprint-Metrics generalized for bar card
- Footprint-Metrics in stats filter and sorting
- Frontend always uses GQL, except adminOptions
- Job View will load scopes for all metrics on request
2024-07-22 15:41:33 +02:00
moebiusband e348ec74fd Fix bugs in stats.go 2024-07-12 14:08:48 +02:00
moebiusband 0458675608 Convert histogram query to json keys 2024-07-12 13:42:12 +02:00