|
6 | 6 | from safir.database import CountedPaginatedList |
7 | 7 |
|
8 | 8 | from docverse.client.models import BuildCreate, BuildStatus, JobKind |
9 | | -from docverse.domain.base32id import validate_base32_id |
| 9 | +from docverse.domain.base32id import serialize_base32_id, validate_base32_id |
10 | 10 | from docverse.domain.build import Build |
11 | 11 | from docverse.domain.project import Project |
12 | 12 | from docverse.domain.queue import QueueJob |
@@ -88,8 +88,9 @@ async def create( |
88 | 88 | ) |
89 | 89 | self._logger.info( |
90 | 90 | "Created build", |
91 | | - build_id=build.id, |
92 | | - project_id=project.id, |
| 91 | + build=serialize_base32_id(build.public_id), |
| 92 | + org=org_slug, |
| 93 | + project=project_slug, |
93 | 94 | git_ref=data.git_ref, |
94 | 95 | ) |
95 | 96 | return build |
@@ -121,15 +122,20 @@ async def signal_upload_complete( |
121 | 122 | ) |
122 | 123 | self._logger.info( |
123 | 124 | "Build upload complete, transitioning to processing", |
124 | | - build_id=build.id, |
| 125 | + build=build_id, |
| 126 | + org=org_slug, |
| 127 | + project=project_slug, |
125 | 128 | ) |
126 | 129 |
|
127 | 130 | backend_job_id = await self._queue_backend.enqueue( |
128 | 131 | "build_processing", |
129 | 132 | { |
130 | 133 | "org_id": project.org_id, |
| 134 | + "org_slug": org_slug, |
131 | 135 | "project_id": project.id, |
| 136 | + "project_slug": project_slug, |
132 | 137 | "build_id": build.id, |
| 138 | + "build_public_id": serialize_base32_id(build.public_id), |
133 | 139 | }, |
134 | 140 | ) |
135 | 141 | queue_job = await self._queue_job_store.create( |
@@ -178,15 +184,20 @@ async def complete(self, *, build_id: int) -> Build: |
178 | 184 | build = await self._store.transition_status( |
179 | 185 | build_id=build_id, new_status=BuildStatus.completed |
180 | 186 | ) |
181 | | - self._logger.info("Build completed", build_id=build_id) |
| 187 | + self._logger.info( |
| 188 | + "Build completed", |
| 189 | + build=serialize_base32_id(build.public_id), |
| 190 | + ) |
182 | 191 | return build |
183 | 192 |
|
184 | 193 | async def fail(self, *, build_id: int) -> Build: |
185 | 194 | """Mark a build as failed.""" |
186 | 195 | build = await self._store.transition_status( |
187 | 196 | build_id=build_id, new_status=BuildStatus.failed |
188 | 197 | ) |
189 | | - self._logger.info("Build failed", build_id=build_id) |
| 198 | + self._logger.info( |
| 199 | + "Build failed", build=serialize_base32_id(build.public_id) |
| 200 | + ) |
190 | 201 | return build |
191 | 202 |
|
192 | 203 | async def soft_delete( |
@@ -214,4 +225,9 @@ async def soft_delete( |
214 | 225 | if not deleted: |
215 | 226 | msg = f"Build {build_id!r} not found" |
216 | 227 | raise NotFoundError(msg) |
217 | | - self._logger.info("Soft-deleted build", build_id=build.id) |
| 228 | + self._logger.info( |
| 229 | + "Soft-deleted build", |
| 230 | + build=build_id, |
| 231 | + org=org_slug, |
| 232 | + project=project_slug, |
| 233 | + ) |
0 commit comments