Skip to content

feat(orchestrator): tag envd-init meters with start_type#3125

Merged
arkamar merged 2 commits into
mainfrom
feat/envd-init-start-type
Jun 28, 2026
Merged

feat(orchestrator): tag envd-init meters with start_type#3125
arkamar merged 2 commits into
mainfrom
feat/envd-init-start-type

Conversation

@arkamar

@arkamar arkamar commented Jun 28, 2026

Copy link
Copy Markdown
Member

Add a start_type attribute (create/resume/reboot) to the two core envd-init meters orchestrator.sandbox.envd.init.calls and orchestrator.sandbox.envd.init.duration so create, resume, and reboot starts can be distinguished in Grafana. The value already flows into WaitForEnvd; thread it through to initEnvd and the duration histogram.

Add a start_type attribute (create/resume/reboot) to the two core
envd-init meters orchestrator.sandbox.envd.init.calls and
orchestrator.sandbox.envd.init.duration so create, resume, and reboot
starts can be distinguished in Grafana. The value already flows into
WaitForEnvd; thread it through to initEnvd and the duration histogram.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@cursor

cursor Bot commented Jun 28, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Observability-only attribute wiring on existing metrics with no change to init behavior or control flow.

Overview
Envd init telemetry now carries a start_type label (create, resume, or reboot) on orchestrator.sandbox.envd.init.calls and orchestrator.sandbox.envd.init.duration, so Grafana can split cold boots, normal resumes, and filesystem-only reboots instead of blending them.

The existing StartType value already passed into WaitForEnvd is threaded into initEnvd and attached to both the init attempt counter and the wait-for-envd duration histogram (UFFD startup metrics already used the same attribute).

Reviewed by Cursor Bugbot for commit 35085d2. Bugbot is set up for automated code reviews on this repo. Configure here.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

No critical findings or correctness issues were identified in this pull request.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
3090 5 3085 8
View the top 3 failed test(s) by shortest run time
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestTemplateBuildRUN
Stack Traces | 0s run time
=== RUN   TestTemplateBuildRUN
=== PAUSE TestTemplateBuildRUN
=== CONT  TestTemplateBuildRUN
--- FAIL: TestTemplateBuildRUN (0.00s)
github.com/e2b-dev/infra/packages/api/internal/sandbox/storage/redis::TestStorageLocker_ObtainUsesProvidedContext
Stack Traces | 12s run time
=== RUN   TestStorageLocker_ObtainUsesProvidedContext
=== PAUSE TestStorageLocker_ObtainUsesProvidedContext
=== CONT  TestStorageLocker_ObtainUsesProvidedContext
    lock_test.go:97: 
        	Error Trace:	.../storage/redis/lock_test.go:289
        	            				.../storage/redis/lock_test.go:97
        	Error:      	Received unexpected error:
        	            	context deadline exceeded
        	Test:       	TestStorageLocker_ObtainUsesProvidedContext
--- FAIL: TestStorageLocker_ObtainUsesProvidedContext (11.96s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestDeleteTemplateFromAnotherTeamAPIKey
Stack Traces | 148s run time
=== RUN   TestDeleteTemplateFromAnotherTeamAPIKey
=== PAUSE TestDeleteTemplateFromAnotherTeamAPIKey
=== CONT  TestDeleteTemplateFromAnotherTeamAPIKey
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Building template qjv3nb9f8tyl46td5cps/9f2315fb-07f9-42c4-a932-39aaf03bd381
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] [base] FROM ubuntu:22.04 [905bb9b1f7b3e631aa9d97d25385b3bb55c45687cb0f33deab700d7906575727]
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Base Docker image size: 30 MB
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Creating file system and pulling Docker image
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Uncompressing layer sha256:40d16f30db405106ef8074779bdf41f012465c2a785bbeaa2eab9f2081099b47 30 MB
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Uncompressing layer sha256:88ead2fc12bcb23b3c68d61b68d82bbce07207e3bff30793f2ab0de5aa4e2eb7 13 MB
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Uncompressing layer sha256:8c4b1b28875140ed3abacaf16ad0d696f6bef912f52d2148f261a23e3349465b 168 B
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Layers extracted
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Root filesystem structure: bin, boot, dev, etc, home, lib, lib32, lib64, libx32, media, mnt, opt, proc, root, run, sbin, srv, sys, tmp, usr, var
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Provisioning sandbox template
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Provisioning was successful, cleaning up
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] Sandbox template provisioned
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] [base] DEFAULT USER user [ea1d9e9a4e5e72b3edd251b28ade9fa6aa5a91811560507694d4964fdbac723b]
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] [builder 1/1] RUN echo 'Hello, World!' [3a7c1b087bdada710574e91a5484a97044150a027127d59c9b2df2bec44bdd33]
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] [builder 1/1] [stdout]: Hello, World!
    build_template_test.go:133: test-to-delete-another-team-api-key: [info] [finalize] Finalizing template build [bf952c855fff6cfdd2ac81baf7c186afcaf50eaeee6b2a47b347408b7390e652]
    build_template_test.go:133: test-to-delete-another-team-api-key: [error] Build failed: build was cancelled
    delete_template_test.go:51: Build failed: {<nil> build was cancelled <nil>}
--- FAIL: TestDeleteTemplateFromAnotherTeamAPIKey (147.94s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestDeleteTemplate
Stack Traces | 153s run time
=== RUN   TestDeleteTemplate
=== PAUSE TestDeleteTemplate
=== CONT  TestDeleteTemplate
    build_template_test.go:133: test-to-delete: [info] Building template d7dp52ts7wz11xncge9n/ebc0b3f7-6a07-4227-8e79-9eba3c7cc06e
    build_template_test.go:133: test-to-delete: [info] [base] FROM ubuntu:22.04 [905bb9b1f7b3e631aa9d97d25385b3bb55c45687cb0f33deab700d7906575727]
    build_template_test.go:133: test-to-delete: [info] Base Docker image size: 30 MB
    build_template_test.go:133: test-to-delete: [info] Creating file system and pulling Docker image
    build_template_test.go:133: test-to-delete: [info] Uncompressing layer sha256:40d16f30db405106ef8074779bdf41f012465c2a785bbeaa2eab9f2081099b47 30 MB
    build_template_test.go:133: test-to-delete: [info] Uncompressing layer sha256:88ead2fc12bcb23b3c68d61b68d82bbce07207e3bff30793f2ab0de5aa4e2eb7 13 MB
    build_template_test.go:133: test-to-delete: [info] Uncompressing layer sha256:8c4b1b28875140ed3abacaf16ad0d696f6bef912f52d2148f261a23e3349465b 168 B
    build_template_test.go:133: test-to-delete: [info] Layers extracted
    build_template_test.go:133: test-to-delete: [info] Root filesystem structure: bin, boot, dev, etc, home, lib, lib32, lib64, libx32, media, mnt, opt, proc, root, run, sbin, srv, sys, tmp, usr, var
    build_template_test.go:133: test-to-delete: [info] Provisioning sandbox template
    build_template_test.go:133: test-to-delete: [info] Provisioning was successful, cleaning up
    build_template_test.go:133: test-to-delete: [info] Sandbox template provisioned
    build_template_test.go:133: test-to-delete: [info] [base] DEFAULT USER user [ea1d9e9a4e5e72b3edd251b28ade9fa6aa5a91811560507694d4964fdbac723b]
    build_template_test.go:133: test-to-delete: [info] [builder 1/1] RUN echo 'Hello, World!' [3a7c1b087bdada710574e91a5484a97044150a027127d59c9b2df2bec44bdd33]
    build_template_test.go:133: test-to-delete: [info] [builder 1/1] [stdout]: Hello, World!
    build_template_test.go:133: test-to-delete: [info] [finalize] Finalizing template build [bf952c855fff6cfdd2ac81baf7c186afcaf50eaeee6b2a47b347408b7390e652]
    build_template_test.go:133: test-to-delete: [error] Build failed: build was cancelled
    delete_template_test.go:18: Build failed: {<nil> build was cancelled <nil>}
--- FAIL: TestDeleteTemplate (152.54s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestTemplateBuildRUN/Single_RUN_command
Stack Traces | 153s run time
=== RUN   TestTemplateBuildRUN/Single_RUN_command
=== PAUSE TestTemplateBuildRUN/Single_RUN_command
=== CONT  TestTemplateBuildRUN/Single_RUN_command
    build_template_test.go:133: test-ubuntu-run: [info] Building template sbb2iosb9ji3ia16xa0n/87cee549-c5c6-41fb-8de7-261edd95f5cc
    build_template_test.go:133: test-ubuntu-run: [info] [base] FROM ubuntu:22.04 [905bb9b1f7b3e631aa9d97d25385b3bb55c45687cb0f33deab700d7906575727]
    build_template_test.go:133: test-ubuntu-run: [info] Base Docker image size: 30 MB
    build_template_test.go:133: test-ubuntu-run: [info] Creating file system and pulling Docker image
    build_template_test.go:133: test-ubuntu-run: [info] Uncompressing layer sha256:40d16f30db405106ef8074779bdf41f012465c2a785bbeaa2eab9f2081099b47 30 MB
    build_template_test.go:133: test-ubuntu-run: [info] Uncompressing layer sha256:88ead2fc12bcb23b3c68d61b68d82bbce07207e3bff30793f2ab0de5aa4e2eb7 13 MB
    build_template_test.go:133: test-ubuntu-run: [info] Uncompressing layer sha256:8c4b1b28875140ed3abacaf16ad0d696f6bef912f52d2148f261a23e3349465b 168 B
    build_template_test.go:133: test-ubuntu-run: [info] Layers extracted
    build_template_test.go:133: test-ubuntu-run: [info] Root filesystem structure: bin, boot, dev, etc, home, lib, lib32, lib64, libx32, media, mnt, opt, proc, root, run, sbin, srv, sys, tmp, usr, var
    build_template_test.go:133: test-ubuntu-run: [info] Provisioning sandbox template
    build_template_test.go:133: test-ubuntu-run: [info] Provisioning was successful, cleaning up
    build_template_test.go:133: test-ubuntu-run: [info] Sandbox template provisioned
    build_template_test.go:133: test-ubuntu-run: [info] [base] DEFAULT USER user [ea1d9e9a4e5e72b3edd251b28ade9fa6aa5a91811560507694d4964fdbac723b]
    build_template_test.go:133: test-ubuntu-run: [info] [builder 1/1] RUN echo 'Hello, World!' [3a7c1b087bdada710574e91a5484a97044150a027127d59c9b2df2bec44bdd33]
    build_template_test.go:133: test-ubuntu-run: [info] [builder 1/1] [stdout]: Hello, World!
    build_template_test.go:133: test-ubuntu-run: [info] [finalize] Finalizing template build [bf952c855fff6cfdd2ac81baf7c186afcaf50eaeee6b2a47b347408b7390e652]
    build_template_test.go:133: test-ubuntu-run: [error] Build failed: build was cancelled
    build_template_test.go:166: Build failed: {<nil> build was cancelled <nil>}
--- FAIL: TestTemplateBuildRUN/Single_RUN_command (152.59s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestCommandKillNextApp
Stack Traces | 202s run time
=== RUN   TestCommandKillNextApp
=== PAUSE TestCommandKillNextApp
=== CONT  TestCommandKillNextApp
    process_test.go:30: Build failed: {<nil> build was cancelled <nil>}
--- FAIL: TestCommandKillNextApp (201.83s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — small observability change threading the existing StartType through to the envd-init meters, mirroring the established pattern.

Extended reasoning...

Overview

This PR adds a start_type attribute (create/resume/reboot) to two existing meters: orchestrator.sandbox.envd.init.calls (counter, in envd.go) and orchestrator.sandbox.envd.init.duration (histogram, in sandbox.go). It threads the already-existing StartType parameter from WaitForEnvd into initEnvd and appends one attribute.String("start_type", ...) to each meter's attribute set. The StartType type itself, and its use for the uffd.startup.* metrics, already landed in the previous PR (f2ad0af).

Security risks

None — purely an observability/labeling change. No auth, crypto, network, or permission code is touched.

Level of scrutiny

Low. This is a mechanical telemetry tweak: one new function parameter threaded through one call site, and two single-line attribute additions. There is no control-flow change, no behavior change visible to the sandbox or to callers, and the meter names/types are unchanged. The label cardinality added is bounded by the three StartType constants.

Other factors

The bug hunter only flagged a nit: the StartType doc comment at sandbox.go:60-61 still enumerates only orchestrator.sandbox.uffd.startup.* and now under-reports the meters tagged with start_type. That is purely a comment-staleness issue with no runtime impact and does not warrant blocking the PR.

Conclusion

Simple, low-risk, self-contained — safe to approve without a human reviewer.

Comment thread packages/orchestrator/pkg/sandbox/sandbox.go
The StartType doc comment listed only the uffd.startup.* metrics and
under-reported the envd-init meters now tagged with start_type. Make it
meter-agnostic to avoid future staleness.
@arkamar arkamar merged commit 4466b48 into main Jun 28, 2026
97 of 99 checks passed
@arkamar arkamar deleted the feat/envd-init-start-type branch June 28, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants