Convey endpointUrl and machineId to extensions via LSTK_EXT_CONTEXT - #446
Convey endpointUrl and machineId to extensions via LSTK_EXT_CONTEXT#446carillan81 wants to merge 1 commit into
Conversation
73a14eb to
b91d41e
Compare
skyrpex
left a comment
There was a problem hiding this comment.
LGTM, let's wait for Shelton's decision.
|
@peter-smith-phd This came up today and I can see it is connected to Doctor extension. Do you have any feedback before it merges? |
peter-smith-phd
left a comment
There was a problem hiding this comment.
Thanks, looks good to me. A lot of file changes, but this essentially just adds two necessary fields to the extension context.
There was a problem hiding this comment.
Cleanly conveys endpointUrl and machineId to extensions via LSTK_EXT_CONTEXT — I built the tree (go build ./...) and ran the telemetry/extension unit tests green, and confirmed machineId is the salted md5 hash (so nothing new is exposed) and no path routes extension traffic to real AWS.
- thought: on
internal/telemetry/client.go— routingGetEnvironmentthrough the newMachineID(ctx)also caps the telemetry event path atmachineIDTimeout(3s), not just extension dispatch. Under Docker latency above 3s a run now falls through to the system/generated id, so the same machine can report a different (still anonymized)machine_idacross runs — intentional and documented, just flagging that the timeout's blast radius now covers ordinary event emission too. - praise: the tests earn their keep — asserting the conveyed
machineIdequals the id on the actuallstk_commandevent (not merely non-empty), and the per-sourceendpointUrlprecedence table including verbatim passthrough of a malformed value, cover exactly the two things that could silently regress.
Automated review on behalf of @gtsiolis.
Generated by Claude Code
Extensions gain two optional runtime-context fields: endpointUrl carries the resolved --endpoint-url / LSTK_ENDPOINT_URL / AWS_ENDPOINT_URL value verbatim (unvalidated and unprobed, omitted when no source is set), and machineId carries the anonymized machine id lstk stamps on its own telemetry, so an extension reports the same machine without re-deriving it (omitted together with sessionId when telemetry is disabled).
The machine-id derivation now lives in MachineID(ctx) behind the enabled guard, so a disabled client never dials Docker or persists a machine_id file, and the Docker lookup is bounded by a 3s timeout so an unreachable DOCKER_HOST cannot stall dispatch for the OS TCP connect timeout before the extension execs.
Co-Authored-By: Claude noreply@anthropic.com