feat(env): add SURFSENSE_ENV variable for deployment environment and update observability resource attributes

This commit is contained in:
Anish Sarkar 2026-05-23 02:13:24 +05:30
parent df698e0216
commit 4c8d47617d
4 changed files with 26 additions and 9 deletions

View file

@ -114,8 +114,20 @@ class TestBootstrapConfig:
attrs = dict(resource.attributes)
assert attrs["service.name"] == "custom-backend"
assert attrs["deployment.environment.name"] == "test"
assert attrs["deployment.environment"] == "test"
assert attrs["service.instance.id"]
def test_deployment_environment_uses_surfsense_env_only(
self, monkeypatch: pytest.MonkeyPatch
) -> None:
monkeypatch.delenv("SURFSENSE_ENV", raising=False)
assert bootstrap._deployment_environment() == "dev"
monkeypatch.setenv("SURFSENSE_ENV", "production")
assert bootstrap._deployment_environment() == "production"
def test_shutdown_is_safe_without_providers(self) -> None:
bootstrap.shutdown_otel()