Skip to content

feat: add created_at and updated_at fields to device responses#139

Merged
mguida22 merged 3 commits intofoxglove:mainfrom
BenniRip:fix/add-device-timestamps
Feb 24, 2026
Merged

feat: add created_at and updated_at fields to device responses#139
mguida22 merged 3 commits intofoxglove:mainfrom
BenniRip:fix/add-device-timestamps

Conversation

@BenniRip
Copy link
Contributor

Changelog

Add created_at and updated_at timestamp fields to device response dictionaries in get_device, get_devices, create_device, and update_device methods.

Description

Problem:
The Foxglove API returns createdAt and updatedAt fields for devices, but the Python client was filtering them out. This made it impossible to determine when a device was created or last updated.

Use case:
We needed to clean up old devices based on their creation date, but couldn't because the timestamps weren't exposed by the client.

Solution:
This PR adds these timestamp fields to the device response, following the same pattern already used by _event_dict() for events. A new _device_dict() helper ensures consistent formatting across all device-related methods.

Timestamps are parsed using arrow and returned as datetime objects. If the API response doesn't include these fields (for backwards compatibility), None is returned.

Backwards compatibility:
This change is fully backwards compatible. Existing code accessing the 4 original fields (id, name, properties, project_id) will continue to work unchanged. The two new fields (created_at, updated_at) are simply added to the response.

Updated the tests accordingly.

The device-related methods (get_device, get_devices, create_device, update_device)
now return created_at and updated_at timestamp fields that are available in the
Foxglove API response but were previously omitted.

This follows the same pattern used by _event_dict() for event timestamps.
The timestamps are parsed using arrow and returned as datetime objects.
If the API response doesn't include these fields, None is returned.

Changes:
- Add _device_dict() helper function for consistent device response formatting
- Update get_device, get_devices, create_device, update_device to use _device_dict
- Update tests to verify new timestamp fields
@mguida22
Copy link
Member

Thanks @BenniRip for the improvement, this looks like a good change. Sorry for just seeing this now, do you want to resolve the merge conflicts and we'll get this in? I'm also happy to take this over if you're busy.

@BenniRip BenniRip requested a review from mguida22 as a code owner February 21, 2026 22:11
@BenniRip BenniRip force-pushed the fix/add-device-timestamps branch from fcea75f to 5deda24 Compare February 21, 2026 22:24
@BenniRip
Copy link
Contributor Author

Hi @mguida22 ! Thanks for having a look. I resolved the conflicts, but something in the claude review workflow doesn't seem to work. Would be great if you could have a look. Thanks a lot!

Copy link
Member

@mguida22 mguida22 left a comment

Choose a reason for hiding this comment

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

Thank you!

The failing workflow won't run on forks since it can't access secrets there, I disabled it.

@mguida22 mguida22 merged commit 43fe992 into foxglove:main Feb 24, 2026
2 checks passed
@mguida22
Copy link
Member

This will go out in the next release in a few days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants