Skip to content

fix: add support for application/json-seq & application/x-ndjson#42

Open
st3v3nmw wants to merge 2 commits intocanonical:mainfrom
st3v3nmw:add-support-for-json-seq
Open

fix: add support for application/json-seq & application/x-ndjson#42
st3v3nmw wants to merge 2 commits intocanonical:mainfrom
st3v3nmw:add-support-for-json-seq

Conversation

@st3v3nmw
Copy link
Member

@st3v3nmw st3v3nmw commented Mar 25, 2026

Allows us to properly parse application/json-seq returned by the logs endpoint:

>>> snap_http.logs(names=["juju", "microk8s"], entries=10)
SnapdResponse(
  type='sync',
  status_code=200,
  status='OK',
  result=[
    {'timestamp': '2026-03-25T04:57:10.745835Z', 'message': 'snap.microk8s.daemon-apiserver-kicker.service: Start request repeated too quickly.', 'sid': 'systemd', 'pid': '1'},
    {'timestamp': '2026-03-25T04:57:10.749812Z', 'message': "snap.microk8s.daemon-apiserver-kicker.service: Failed with result 'exit-code'.", 'sid': 'systemd', 'pid': '1'},
    {'timestamp': '2026-03-25T04:57:10.749899Z', 'message': 'Failed to start snap.microk8s.daemon-apiserver-kicker.service - Service for snap application microk8s.daemon-apiserver-kicker.', 'sid': 'systemd', 'pid': '1'},
    {'timestamp': '2026-03-25T05:00:28.038837Z', 'message': 'I0325 08:00:28.038774 2105402 cidrallocator.go:277] updated ClusterIP allocator for Service CIDR 10.152.183.0/24', 'sid': 'microk8s.daemon-kubelite', 'pid': '2105402'},
    {'timestamp': '2026-03-25T05:10:28.039087Z', 'message': 'I0325 08:10:28.039049 2105402 cidrallocator.go:277] updated ClusterIP allocator for Service CIDR 10.152.183.0/24', 'sid': 'microk8s.daemon-kubelite', 'pid': '2105402'},
    {'timestamp': '2026-03-25T05:20:28.040078Z', 'message': 'I0325 08:20:28.040022 2105402 cidrallocator.go:277] updated ClusterIP allocator for Service CIDR 10.152.183.0/24', 'sid': 'microk8s.daemon-kubelite', 'pid': '2105402'},
    {'timestamp': '2026-03-25T05:30:28.040194Z', 'message': 'I0325 08:30:28.040166 2105402 cidrallocator.go:277] updated ClusterIP allocator for Service CIDR 10.152.183.0/24', 'sid': 'microk8s.daemon-kubelite', 'pid': '2105402'},
    {'timestamp': '2026-03-25T05:40:28.042441Z', 'message': 'I0325 08:40:28.042391 2105402 cidrallocator.go:277] updated ClusterIP allocator for Service CIDR 10.152.183.0/24', 'sid': 'microk8s.daemon-kubelite', 'pid': '2105402'},
    {'timestamp': '2026-03-25T05:50:28.043351Z', 'message': 'I0325 08:50:28.043318 2105402 cidrallocator.go:277] updated ClusterIP allocator for Service CIDR 10.152.183.0/24', 'sid': 'microk8s.daemon-kubelite', 'pid': '2105402'},
    {'timestamp': '2026-03-25T06:00:28.044017Z', 'message': 'I0325 09:00:28.043986 2105402 cidrallocator.go:277] updated ClusterIP allocator for Service CIDR 10.152.183.0/24', 'sid': 'microk8s.daemon-kubelite', 'pid': '2105402'}
  ], 
  sources=None,
  change=None,
  warning_timestamp=None,
  warning_count=None
)

Closes #41

Follow up on #40

@st3v3nmw st3v3nmw force-pushed the add-support-for-json-seq branch from 294ab81 to 72a9adc Compare March 25, 2026 06:36
@st3v3nmw st3v3nmw requested a review from Perfect5th March 25, 2026 06:38
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.

Parse application/x-ndjson responses into structured data

1 participant