nthlayer-workers 4.0.2__tar.gz → 4.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/PKG-INFO +2 -2
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/pyproject.toml +5 -2
- nthlayer_workers-4.1.0/src/nthlayer_workers/__init__.py +15 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/cli.py +4 -1
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/cli.py +3 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/cli.py +3 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/cli.py +4 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/store/sqlite.py +95 -49
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/telemetry.py +34 -32
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/cli.py +3 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/cli.py +3 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers.egg-info/PKG-INFO +2 -2
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers.egg-info/SOURCES.txt +1 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers.egg-info/requires.txt +1 -1
- nthlayer_workers-4.1.0/tests/test_cli_telemetry.py +65 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/tests/test_dependency_declarations.py +7 -0
- nthlayer_workers-4.0.2/src/nthlayer_workers/__init__.py +0 -9
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/LICENSE +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/README.md +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/setup.cfg +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/cli_output.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/config.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/correlation/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/correlation/changes.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/correlation/dedup.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/correlation/engine.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/correlation/temporal.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/correlation/topology.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/ingestion/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/ingestion/protocol.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/ingestion/severity.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/ingestion/webhook.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/notifications.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/prometheus.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/reasoning.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/session.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/snapshot/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/snapshot/generator.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/snapshot/model.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/snapshot/token.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/state.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/store/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/store/protocol.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/store/sqlite.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/summary.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/traces/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/traces/protocol.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/traces/tempo.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/traces/topology.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/types.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/verdict_chain.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/worker.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/__main__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/_apply.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/_gh.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/_interactive.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/_interactive_app.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/_preview.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/_trigger.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/_yaml.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/recommendations.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/retrospective.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/trends.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/learn/worker.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/llm_provider.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/__main__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/_parsing.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/adapters/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/adapters/_util.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/adapters/devin.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/adapters/gastown.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/adapters/prometheus.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/adapters/protocol.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/adapters/webhook.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/calibration/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/calibration/loop.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/calibration/slos.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/calibration/verdict_calibration.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/config.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/detection/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/detection/detector.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/detection/protocol.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/governance/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/governance/engine.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/manifest.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/notifications.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/pipeline/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/pipeline/evaluator.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/pipeline/router.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/store/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/store/protocol.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/thresholds/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/thresholds/phase.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/thresholds/sampler.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/thresholds/state.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/tiering/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/tiering/classifier.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/tiering/promotion.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/trends/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/trends/tracker.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/types.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/worker.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/__main__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/api/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/assessment.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/config.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/db/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/decision_records.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/discovery.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/providers/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/providers/backstage.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/providers/base.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/providers/consul.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/providers/etcd.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/providers/kubernetes.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/providers/prometheus.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/dependencies/providers/zookeeper.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/deployments/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/discovery/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/discovery/classifier.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/discovery/client.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/discovery/models.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/drift/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/drift/analyzer.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/drift/models.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/drift/patterns.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/explanation.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/gate/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/gate/conditions.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/gate/correlator.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/gate/evaluator.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/gate/policies.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/gate_adapter.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/incident.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/portfolio/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/portfolio/aggregator.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/portfolio/scorer.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/slo/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/slo/collector.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/slo/spec_loader.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/sqlite_store.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/store.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/verification/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/verification/exporter_guidance.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/verification/extractor.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/verification/models.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/verification/verifier.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/observe/worker.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/__main__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/agents/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/agents/base.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/agents/communication.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/agents/investigation.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/agents/remediation.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/agents/response_models.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/agents/triage.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/config.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/context_store.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/coordinator.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/metrics.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/notification_backends/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/notification_backends/ntfy_backend.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/notification_backends/protocol.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/notification_backends/slack_backend.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/notification_backends/stdout_backend.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/notifications.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/oncall/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/oncall/escalation.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/oncall/runner.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/oncall/schedule.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/safe_actions/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/safe_actions/actions.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/safe_actions/registry.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/safe_actions/webhook.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/server.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/sre/__init__.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/sre/brief.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/sre/delegation.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/sre/post_incident.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/sre/shift_report.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/sre/suppression.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/types.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/verdict_submission.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/worker.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/respond/worker_helpers.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/runner.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers.egg-info/dependency_links.txt +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers.egg-info/entry_points.txt +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers.egg-info/top_level.txt +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/tests/test_cli_gate.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/tests/test_llm_provider.py +0 -0
- {nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/tests/test_runner.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nthlayer-workers
|
|
3
|
-
Version: 4.0
|
|
3
|
+
Version: 4.1.0
|
|
4
4
|
Summary: NthLayer workers — Tier 2 background computation (observe, measure, correlate, respond, learn)
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Requires-Python: >=3.11
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
9
|
-
Requires-Dist: nthlayer-common<6.0.0,>=5.
|
|
9
|
+
Requires-Dist: nthlayer-common[otel]<6.0.0,>=5.11.0
|
|
10
10
|
Requires-Dist: httpx>=0.27
|
|
11
11
|
Requires-Dist: pyyaml>=6.0
|
|
12
12
|
Requires-Dist: structlog>=24.1.0
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nthlayer-workers"
|
|
7
|
-
version = "4.0
|
|
7
|
+
version = "4.1.0"
|
|
8
8
|
description = "NthLayer workers — Tier 2 background computation (observe, measure, correlate, respond, learn)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "Apache-2.0"}
|
|
@@ -56,7 +56,10 @@ dependencies = [
|
|
|
56
56
|
# nthlayer-common's evaluate_threshold (CORE §5.5.6) and read from core 3.0's
|
|
57
57
|
# /manifests via threshold_from_v2_entry; error magnitudes are no longer
|
|
58
58
|
# SLOs (decision 3c, common 4.0/5.0). See nthlayer-common/docs/upgrading-5.0.md.
|
|
59
|
-
|
|
59
|
+
# [otel] (opensrm-quqo): the OTel SDK and OTLP log exporter, so the events
|
|
60
|
+
# workers emits are exported once init_telemetry finds an endpoint. Without
|
|
61
|
+
# them every event is dropped, which is how they all went missing.
|
|
62
|
+
"nthlayer-common[otel]>=5.11.0,<6.0.0",
|
|
60
63
|
"httpx>=0.27",
|
|
61
64
|
"pyyaml>=6.0",
|
|
62
65
|
"structlog>=24.1.0",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""NthLayer workers — Tier 2 background computation modules.
|
|
2
|
+
|
|
3
|
+
Internal modules: observe, measure, correlate, respond, learn.
|
|
4
|
+
Communicates with nthlayer-core exclusively via HTTP API.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from importlib.metadata import version
|
|
8
|
+
|
|
9
|
+
__version__ = version("nthlayer-workers")
|
|
10
|
+
|
|
11
|
+
# The OTel service.name every CLI entry point passes to nthlayer-common's
|
|
12
|
+
# init_telemetry, which each calls after parsing its arguments and before
|
|
13
|
+
# running a command, so the command's events export (opensrm-quqo). Without
|
|
14
|
+
# an OTLP endpoint that call is a no-op.
|
|
15
|
+
TELEMETRY_SERVICE_NAME = "nthlayer-workers"
|
|
@@ -4,7 +4,9 @@ import argparse
|
|
|
4
4
|
import asyncio
|
|
5
5
|
import sys
|
|
6
6
|
|
|
7
|
-
from
|
|
7
|
+
from nthlayer_common.telemetry import init_telemetry
|
|
8
|
+
|
|
9
|
+
from nthlayer_workers import TELEMETRY_SERVICE_NAME, __version__
|
|
8
10
|
from nthlayer_workers.runner import ModuleRunner
|
|
9
11
|
|
|
10
12
|
|
|
@@ -58,6 +60,7 @@ def main():
|
|
|
58
60
|
help="Core API URL (default: http://localhost:8000)")
|
|
59
61
|
|
|
60
62
|
args = parser.parse_args()
|
|
63
|
+
init_telemetry(TELEMETRY_SERVICE_NAME)
|
|
61
64
|
|
|
62
65
|
if args.command == "serve":
|
|
63
66
|
from nthlayer_common.api_client import CoreAPIClient
|
|
@@ -14,7 +14,9 @@ from typing import Any
|
|
|
14
14
|
|
|
15
15
|
import structlog
|
|
16
16
|
import yaml
|
|
17
|
+
from nthlayer_common.telemetry import init_telemetry
|
|
17
18
|
|
|
19
|
+
from nthlayer_workers import TELEMETRY_SERVICE_NAME
|
|
18
20
|
from nthlayer_workers.correlate.config import SitRepConfig, load_config
|
|
19
21
|
from nthlayer_workers.correlate.correlation.changes import find_change_candidates
|
|
20
22
|
from nthlayer_workers.correlate.correlation.dedup import deduplicate
|
|
@@ -794,6 +796,7 @@ def main() -> None:
|
|
|
794
796
|
"""CLI entry point."""
|
|
795
797
|
parser = _build_parser()
|
|
796
798
|
args = parser.parse_args()
|
|
799
|
+
init_telemetry(TELEMETRY_SERVICE_NAME)
|
|
797
800
|
|
|
798
801
|
if args.command is None:
|
|
799
802
|
parser.print_help()
|
|
@@ -11,10 +11,12 @@ from datetime import UTC, datetime, timedelta
|
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from typing import Any
|
|
13
13
|
|
|
14
|
+
from nthlayer_common.telemetry import init_telemetry
|
|
14
15
|
from nthlayer_common.verdicts.serialise import to_dict
|
|
15
16
|
from nthlayer_common.verdicts.sqlite_store import SQLiteVerdictStore
|
|
16
17
|
from nthlayer_common.verdicts.store import AccuracyFilter, VerdictFilter
|
|
17
18
|
|
|
19
|
+
from nthlayer_workers import TELEMETRY_SERVICE_NAME
|
|
18
20
|
from nthlayer_workers.learn._apply import apply_recommendations, format_summary
|
|
19
21
|
from nthlayer_workers.learn._gh import (
|
|
20
22
|
PreflightError,
|
|
@@ -532,6 +534,7 @@ def main(argv: list[str] | None = None) -> None:
|
|
|
532
534
|
_add_recommendations_subcommand(sub)
|
|
533
535
|
|
|
534
536
|
args = parser.parse_args(argv)
|
|
537
|
+
init_telemetry(TELEMETRY_SERVICE_NAME)
|
|
535
538
|
|
|
536
539
|
if args.command == "accuracy":
|
|
537
540
|
_cmd_accuracy(args)
|
|
@@ -13,6 +13,9 @@ from datetime import UTC
|
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
from typing import TYPE_CHECKING
|
|
15
15
|
|
|
16
|
+
from nthlayer_common.telemetry import init_telemetry
|
|
17
|
+
|
|
18
|
+
from nthlayer_workers import TELEMETRY_SERVICE_NAME
|
|
16
19
|
from nthlayer_workers.measure.config import MeasureConfig, load_config
|
|
17
20
|
|
|
18
21
|
if TYPE_CHECKING:
|
|
@@ -539,6 +542,7 @@ def main() -> None:
|
|
|
539
542
|
)
|
|
540
543
|
|
|
541
544
|
args = parser.parse_args()
|
|
545
|
+
init_telemetry(TELEMETRY_SERVICE_NAME)
|
|
542
546
|
|
|
543
547
|
handlers = {
|
|
544
548
|
"evaluate": cmd_evaluate,
|
{nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/measure/store/sqlite.py
RENAMED
|
@@ -6,7 +6,9 @@ import asyncio
|
|
|
6
6
|
import sqlite3
|
|
7
7
|
import threading
|
|
8
8
|
import uuid
|
|
9
|
-
from
|
|
9
|
+
from collections.abc import Iterator
|
|
10
|
+
from contextlib import contextmanager
|
|
11
|
+
from datetime import UTC, datetime
|
|
10
12
|
from pathlib import Path
|
|
11
13
|
|
|
12
14
|
from nthlayer_common.verdicts import VerdictStore as VerdictStoreBase
|
|
@@ -17,6 +19,16 @@ from nthlayer_workers.measure.types import QualityScore
|
|
|
17
19
|
_SCHEMA_PATH = Path(__file__).parent / "schema.sql"
|
|
18
20
|
|
|
19
21
|
|
|
22
|
+
def _store_now() -> tuple[datetime, str]:
|
|
23
|
+
"""Now, truncated to milliseconds, and its text in the format schema.sql's
|
|
24
|
+
column defaults write (``strftime('%Y-%m-%dT%H:%M:%fZ')``). A row and its
|
|
25
|
+
telemetry event share this one time, so the event's Timestamp (ruling Q2)
|
|
26
|
+
is exactly the time the store records."""
|
|
27
|
+
now = datetime.now(UTC)
|
|
28
|
+
now = now.replace(microsecond=now.microsecond // 1000 * 1000)
|
|
29
|
+
return now, now.isoformat(timespec="milliseconds").replace("+00:00", "Z")
|
|
30
|
+
|
|
31
|
+
|
|
20
32
|
class SQLiteScoreStore:
|
|
21
33
|
"""Persists evaluation scores to a local SQLite database."""
|
|
22
34
|
|
|
@@ -50,7 +62,7 @@ class SQLiteScoreStore:
|
|
|
50
62
|
raise
|
|
51
63
|
|
|
52
64
|
def _save_score_sync(self, score: QualityScore) -> None:
|
|
53
|
-
with self._lock:
|
|
65
|
+
with self._lock, self._rolled_back_on_error():
|
|
54
66
|
self._conn.execute(
|
|
55
67
|
"INSERT INTO evaluations (eval_id, agent_name, task_id, evaluator_model, confidence, cost_usd, created_at) "
|
|
56
68
|
"VALUES (?, ?, ?, ?, ?, ?, ?)",
|
|
@@ -149,47 +161,71 @@ class SQLiteScoreStore:
|
|
|
149
161
|
) -> list[QualityScore]:
|
|
150
162
|
return await asyncio.to_thread(self._get_scores_sync, agent_name, since, limit)
|
|
151
163
|
|
|
164
|
+
@contextmanager
|
|
165
|
+
def _rolled_back_on_error(self) -> Iterator[None]:
|
|
166
|
+
"""Roll the open transaction back if the block raises. Without it a
|
|
167
|
+
failed write's earlier INSERTs stay pending on the shared connection,
|
|
168
|
+
and the next unrelated commit makes them durable with no telemetry
|
|
169
|
+
event for them. Call with self._lock held."""
|
|
170
|
+
try:
|
|
171
|
+
yield
|
|
172
|
+
except BaseException:
|
|
173
|
+
self._conn.rollback()
|
|
174
|
+
raise
|
|
175
|
+
|
|
152
176
|
def _save_override_sync(
|
|
153
177
|
self, eval_id: str, corrected_dimensions: dict[str, float], corrector: str
|
|
154
178
|
) -> None:
|
|
155
179
|
verdict_id = None
|
|
180
|
+
corrections: list[tuple[str, float, float]] = []
|
|
156
181
|
with self._lock:
|
|
157
|
-
#
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
f"Cannot override non-existent evaluation: {eval_id}"
|
|
164
|
-
)
|
|
165
|
-
|
|
166
|
-
for dim_name, corrected_score in corrected_dimensions.items():
|
|
167
|
-
row = self._conn.execute(
|
|
168
|
-
"SELECT score FROM dimension_scores "
|
|
169
|
-
"WHERE eval_id = ? AND dimension = ?",
|
|
170
|
-
(eval_id, dim_name),
|
|
182
|
+
# Taken under the lock, so stored times follow commit order.
|
|
183
|
+
corrected_at, corrected_at_text = _store_now()
|
|
184
|
+
with self._rolled_back_on_error():
|
|
185
|
+
# Verify eval_id exists
|
|
186
|
+
eval_row = self._conn.execute(
|
|
187
|
+
"SELECT task_id FROM evaluations WHERE eval_id = ?", (eval_id,)
|
|
171
188
|
).fetchone()
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
189
|
+
if not eval_row:
|
|
190
|
+
raise ValueError(
|
|
191
|
+
f"Cannot override non-existent evaluation: {eval_id}"
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
for dim_name, corrected_score in corrected_dimensions.items():
|
|
195
|
+
row = self._conn.execute(
|
|
196
|
+
"SELECT score FROM dimension_scores "
|
|
197
|
+
"WHERE eval_id = ? AND dimension = ?",
|
|
198
|
+
(eval_id, dim_name),
|
|
199
|
+
).fetchone()
|
|
200
|
+
original_score = row["score"] if row else 0.0
|
|
201
|
+
self._conn.execute(
|
|
202
|
+
"INSERT INTO overrides "
|
|
203
|
+
"(override_id, eval_id, dimension, original_score, "
|
|
204
|
+
"corrected_score, corrector, created_at) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
|
205
|
+
(
|
|
206
|
+
str(uuid.uuid4()),
|
|
207
|
+
eval_id,
|
|
208
|
+
dim_name,
|
|
209
|
+
original_score,
|
|
210
|
+
corrected_score,
|
|
211
|
+
corrector,
|
|
212
|
+
corrected_at_text,
|
|
213
|
+
),
|
|
214
|
+
)
|
|
215
|
+
corrections.append((dim_name, original_score, corrected_score))
|
|
216
|
+
self._conn.commit()
|
|
217
|
+
# Straight after the commit, still under the lock: a failed write
|
|
218
|
+
# emits no event, and the verdict lookup below cannot suppress one
|
|
219
|
+
# by raising. (_set_autonomy_sync emits after its lock instead;
|
|
220
|
+
# nothing follows its commit.)
|
|
221
|
+
for dim_name, original_score, corrected_score in corrections:
|
|
186
222
|
emit_correction_event(
|
|
187
223
|
eval_id, dim_name, original_score,
|
|
188
224
|
corrected_score, corrector,
|
|
225
|
+
corrected_at=corrected_at,
|
|
189
226
|
# The evaluated task is the decision the correction is about.
|
|
190
227
|
decision_id=eval_row["task_id"],
|
|
191
228
|
)
|
|
192
|
-
self._conn.commit()
|
|
193
229
|
|
|
194
230
|
# Look up verdict_id for resolution
|
|
195
231
|
if self._verdict_store is not None:
|
|
@@ -251,25 +287,35 @@ class SQLiteScoreStore:
|
|
|
251
287
|
|
|
252
288
|
def _set_autonomy_sync(self, agent_name: str, level: str, updated_by: str) -> None:
|
|
253
289
|
with self._lock:
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
290
|
+
# Taken under the lock, so stored times follow commit order.
|
|
291
|
+
changed_at, changed_at_text = _store_now()
|
|
292
|
+
with self._rolled_back_on_error():
|
|
293
|
+
current = self._conn.execute(
|
|
294
|
+
"SELECT level FROM agent_autonomy WHERE agent_name = ?",
|
|
295
|
+
(agent_name,),
|
|
296
|
+
).fetchone()
|
|
297
|
+
from_level = current["level"] if current else "full"
|
|
259
298
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
299
|
+
self._conn.execute(
|
|
300
|
+
"INSERT INTO agent_autonomy (agent_name, level, updated_by, updated_at) "
|
|
301
|
+
"VALUES (?, ?, ?, ?) "
|
|
302
|
+
"ON CONFLICT(agent_name) DO UPDATE SET level = excluded.level, "
|
|
303
|
+
"updated_by = excluded.updated_by, updated_at = excluded.updated_at",
|
|
304
|
+
(agent_name, level, updated_by, changed_at_text),
|
|
305
|
+
)
|
|
306
|
+
self._conn.execute(
|
|
307
|
+
"INSERT INTO governance_log "
|
|
308
|
+
"(agent_name, from_level, to_level, reason, triggered_by, created_at) "
|
|
309
|
+
"VALUES (?, ?, ?, ?, ?, ?)",
|
|
310
|
+
(
|
|
311
|
+
agent_name, from_level, level, f"Autonomy changed to {level}",
|
|
312
|
+
updated_by, changed_at_text,
|
|
313
|
+
),
|
|
314
|
+
)
|
|
315
|
+
self._conn.commit()
|
|
316
|
+
emit_state_transition_event(
|
|
317
|
+
agent_name, from_level, level, updated_by, changed_at=changed_at
|
|
318
|
+
)
|
|
273
319
|
|
|
274
320
|
async def set_autonomy(self, agent_name: str, level: str, updated_by: str) -> None:
|
|
275
321
|
await asyncio.to_thread(self._set_autonomy_sync, agent_name, level, updated_by)
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
"""OTel instrumentation — records facts as events, never evaluates quality (ZFC).
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Every event is an OTel log record emitted through nthlayer-common's
|
|
4
|
+
``emit_event`` (opensrm-quqo, A1 §4.0). They used to be span events on the
|
|
5
|
+
current span, but nothing in workers ever made a span recording, so all of
|
|
6
|
+
them were dropped. Each record's Timestamp is when the event happened,
|
|
7
|
+
taken from the score or passed by the caller; only the calibration report,
|
|
8
|
+
computed as it is emitted, uses the emit time. That is ruling Q2: A1 T1
|
|
9
|
+
itself names only the decision and outcome events.
|
|
10
|
+
|
|
11
|
+
Emitting is a no-op until the process calls ``init_telemetry`` with an OTLP
|
|
12
|
+
endpoint; every CLI entry point does.
|
|
4
13
|
"""
|
|
5
14
|
|
|
6
15
|
from __future__ import annotations
|
|
7
16
|
|
|
17
|
+
from datetime import datetime
|
|
8
18
|
from typing import TYPE_CHECKING
|
|
9
19
|
|
|
20
|
+
from nthlayer_common.telemetry import emit_event
|
|
21
|
+
|
|
10
22
|
if TYPE_CHECKING:
|
|
11
23
|
from nthlayer_workers.measure.detection.protocol import Alert
|
|
12
24
|
from nthlayer_workers.measure.types import QualityScore
|
|
13
25
|
|
|
14
|
-
try:
|
|
15
|
-
from opentelemetry import trace
|
|
16
|
-
|
|
17
|
-
_tracer = trace.get_tracer("nthlayer-measure")
|
|
18
|
-
_HAS_OTEL = True
|
|
19
|
-
except ImportError:
|
|
20
|
-
_tracer = None # type: ignore[assignment]
|
|
21
|
-
_HAS_OTEL = False
|
|
22
|
-
|
|
23
26
|
|
|
24
27
|
# OpenSRM Addendum A1 (opensrm-ju8r). Measure's scores are grader evaluations,
|
|
25
28
|
# emitted as the upstream grader event (A1 §4.4). The other events here are
|
|
@@ -42,10 +45,10 @@ def emit_evaluation_events(score: QualityScore, alerts: list[Alert] | None = Non
|
|
|
42
45
|
An auto-approved output emits the summary only: no evaluator ran, so its
|
|
43
46
|
configured scores are nobody's opinion and must not reach grader
|
|
44
47
|
consumers (A1 §3).
|
|
48
|
+
|
|
49
|
+
Every record is stamped with ``score.timestamp``, when the evaluation was
|
|
50
|
+
made.
|
|
45
51
|
"""
|
|
46
|
-
if not _HAS_OTEL:
|
|
47
|
-
return
|
|
48
|
-
span = trace.get_current_span()
|
|
49
52
|
# A1 §4.4: nthlayer.decision.id only when the decision is identifiable;
|
|
50
53
|
# some adapters leave task_id empty.
|
|
51
54
|
decision_attrs: dict[str, str] = (
|
|
@@ -53,9 +56,9 @@ def emit_evaluation_events(score: QualityScore, alerts: list[Alert] | None = Non
|
|
|
53
56
|
)
|
|
54
57
|
if not score.auto_approved:
|
|
55
58
|
for dimension, value in score.dimensions.items():
|
|
56
|
-
|
|
59
|
+
emit_event(
|
|
57
60
|
GRADER_EVENT,
|
|
58
|
-
|
|
61
|
+
{
|
|
59
62
|
**decision_attrs,
|
|
60
63
|
"gen_ai.evaluation.name": dimension,
|
|
61
64
|
"gen_ai.evaluation.score.value": value,
|
|
@@ -65,6 +68,7 @@ def emit_evaluation_events(score: QualityScore, alerts: list[Alert] | None = Non
|
|
|
65
68
|
"nthlayer.evaluator.model": score.evaluator_model,
|
|
66
69
|
"nthlayer.evaluator.confidence": score.confidence,
|
|
67
70
|
},
|
|
71
|
+
timestamp=score.timestamp,
|
|
68
72
|
)
|
|
69
73
|
summary: dict[str, str | float | int | bool] = {
|
|
70
74
|
**decision_attrs,
|
|
@@ -77,7 +81,7 @@ def emit_evaluation_events(score: QualityScore, alerts: list[Alert] | None = Non
|
|
|
77
81
|
summary["nthlayer.evaluation.cost_usd"] = score.cost_usd
|
|
78
82
|
if alerts:
|
|
79
83
|
summary["nthlayer.evaluation.alert_count"] = len(alerts)
|
|
80
|
-
|
|
84
|
+
emit_event("nthlayer.evaluation.completed", summary, timestamp=score.timestamp)
|
|
81
85
|
|
|
82
86
|
|
|
83
87
|
def emit_correction_event(
|
|
@@ -87,17 +91,16 @@ def emit_correction_event(
|
|
|
87
91
|
corrected: float,
|
|
88
92
|
corrector: str,
|
|
89
93
|
*,
|
|
94
|
+
corrected_at: datetime,
|
|
90
95
|
decision_id: str | None = None,
|
|
91
96
|
) -> None:
|
|
92
97
|
"""Record a human's corrected dimension score as a human grader evaluation.
|
|
93
98
|
|
|
94
99
|
A1 §4.4: a human's verdict on a completion is a grader evaluation with
|
|
95
100
|
``nthlayer.evaluator.kind`` ``human``. ``decision_id`` is the evaluated
|
|
96
|
-
task; it is omitted when unknown or empty.
|
|
101
|
+
task; it is omitted when unknown or empty. ``corrected_at`` is when the
|
|
102
|
+
human made the correction, the record's Timestamp (ruling Q2).
|
|
97
103
|
"""
|
|
98
|
-
if not _HAS_OTEL:
|
|
99
|
-
return
|
|
100
|
-
span = trace.get_current_span()
|
|
101
104
|
attributes: dict[str, str | float | int | bool] = {
|
|
102
105
|
"gen_ai.evaluation.name": dimension,
|
|
103
106
|
"gen_ai.evaluation.score.value": corrected,
|
|
@@ -108,7 +111,7 @@ def emit_correction_event(
|
|
|
108
111
|
}
|
|
109
112
|
if decision_id:
|
|
110
113
|
attributes["nthlayer.decision.id"] = decision_id
|
|
111
|
-
|
|
114
|
+
emit_event(GRADER_EVENT, attributes, timestamp=corrected_at)
|
|
112
115
|
|
|
113
116
|
|
|
114
117
|
def emit_calibration_report_event(
|
|
@@ -121,10 +124,8 @@ def emit_calibration_report_event(
|
|
|
121
124
|
mae: float,
|
|
122
125
|
compliant: bool | None = None,
|
|
123
126
|
) -> None:
|
|
124
|
-
"""Record a calibration/SLO report as
|
|
125
|
-
|
|
126
|
-
return
|
|
127
|
-
span = trace.get_current_span()
|
|
127
|
+
"""Record a calibration/SLO report. It is computed as it is emitted, so
|
|
128
|
+
its Timestamp is the emit time."""
|
|
128
129
|
attributes: dict[str, str | float | int | bool] = {
|
|
129
130
|
"agent_name": agent_name,
|
|
130
131
|
"window_days": window_days,
|
|
@@ -139,7 +140,7 @@ def emit_calibration_report_event(
|
|
|
139
140
|
attributes["recall"] = recall
|
|
140
141
|
if compliant is not None:
|
|
141
142
|
attributes["reversal_rate_compliant"] = compliant
|
|
142
|
-
|
|
143
|
+
emit_event("nthlayer.calibration.report", attributes)
|
|
143
144
|
|
|
144
145
|
|
|
145
146
|
def emit_state_transition_event(
|
|
@@ -147,17 +148,18 @@ def emit_state_transition_event(
|
|
|
147
148
|
from_level: str,
|
|
148
149
|
to_level: str,
|
|
149
150
|
triggered_by: str,
|
|
151
|
+
*,
|
|
152
|
+
changed_at: datetime,
|
|
150
153
|
) -> None:
|
|
151
|
-
"""Record an autonomy state transition
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
span = trace.get_current_span()
|
|
155
|
-
span.add_event(
|
|
154
|
+
"""Record an autonomy state transition. ``changed_at`` is when the level
|
|
155
|
+
changed, the record's Timestamp (ruling Q2)."""
|
|
156
|
+
emit_event(
|
|
156
157
|
"nthlayer.autonomy.changed",
|
|
157
|
-
|
|
158
|
+
{
|
|
158
159
|
"agent_name": agent_name,
|
|
159
160
|
"from_level": from_level,
|
|
160
161
|
"to_level": to_level,
|
|
161
162
|
"triggered_by": triggered_by,
|
|
162
163
|
},
|
|
164
|
+
timestamp=changed_at,
|
|
163
165
|
)
|
|
@@ -10,7 +10,9 @@ from collections import defaultdict
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
|
|
12
12
|
from nthlayer_common.errors import main_with_error_handling
|
|
13
|
+
from nthlayer_common.telemetry import init_telemetry
|
|
13
14
|
|
|
15
|
+
from nthlayer_workers import TELEMETRY_SERVICE_NAME
|
|
14
16
|
from nthlayer_workers.cli_output import warn_parse_failures
|
|
15
17
|
|
|
16
18
|
_log = logging.getLogger(__name__)
|
|
@@ -728,6 +730,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
728
730
|
vr_parser.add_argument("--incident", default=None, help="Incident ID to verify")
|
|
729
731
|
|
|
730
732
|
args = parser.parse_args(argv)
|
|
733
|
+
init_telemetry(TELEMETRY_SERVICE_NAME)
|
|
731
734
|
|
|
732
735
|
dispatch = {
|
|
733
736
|
"collect": _cmd_collect,
|
|
@@ -12,8 +12,10 @@ from typing import Any
|
|
|
12
12
|
|
|
13
13
|
import structlog
|
|
14
14
|
import yaml
|
|
15
|
+
from nthlayer_common.telemetry import init_telemetry
|
|
15
16
|
from nthlayer_common.verdicts import MemoryStore, SQLiteVerdictStore
|
|
16
17
|
|
|
18
|
+
from nthlayer_workers import TELEMETRY_SERVICE_NAME
|
|
17
19
|
from nthlayer_workers.respond.agents.communication import CommunicationAgent
|
|
18
20
|
from nthlayer_workers.respond.agents.investigation import InvestigationAgent
|
|
19
21
|
from nthlayer_workers.respond.agents.remediation import RemediationAgent
|
|
@@ -551,6 +553,7 @@ def main() -> None:
|
|
|
551
553
|
"""CLI entry point."""
|
|
552
554
|
parser = build_parser()
|
|
553
555
|
args = parser.parse_args()
|
|
556
|
+
init_telemetry(TELEMETRY_SERVICE_NAME)
|
|
554
557
|
|
|
555
558
|
if args.command is None:
|
|
556
559
|
parser.print_help()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nthlayer-workers
|
|
3
|
-
Version: 4.0
|
|
3
|
+
Version: 4.1.0
|
|
4
4
|
Summary: NthLayer workers — Tier 2 background computation (observe, measure, correlate, respond, learn)
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Requires-Python: >=3.11
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
9
|
-
Requires-Dist: nthlayer-common<6.0.0,>=5.
|
|
9
|
+
Requires-Dist: nthlayer-common[otel]<6.0.0,>=5.11.0
|
|
10
10
|
Requires-Dist: httpx>=0.27
|
|
11
11
|
Requires-Dist: pyyaml>=6.0
|
|
12
12
|
Requires-Dist: structlog>=24.1.0
|
|
@@ -189,6 +189,7 @@ src/nthlayer_workers/respond/sre/post_incident.py
|
|
|
189
189
|
src/nthlayer_workers/respond/sre/shift_report.py
|
|
190
190
|
src/nthlayer_workers/respond/sre/suppression.py
|
|
191
191
|
tests/test_cli_gate.py
|
|
192
|
+
tests/test_cli_telemetry.py
|
|
192
193
|
tests/test_dependency_declarations.py
|
|
193
194
|
tests/test_llm_provider.py
|
|
194
195
|
tests/test_runner.py
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Every CLI entry point initialises telemetry before it runs a command.
|
|
2
|
+
|
|
3
|
+
Without ``init_telemetry`` no LoggerProvider is installed, and every event a
|
|
4
|
+
command emits is dropped (opensrm-quqo). The ``python -m`` entry points call
|
|
5
|
+
these same ``main`` functions.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import importlib
|
|
9
|
+
import sys
|
|
10
|
+
from unittest.mock import patch
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
|
|
14
|
+
from nthlayer_workers import TELEMETRY_SERVICE_NAME
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class _Initialised(Exception):
|
|
18
|
+
"""Raised by the patched init_telemetry, so the test stops before the
|
|
19
|
+
command does anything real, and proves the call came first."""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# Each argv is one the CLI's parser accepts, so main gets past parse_args.
|
|
23
|
+
ENTRY_POINTS = [
|
|
24
|
+
("nthlayer_workers.cli", []),
|
|
25
|
+
("nthlayer_workers.measure.cli", []),
|
|
26
|
+
("nthlayer_workers.observe.cli", ["drift", "--service", "s", "--prometheus-url", "http://p"]),
|
|
27
|
+
("nthlayer_workers.learn.cli", ["accuracy", "--producer", "p"]),
|
|
28
|
+
("nthlayer_workers.respond.cli", []),
|
|
29
|
+
("nthlayer_workers.correlate.cli", []),
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@pytest.mark.parametrize(("module", "argv"), ENTRY_POINTS, ids=[m for m, _ in ENTRY_POINTS])
|
|
34
|
+
def test_main_initialises_telemetry_before_running_a_command(module, argv):
|
|
35
|
+
cli = importlib.import_module(module)
|
|
36
|
+
with patch.object(cli, "init_telemetry", side_effect=_Initialised) as init, \
|
|
37
|
+
patch.object(sys, "argv", ["prog", *argv]), \
|
|
38
|
+
pytest.raises(_Initialised):
|
|
39
|
+
cli.main()
|
|
40
|
+
|
|
41
|
+
init.assert_called_once_with(TELEMETRY_SERVICE_NAME)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_every_entry_point_is_covered():
|
|
45
|
+
"""A new console script, or a new ``python -m`` module, must have its main
|
|
46
|
+
added to ENTRY_POINTS."""
|
|
47
|
+
import tomllib
|
|
48
|
+
from pathlib import Path
|
|
49
|
+
|
|
50
|
+
root = Path(__file__).parents[1]
|
|
51
|
+
pyproject = tomllib.loads((root / "pyproject.toml").read_text())
|
|
52
|
+
scripts = {target.split(":")[0] for target in pyproject["project"]["scripts"].values()}
|
|
53
|
+
# Each __main__ module runs its sibling cli.main.
|
|
54
|
+
mains = [p.parent for p in (root / "src" / "nthlayer_workers").rglob("__main__.py")]
|
|
55
|
+
assert len(mains) >= 4, "__main__ discovery found too few modules; the layout moved"
|
|
56
|
+
via_main = {f"nthlayer_workers.{pkg.name}.cli" for pkg in mains}
|
|
57
|
+
|
|
58
|
+
assert scripts | via_main <= {m for m, _ in ENTRY_POINTS}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_the_otel_sdk_and_log_exporter_are_installed():
|
|
62
|
+
"""The [otel] extra must actually deliver what init_telemetry imports, or
|
|
63
|
+
it reports SDK_MISSING and every event drops."""
|
|
64
|
+
import opentelemetry.exporter.otlp.proto.grpc._log_exporter # noqa: F401
|
|
65
|
+
import opentelemetry.sdk._logs # noqa: F401
|
|
@@ -345,3 +345,10 @@ def test_uv_lock_records_this_projects_version():
|
|
|
345
345
|
f"uv.lock records {project['name']} {entries[0].get('version')}, pyproject says "
|
|
346
346
|
f"{project['version']}: run `uv lock` (and check release-please-config.json extra-files)"
|
|
347
347
|
)
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def test_common_is_declared_with_the_otel_extra():
|
|
351
|
+
"""nthlayer-common's ``otel`` extra carries the OTel SDK and OTLP log
|
|
352
|
+
exporter. Without it, ``init_telemetry`` finds an endpoint but no SDK, and
|
|
353
|
+
every event workers emits is dropped (opensrm-quqo)."""
|
|
354
|
+
assert "otel" in _siblings()["nthlayer-common"].extras
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"""NthLayer workers — Tier 2 background computation modules.
|
|
2
|
-
|
|
3
|
-
Internal modules: observe, measure, correlate, respond, learn.
|
|
4
|
-
Communicates with nthlayer-core exclusively via HTTP API.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from importlib.metadata import version
|
|
8
|
-
|
|
9
|
-
__version__ = version("nthlayer-workers")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nthlayer_workers-4.0.2 → nthlayer_workers-4.1.0}/src/nthlayer_workers/correlate/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|