Expected behavior
When one ScopeDoctorGroup needs another, I would expect the outermost group span to be a parent of the group(s) it imports.
For example:
scope doctor run ==========================================
doctor run ==================================
group (outer) ====================
group (inner) =====
group (sibling) =====
This would let us properly time each group and quickly see which groups are taking longest to run.
Actual Behavior
The parent group comes after its children at a sibling level.
MVCE (Minimal Verifiable Complete Example)
zip archive for convenience
unzip scope-telemetry-mvce.zip
cd scope-telemetry-mvce
docker compose up -d
open http://localhost:16686
SCOPE_OTEL_ENDPOINT=http://localhost:4318 scope doctor run
Directory structure
❯ tree -a
.
├── .scope
│ ├── child-group.yaml
│ └── mvce.yaml
└── docker-compose.yml
mvce.yaml
apiVersion: scope.github.com/v1alpha
kind: ScopeDoctorGroup
metadata:
name: mvce
spec:
needs:
- child-group
actions: []
child-group.yaml
apiVersion: scope.github.com/v1alpha
kind: ScopeDoctorGroup
metadata:
name: child-group
spec:
include: when-required
needs: []
actions: []
docker-compose.yaml
name: jaeger
services:
all-in-one:
container_name: jaeger
environment:
- COLLECTOR_ZIPKIN_HOST_PORT=:9411
- COLLECTOR_OTLP_ENABLED=true
ports:
- 6831:6831/udp
- 6832:6832/udp
- 5778:5778
- 16686:16686
- 4317:4317
- 4318:4318
- 14250:14250
- 14268:14268
- 14269:14269
- 9411:9411
image: jaegertracing/all-in-one:latest
Proposed Fix
The runner always sets the parent span for all groups to doctor run.
https://github.com/oscope-dev/scope/blob/1ef9b9041097d58de8e90622138cc4555db7e246/scope/src/doctor/runner.rs#L151
And the groups are passed as a Vec
https://github.com/oscope-dev/scope/blob/1ef9b9041097d58de8e90622138cc4555db7e246/scope/src/doctor/runner.rs#L125
In order to fix this, we would need to preserve the tree of groups and ensure that only root nodes have their parent set to doctor run while child groups properly point to their parent group.
It's worth noting that it's actually a forest, as multiple root nodes are currently possible.
I'm sure there are other benefits to preserving this structure in the code that I haven't thought of.
Expected behavior
When one
ScopeDoctorGroupneedsanother, I would expect the outermost group span to be a parent of the group(s) it imports.For example:
scope doctor run ========================================== doctor run ================================== group (outer) ==================== group (inner) ===== group (sibling) =====This would let us properly time each group and quickly see which groups are taking longest to run.
Actual Behavior
The parent group comes after its children at a sibling level.
MVCE (Minimal Verifiable Complete Example)
zip archive for convenience
unzip scope-telemetry-mvce.zip cd scope-telemetry-mvce docker compose up -d open http://localhost:16686 SCOPE_OTEL_ENDPOINT=http://localhost:4318 scope doctor runDirectory structure
mvce.yamlchild-group.yamldocker-compose.yamlProposed Fix
The runner always sets the parent span for all groups to
doctor run.https://github.com/oscope-dev/scope/blob/1ef9b9041097d58de8e90622138cc4555db7e246/scope/src/doctor/runner.rs#L151
And the groups are passed as a
Vechttps://github.com/oscope-dev/scope/blob/1ef9b9041097d58de8e90622138cc4555db7e246/scope/src/doctor/runner.rs#L125
In order to fix this, we would need to preserve the
treeof groups and ensure that only root nodes have their parent set todoctor runwhile child groups properly point to their parent group.It's worth noting that it's actually a forest, as multiple root nodes are currently possible.
I'm sure there are other benefits to preserving this structure in the code that I haven't thought of.