Skip to content

Conversation

@mikesir87
Copy link
Member

@mikesir87 mikesir87 commented Jan 7, 2026

This... is a large PR and includes a few refactorings to make the code more accessible and easier to plug the analytics into.

All analytics are published by the interface backend. However, the metadata it needs comes from a variety of sources.

At startup, the configurator now starts a new container using its own image and mounts the Docker Desktop backend socket to obtain the user IDs of the logged in user and the current setting for the "allow usage analytics" setting. This, as well as a variety of other fields are stored in a metadata.json file in the labspace-support volume that is also mounted into the interface service.

It is recognized that the id field can easily be spoofed by other authors, but so can any of the analytic events at this point. We may consider creating a custom GitHub Action that is used to publish Labspaces, where some sort of validation could be applied. But again, that's easily worked around (by not using the action). Longer term, we may look at signing of the images and creating rules around identifiers in relation to the signing authority/subjects. But that's a conversation for another day.

Notably, if a user has disabled usage tracking in Docker Desktop at the time the Labspace starts or is running in a non-Docker Desktop environment, no event tracking will be performed. The user must explicitly have usage tracking enabled.

Development environment changes

This PR also adds a merlin-mock service. This service is added to the development Compose stack and the interface backend is configured to send events to it. This mock interface provides a frontend to display the events that were published.

Update to the labspace.yaml schema

This change also forces an update to the labspace.yaml schema. The new metadata block provides additional metadata needed for analytics. When the fields aren't set, the analytics will default their value to unknown. We can determine in the future whether we skip events on unknown labs or not.

metadata:
  id: dockersamples/labspace-demo      # Should match the name of the published Compose file
  sourceRepo: github.com/dockersamples/labspace-demo
  contentVersion: abcd123         # Most likely the short commit sha of the published content

title: Labspace demo
description: |
  The description of the Labspace

sections: # Remains unchanged

- Simplify the main index.js
- Create separate route handlers and restructure the API naming
- Split the large service into a two smaller services
- Add node-graceful-shutdown to simplify teardown functions
This is mostly a naming cleanup to provide consistency across the
project
When the configurator starts, it will start a new container using
its own image, but adding the DD backend socket. Using that socket,
the container will query for the various user IDs and the current
value of the analytics setting. All of this is stored in a JSON
file that will have additional metadata added and sent to the
analytics engine in the interface backend.
These analytic events will help us know how Labspaces are being
used and can support the creation of various dashboards to
understand where users get stuck (how can we make the training
content better?), understand completion rates, and overall usage
stats.
Pushing content into a metadata key and providing support for the
sourceRepo and contentVersion
Making this change as it breaks less, but also allows the metadata
to simply be additional data about the labspace that may or may
not actually be required to run the labspace itself
@mikesir87 mikesir87 merged commit 530e8b1 into main Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants