Skip to content

Commit 9e360f6

Browse files
CC-5749 Drop deprecated containers observability.logging field (#11437)
* CC-5749 Drop deprecated containers observability.logging field * Mark the changes as minor Co-authored-by: Edmund Hung <me@edmund.dev> --------- Co-authored-by: Edmund Hung <me@edmund.dev>
1 parent 6a05b1c commit 9e360f6

File tree

8 files changed

+6
-188
lines changed

8 files changed

+6
-188
lines changed

.changeset/fruity-rice-chew.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@cloudflare/containers-shared": minor
3+
"wrangler": minor
4+
---
5+
6+
Drop deprecated containers `observability.logging` field

packages/containers-shared/src/client/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ export { NetworkMode } from "./models/NetworkMode";
160160
export type { NetworkParameters } from "./models/NetworkParameters";
161161
export { NodeGroup } from "./models/NodeGroup";
162162
export type { Observability } from "./models/Observability";
163-
export type { ObservabilityLogging } from "./models/ObservabilityLogging";
164163
export type { ObservabilityLogs } from "./models/ObservabilityLogs";
165164
export type { Placement } from "./models/Placement";
166165
export type { PlacementEvent } from "./models/PlacementEvent";

packages/containers-shared/src/client/models/Observability.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
/* tslint:disable */
33
/* eslint-disable */
44

5-
import type { ObservabilityLogging } from "./ObservabilityLogging";
65
import type { ObservabilityLogs } from "./ObservabilityLogs";
76

87
/**
98
* Settings for observability such as logging.
109
*/
1110
export type Observability = {
12-
logging?: ObservabilityLogging;
1311
logs?: ObservabilityLogs;
1412
};

packages/containers-shared/src/client/models/ObservabilityLogging.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/wrangler/src/__tests__/cloudchamber/apply.test.ts

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,80 +1301,6 @@ describe("cloudchamber apply", () => {
13011301
expect(app.instances).toEqual(1);
13021302
});
13031303

1304-
test("ignores deprecated observability.logging", async () => {
1305-
setIsTTY(false);
1306-
writeWranglerConfig({
1307-
name: "my-container",
1308-
containers: [
1309-
{
1310-
name: "my-container-app",
1311-
class_name: "DurableObjectClass",
1312-
instances: 1,
1313-
image: "registry.cloudflare.com/beep:boop",
1314-
},
1315-
],
1316-
});
1317-
mockGetApplications([
1318-
{
1319-
id: "abc",
1320-
name: "my-container-app",
1321-
instances: 1,
1322-
created_at: new Date().toString(),
1323-
version: 1,
1324-
account_id: "1",
1325-
scheduling_policy: SchedulingPolicy.REGIONAL,
1326-
configuration: {
1327-
image: "registry.cloudflare.com/beep:boop",
1328-
observability: {
1329-
logs: {
1330-
enabled: true,
1331-
},
1332-
logging: {
1333-
enabled: true,
1334-
},
1335-
},
1336-
disk: {
1337-
size: "2GB",
1338-
size_mb: 2000,
1339-
},
1340-
vcpu: 0.0625,
1341-
memory: "256MB",
1342-
memory_mib: 256,
1343-
},
1344-
constraints: {
1345-
tier: 1,
1346-
},
1347-
},
1348-
]);
1349-
const applicationReqBodyPromise = mockModifyApplication();
1350-
await runWrangler("cloudchamber apply");
1351-
expect(std.stdout).toMatchInlineSnapshot(`
1352-
"╭ Deploy a container application deploy changes to your application
1353-
1354-
│ Container application changes
1355-
1356-
├ EDIT my-container-app
1357-
1358-
│ instance_type = \\"lite\\"
1359-
│ [containers.configuration.observability.logs]
1360-
│ - enabled = true
1361-
│ + enabled = false
1362-
│ [containers.constraints]
1363-
│ tier = 1
1364-
1365-
1366-
│ SUCCESS Modified application my-container-app
1367-
1368-
╰ Applied changes
1369-
1370-
"
1371-
`);
1372-
expect(std.stderr).toMatchInlineSnapshot(`""`);
1373-
const app = await applicationReqBodyPromise;
1374-
expect(app.constraints?.tier).toEqual(1);
1375-
expect(app.instances).toEqual(1);
1376-
});
1377-
13781304
test("keeps observability logs enabled", async () => {
13791305
setIsTTY(false);
13801306
writeWranglerConfig({
@@ -1404,9 +1330,6 @@ describe("cloudchamber apply", () => {
14041330
logs: {
14051331
enabled: true,
14061332
},
1407-
logging: {
1408-
enabled: true,
1409-
},
14101333
},
14111334
disk: {
14121335
size: "2GB",
@@ -1516,9 +1439,6 @@ describe("cloudchamber apply", () => {
15161439
logs: {
15171440
enabled: false,
15181441
},
1519-
logging: {
1520-
enabled: false,
1521-
},
15221442
},
15231443
disk: {
15241444
size: "2GB",

packages/wrangler/src/__tests__/containers/deploy.test.ts

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,63 +1368,6 @@ describe("wrangler deploy with containers", () => {
13681368
"
13691369
`);
13701370
});
1371-
it("should ignore deprecated observability.logging field from the api", async () => {
1372-
mockGetVersion("Galaxy-Class");
1373-
writeWranglerConfig({
1374-
...DEFAULT_DURABLE_OBJECTS,
1375-
containers: [DEFAULT_CONTAINER_FROM_REGISTRY],
1376-
});
1377-
1378-
mockGetApplications([
1379-
{
1380-
...sharedGetApplicationResult,
1381-
configuration: {
1382-
...sharedGetApplicationResult.configuration,
1383-
observability: {
1384-
logging: {
1385-
enabled: false,
1386-
},
1387-
logs: {
1388-
enabled: true,
1389-
},
1390-
},
1391-
},
1392-
},
1393-
]);
1394-
1395-
mockModifyApplication({
1396-
configuration: {
1397-
image: "registry.cloudflare.com/some-account-id/hello:world",
1398-
observability: { logs: { enabled: false } },
1399-
},
1400-
});
1401-
1402-
mockCreateApplicationRollout();
1403-
1404-
await runWrangler("deploy index.js");
1405-
1406-
expect(cliStd.stdout).toMatchInlineSnapshot(`
1407-
"╭ Deploy a container application deploy changes to your application
1408-
1409-
│ Container application changes
1410-
1411-
├ EDIT my-container
1412-
1413-
│ instance_type = \\"lite\\"
1414-
│ [containers.configuration.observability.logs]
1415-
│ - enabled = true
1416-
│ + enabled = false
1417-
│ [containers.constraints]
1418-
│ tier = 1
1419-
1420-
1421-
│ SUCCESS Modified application my-container (Application ID: abc)
1422-
1423-
╰ Applied changes
1424-
1425-
"
1426-
`);
1427-
});
14281371
it("should keep observability logs enabled", async () => {
14291372
mockGetVersion("Galaxy-Class");
14301373
writeWranglerConfig({
@@ -1486,9 +1429,6 @@ describe("wrangler deploy with containers", () => {
14861429
logs: {
14871430
enabled: false,
14881431
},
1489-
logging: {
1490-
enabled: false,
1491-
},
14921432
},
14931433
},
14941434
},

packages/wrangler/src/cloudchamber/apply.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -133,20 +133,6 @@ function applicationToCreateApplication(
133133
return app;
134134
}
135135

136-
function cleanupObservability(
137-
observability: ObservabilityConfiguration | undefined
138-
) {
139-
if (observability === undefined) {
140-
return;
141-
}
142-
143-
// `logging` field is deprecated, so if the server returns both `logging` and `logs`
144-
// fields, drop the `logging` one.
145-
if (observability.logging !== undefined && observability.logs !== undefined) {
146-
delete observability.logging;
147-
}
148-
}
149-
150136
function observabilityToConfiguration(
151137
observability: Observability | undefined,
152138
existingObservabilityConfig: ObservabilityConfiguration | undefined
@@ -353,9 +339,6 @@ export async function apply(
353339
ApplicationsService.listApplications(),
354340
{ message: "Loading applications" }
355341
);
356-
applications.forEach((app) =>
357-
cleanupObservability(app.configuration.observability)
358-
);
359342
const applicationByNames: Record<ApplicationName, Application> = {};
360343
// TODO: this is not correct right now as there can be multiple applications
361344
// with the same name.

packages/wrangler/src/containers/deploy.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -218,20 +218,6 @@ function createApplicationToModifyApplication(
218218
};
219219
}
220220

221-
function cleanupObservability(
222-
observability: ObservabilityConfiguration | undefined
223-
) {
224-
if (observability === undefined) {
225-
return;
226-
}
227-
228-
// `logging` field is deprecated, so if the server returns both `logging` and `logs`
229-
// fields, drop the `logging` one.
230-
if (observability.logging !== undefined && observability.logs !== undefined) {
231-
delete observability.logging;
232-
}
233-
}
234-
235221
/**
236222
* Resolves current configuration based on previous deployment.
237223
*/
@@ -349,9 +335,6 @@ export async function apply(
349335
ApplicationsService.listApplications(),
350336
{ message: "Loading applications" }
351337
);
352-
existingApplications.forEach((app) =>
353-
cleanupObservability(app.configuration.observability)
354-
);
355338
// TODO: this is not correct right now as there can be multiple applications
356339
// with the same name.
357340
/** Previous deployment of this app, if this exists */

0 commit comments

Comments
 (0)