Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9d267e6
docs(spec): OpenTelemetry golden-signals middleware design
knutties May 10, 2026
ee4d70b
docs(plan): OpenTelemetry golden-signals middleware implementation plan
knutties May 10, 2026
1255c16
build: add opentelemetry deps to workspace
knutties May 10, 2026
b50e36d
build: enable tokio_unstable workspace-wide
knutties May 10, 2026
7db5239
build(service_utils): enable opentelemetry deps
knutties May 10, 2026
92b2f42
feat(observability): module skeleton
knutties May 10, 2026
b7483e7
feat(observability): config from env
knutties May 10, 2026
4b1cc8b
feat(observability): http method normalization
knutties May 10, 2026
33e67b8
feat(observability): MeterProvider with prometheus exporter
knutties May 11, 2026
3bea122
feat(observability): route template extraction helper
knutties May 11, 2026
ea2e596
feat(observability): build OTel attributes for HTTP metrics
knutties May 11, 2026
c05be67
feat(observability): RAII guard for active_requests gauge
knutties May 11, 2026
ebc24d3
feat(observability): MetricsMiddleware records HTTP signals
knutties May 11, 2026
73c35ee
feat(observability): /healthz /livez /readyz handlers
knutties May 11, 2026
e7bfadd
feat(observability): /metrics server on dedicated port
knutties May 11, 2026
f9518f0
feat(observability): db + redis pool saturation gauges
knutties May 11, 2026
ce50783
feat(observability): tokio runtime saturation gauges
knutties May 11, 2026
43cafd8
feat: exclude /healthz /livez /readyz from auth checks
knutties May 11, 2026
02113f1
feat: wire observability into main binary
knutties May 11, 2026
267a33c
test(observability): end-to-end integration
knutties May 11, 2026
dae4266
test(observability): cardinality regression budget
knutties May 11, 2026
77dc30b
docs: note metrics endpoints and tokio_unstable build flag
knutties May 11, 2026
c62b439
fix(observability): graceful degradation on init failure (review fix 1)
knutties May 11, 2026
60c0a30
fix(observability): __static__ sentinel, extract_route_from_response,…
knutties May 11, 2026
e71a4d6
fix(observability): merge OTEL_RESOURCE_ATTRIBUTES; document OTLP env…
knutties May 11, 2026
1bca586
docs(README): drop spec link from observability section
knutties May 11, 2026
faa7937
fix(observability): graceful OTLP degradation + gRPC protocol warning…
knutties May 11, 2026
e98e978
chore(deps): drop opentelemetry-semantic-conventions dep (item 2)
knutties May 11, 2026
6e93548
chore(observability): remove dead code stubs (items 4, 5, 6)
knutties May 11, 2026
1011088
fix(observability): expose redis.client.connections.connected gauge (…
knutties May 11, 2026
044c174
refactor(observability): inject env source into ObservabilityConfig::…
knutties May 11, 2026
3728b0b
fix(observability): mount health endpoints without empty-prefix scope
knutties May 12, 2026
9a58318
chore(deps): regenerate Cargo.lock after dropping opentelemetry-seman…
knutties May 14, 2026
e077a72
style: apply rustfmt to PR-touched files
knutties May 14, 2026
e9e4fea
fix(observability): clippy lints flagged by CI
knutties May 14, 2026
8ed83db
fix(observability): clippy async_yields_async in integration tests
knutties May 14, 2026
39b18c8
fix(observability): IPv6-safe metrics bind, percent-decoded OTEL reso…
knutties May 14, 2026
0f1c796
chore(observability): doc fixes and small style/semconv tweaks
knutties May 14, 2026
7c7bf13
fix(observability): detach metrics server lifetime from main API server
knutties May 14, 2026
8fb3096
refactor(observability): DRY env key names with FromStr-based parse h…
knutties May 15, 2026
940e755
refactor(observability): drop get_str — collapse into parse_or_default
knutties May 16, 2026
cb5f8ce
refactor(observability): introduce crate-private EnvSource marker trait
knutties May 16, 2026
80ee392
refactor(observability): collapse normalize_method to a single macro
knutties May 17, 2026
fabdf19
refactor(observability): read Handle::metrics() directly; drop tokio-…
knutties May 17, 2026
dc75c9b
chore(observability): remove /healthz /livez /readyz endpoints
knutties May 17, 2026
3269f9a
docs(observability): note post-implementation deviations from plan/spec
knutties May 17, 2026
7d6f51b
test(observability): move tokio-runtime check to integration test
knutties May 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ test_logs
# pre-commit config
.pre-commit-config.yaml
.cargo
!.cargo/config.toml

#gradle files
.gradle
Expand Down
52 changes: 48 additions & 4 deletions Cargo.lock

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

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,19 @@ diesel = { version = "2.2.4", package = "juspay_diesel", features = [
] }
fred = { version = "9.2.1" }
futures-util = "0.3.28"
humantime = "2.1"
inventory = "0.3"
itertools = { version = "0.10.5" }
jsonlogic = { version = "0.5.5", package = "juspay_jsonlogic" }
jsonschema = "~0.17"
leptos = { version = "0.6.11" }
log = { version = "0.4.20", features = ["kv_unstable_serde"] }
once_cell = { version = "1.18.0" }
opentelemetry = { version = "0.27", default-features = false, features = ["metrics"] }
opentelemetry_sdk = { version = "0.27", default-features = false, features = ["metrics", "rt-tokio"] }
opentelemetry-prometheus = { version = "0.27", default-features = false }
opentelemetry-otlp = { version = "0.27", default-features = false, features = ["metrics", "http-proto", "reqwest-client"] }
prometheus = { version = "0.13", default-features = false }
regex = "1.9.1"
reqwest = { version = "0.11.18", features = ["json"] }
rs-snowflake = "0.6.0"
Expand All @@ -79,6 +85,7 @@ serde_json = { version = "1.0.140" }
secrecy = "0.10"
strum = "0.25"
strum_macros = "0.25"
thiserror = "1"
tokio = { version = "1.29.1", features = ["full"] }
toml = { version = "0.8.8", features = ["preserve_order"] }
tracing = "0.1.44"
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ Want a broader systems view? Open the [DeepWiki architecture guide](https://deep
- [Context7 LLM-friendly docs](https://context7.com/juspay/superposition)
- [DeepWiki repository guide](https://deepwiki.com/juspay/superposition)

## Metrics & observability

The HTTP API exposes Prometheus metrics on `SUPERPOSITION_METRICS_PORT` (default `9091`):

```bash
curl http://localhost:9091/metrics
```

## Contributing

We welcome contributions across the platform, clients, docs, and examples.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ use crate::api::{
experiments::{
cac_api::validate_context,
helpers::{
validate_change_reason_with_function, hash,
validate_and_add_experiment_group_id,
hash, validate_and_add_experiment_group_id,
validate_and_remove_experiment_group_id,
validate_change_reason_with_function,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ use crate::api::{
},
experiments::{
helpers::{
validate_change_reason_with_function,
get_control_overrides_from_exp_id, put_experiments_in_redis,
validate_control_overrides, validate_delete_experiment_variants,
validate_change_reason_with_function, validate_control_overrides,
validate_delete_experiment_variants,
},
types::StartedByChangeSet,
},
Expand Down Expand Up @@ -170,7 +170,7 @@ async fn create_handler(
&workspace_context,
&change_reason,
&state,
&user
&user,
)
.await?;

Expand Down Expand Up @@ -462,7 +462,7 @@ async fn conclude_handler(
&workspace_context,
&req.change_reason,
&state,
&user
&user,
)
.await?;

Expand Down Expand Up @@ -745,7 +745,7 @@ async fn discard_handler(
&workspace_context,
&req.change_reason,
&state,
&user
&user,
)
.await?;

Expand Down Expand Up @@ -1359,7 +1359,7 @@ async fn ramp_handler(
&workspace_context,
&change_reason,
&state,
&user
&user,
)
.await?;

Expand Down Expand Up @@ -1568,7 +1568,7 @@ async fn update_handler(
&workspace_context,
&change_reason,
&state,
&user
&user,
)
.await?;

Expand Down Expand Up @@ -1907,7 +1907,7 @@ async fn pause_handler(
&workspace_context,
&req.change_reason,
&state,
&user
&user,
)
.await?;

Expand Down Expand Up @@ -2004,7 +2004,7 @@ async fn resume_handler(
&workspace_context,
&req.change_reason,
&state,
&user
&user,
)
.await?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,8 @@ pub async fn validate_change_reason_with_function(
change_reason: change_reason.clone(),
};

let headers_map = construct_header_map(workspace_context, vec![("x-user", user_str)])?;
let headers_map =
construct_header_map(workspace_context, vec![("x-user", user_str)])?;

let response = http_client
.post(&url)
Expand Down
7 changes: 7 additions & 0 deletions crates/service_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ diesel = { workspace = true }
diesel-adapter = { version = "1.2.0" }
fred = { workspace = true, features = ["metrics"] }
futures-util = { workspace = true }
humantime = { workspace = true }
inventory = { workspace = true }
log = { workspace = true }
once_cell = { workspace = true }
openidconnect = "3.5.0"
opentelemetry = { workspace = true }
opentelemetry_sdk = { workspace = true }
opentelemetry-otlp = { workspace = true }
opentelemetry-prometheus = { workspace = true }
prometheus = { workspace = true }
rand = "0.8"
tokio = { workspace = true }
tracing = { workspace = true }
Expand All @@ -42,6 +48,7 @@ superposition_types = { workspace = true, features = [
"api",
"diesel_derives",
] }
thiserror = { workspace = true }
url = { workspace = true }
urlencoding = "~2.1.2"
uuid = {workspace = true}
Expand Down
5 changes: 5 additions & 0 deletions crates/service_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#![deny(unused_crate_dependencies)]
// opentelemetry_otlp is only used in cfg(not(test)) code; suppress the lint
// when compiling tests.
#[cfg(test)]
use opentelemetry_otlp as _;
pub mod aws;
pub mod db;
pub mod encryption;
pub mod extensions;
pub mod helpers;
pub mod middlewares;
pub mod observability;
pub mod redis;
pub mod registry;
pub mod service;
Expand Down
Loading
Loading