@datadog/datadog-ci 3.12.0 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/aas/common.d.ts +3 -4
  3. package/dist/commands/aas/common.js +28 -10
  4. package/dist/commands/aas/common.js.map +1 -1
  5. package/dist/commands/aas/instrument.d.ts +7 -2
  6. package/dist/commands/aas/instrument.js +51 -10
  7. package/dist/commands/aas/instrument.js.map +1 -1
  8. package/dist/commands/aas/interfaces.d.ts +3 -0
  9. package/dist/commands/cloud-run/constants.d.ts +2 -0
  10. package/dist/commands/cloud-run/constants.js +3 -1
  11. package/dist/commands/cloud-run/constants.js.map +1 -1
  12. package/dist/commands/cloud-run/flare.js +1 -0
  13. package/dist/commands/cloud-run/flare.js.map +1 -1
  14. package/dist/commands/cloud-run/instrument.d.ts +15 -8
  15. package/dist/commands/cloud-run/instrument.js +260 -138
  16. package/dist/commands/cloud-run/instrument.js.map +1 -1
  17. package/dist/commands/cloud-run/interfaces.d.ts +0 -19
  18. package/dist/commands/cloud-run/prompt.d.ts +5 -0
  19. package/dist/commands/cloud-run/prompt.js +86 -0
  20. package/dist/commands/cloud-run/prompt.js.map +1 -0
  21. package/dist/commands/cloud-run/renderer.d.ts +1 -2
  22. package/dist/commands/cloud-run/renderer.js +3 -11
  23. package/dist/commands/cloud-run/renderer.js.map +1 -1
  24. package/dist/commands/cloud-run/types.d.ts +3 -2
  25. package/dist/commands/cloud-run/uninstrument.d.ts +21 -0
  26. package/dist/commands/cloud-run/uninstrument.js +187 -0
  27. package/dist/commands/cloud-run/uninstrument.js.map +1 -0
  28. package/dist/commands/cloud-run/utils.d.ts +10 -0
  29. package/dist/commands/cloud-run/utils.js +81 -1
  30. package/dist/commands/cloud-run/utils.js.map +1 -1
  31. package/dist/commands/coverage/renderer.d.ts +2 -1
  32. package/dist/commands/coverage/renderer.js +12 -7
  33. package/dist/commands/coverage/renderer.js.map +1 -1
  34. package/dist/commands/coverage/upload.js +6 -6
  35. package/dist/commands/coverage/upload.js.map +1 -1
  36. package/dist/commands/coverage/utils.d.ts +8 -2
  37. package/dist/commands/coverage/utils.js +119 -4
  38. package/dist/commands/coverage/utils.js.map +1 -1
  39. package/dist/commands/dsyms/interfaces.d.ts +5 -5
  40. package/dist/commands/dsyms/interfaces.js +1 -1
  41. package/dist/commands/dsyms/interfaces.js.map +1 -1
  42. package/dist/commands/dsyms/renderer.d.ts +2 -2
  43. package/dist/commands/dsyms/renderer.js +6 -6
  44. package/dist/commands/dsyms/renderer.js.map +1 -1
  45. package/dist/commands/dsyms/upload.d.ts +17 -12
  46. package/dist/commands/dsyms/upload.js +177 -145
  47. package/dist/commands/dsyms/upload.js.map +1 -1
  48. package/dist/commands/junit/utils.d.ts +2 -2
  49. package/dist/commands/junit/utils.js +9 -11
  50. package/dist/commands/junit/utils.js.map +1 -1
  51. package/dist/commands/lambda/constants.d.ts +0 -7
  52. package/dist/commands/lambda/constants.js +3 -15
  53. package/dist/commands/lambda/constants.js.map +1 -1
  54. package/dist/commands/lambda/flare.js +1 -0
  55. package/dist/commands/lambda/flare.js.map +1 -1
  56. package/dist/commands/lambda/functions/instrument.js +9 -9
  57. package/dist/commands/lambda/functions/instrument.js.map +1 -1
  58. package/dist/commands/lambda/functions/uninstrument.js +6 -6
  59. package/dist/commands/lambda/functions/uninstrument.js.map +1 -1
  60. package/dist/commands/lambda/instrument.d.ts +0 -3
  61. package/dist/commands/lambda/instrument.js +4 -51
  62. package/dist/commands/lambda/instrument.js.map +1 -1
  63. package/dist/commands/react-native/xcode.d.ts +23 -0
  64. package/dist/commands/react-native/xcode.js +166 -10
  65. package/dist/commands/react-native/xcode.js.map +1 -1
  66. package/dist/commands/sarif/renderer.js +2 -2
  67. package/dist/commands/sarif/renderer.js.map +1 -1
  68. package/dist/commands/sbom/api.js +2 -2
  69. package/dist/commands/sbom/api.js.map +1 -1
  70. package/dist/commands/sbom/renderer.js +3 -3
  71. package/dist/commands/sbom/renderer.js.map +1 -1
  72. package/dist/commands/synthetics/api.d.ts +7 -3
  73. package/dist/commands/synthetics/api.js +20 -3
  74. package/dist/commands/synthetics/api.js.map +1 -1
  75. package/dist/commands/synthetics/base-command.d.ts +8 -2
  76. package/dist/commands/synthetics/base-command.js +34 -32
  77. package/dist/commands/synthetics/base-command.js.map +1 -1
  78. package/dist/commands/synthetics/batch.d.ts +4 -3
  79. package/dist/commands/synthetics/batch.js +27 -14
  80. package/dist/commands/synthetics/batch.js.map +1 -1
  81. package/dist/commands/synthetics/errors.d.ts +1 -1
  82. package/dist/commands/synthetics/errors.js +1 -1
  83. package/dist/commands/synthetics/errors.js.map +1 -1
  84. package/dist/commands/synthetics/interfaces.d.ts +13 -2
  85. package/dist/commands/synthetics/interfaces.js.map +1 -1
  86. package/dist/commands/synthetics/reporters/default.js +16 -2
  87. package/dist/commands/synthetics/reporters/default.js.map +1 -1
  88. package/dist/commands/synthetics/reporters/junit.d.ts +1 -0
  89. package/dist/commands/synthetics/reporters/junit.js +2 -0
  90. package/dist/commands/synthetics/reporters/junit.js.map +1 -1
  91. package/dist/commands/synthetics/run-tests-lib.js +17 -3
  92. package/dist/commands/synthetics/run-tests-lib.js.map +1 -1
  93. package/dist/commands/synthetics/test.d.ts +2 -2
  94. package/dist/commands/synthetics/test.js +15 -2
  95. package/dist/commands/synthetics/test.js.map +1 -1
  96. package/dist/commands/synthetics/utils/internal.d.ts +2 -2
  97. package/dist/commands/synthetics/utils/internal.js.map +1 -1
  98. package/dist/commands/synthetics/utils/public.js +9 -2
  99. package/dist/commands/synthetics/utils/public.js.map +1 -1
  100. package/dist/constants.d.ts +7 -0
  101. package/dist/constants.js +14 -1
  102. package/dist/constants.js.map +1 -1
  103. package/dist/helpers/app.d.ts +1 -0
  104. package/dist/helpers/app.js +7 -1
  105. package/dist/helpers/app.js.map +1 -1
  106. package/dist/helpers/flare.d.ts +2 -0
  107. package/dist/helpers/flare.js +13 -1
  108. package/dist/helpers/flare.js.map +1 -1
  109. package/dist/helpers/git/instrument-helpers.d.ts +13 -0
  110. package/dist/helpers/git/instrument-helpers.js +60 -0
  111. package/dist/helpers/git/instrument-helpers.js.map +1 -0
  112. package/dist/helpers/version.d.ts +1 -0
  113. package/dist/helpers/version.js +17 -1
  114. package/dist/helpers/version.js.map +1 -1
  115. package/package.json +4 -1
@@ -17,52 +17,90 @@ const chalk_1 = __importDefault(require("chalk"));
17
17
  const clipanion_1 = require("clipanion");
18
18
  const constants_1 = require("../../constants");
19
19
  const apikey_1 = require("../../helpers/apikey");
20
+ const env_1 = require("../../helpers/env");
21
+ const fips_1 = require("../../helpers/fips");
22
+ const instrument_helpers_1 = require("../../helpers/git/instrument-helpers");
20
23
  const renderer_1 = require("../../helpers/renderer");
21
24
  const utils_1 = require("../../helpers/utils");
25
+ const validation_1 = require("../../helpers/validation");
26
+ const constants_2 = require("./constants");
27
+ const prompt_1 = require("./prompt");
22
28
  const renderer_2 = require("./renderer");
23
29
  const utils_2 = require("./utils");
24
30
  // XXX temporary workaround for @google-cloud/run ESM/CJS module issues
25
31
  const { ServicesClient } = require('@google-cloud/run');
26
32
  // equivalent to google.cloud.run.v2.EmptyDirVolumeSource.Medium.MEMORY
27
33
  const EMPTY_DIR_VOLUME_SOURCE_MEMORY = 1;
28
- const SIDECAR_NAME = 'datadog-sidecar';
29
- const VOLUME_NAME = 'shared-volume';
30
- const VOLUME_MOUNT_PATH = '/shared-volume';
34
+ const DEFAULT_VOLUME_PATH = '/shared-volume';
35
+ const DEFAULT_LOGS_PATH = '/shared-volume/logs/*.log';
36
+ const DEFAULT_HEALTH_CHECK_PORT = 5555;
37
+ const DEFAULT_SIDECAR_IMAGE = 'gcr.io/datadoghq/serverless-init:latest';
38
+ const DEFAULT_ENV_VARS = [
39
+ { name: constants_1.SITE_ENV_VAR, value: constants_1.DATADOG_SITE_US1 },
40
+ { name: constants_1.LOGS_INJECTION_ENV_VAR, value: 'true' },
41
+ { name: constants_1.DD_TRACE_ENABLED_ENV_VAR, value: 'true' },
42
+ { name: constants_1.HEALTH_PORT_ENV_VAR, value: DEFAULT_HEALTH_CHECK_PORT.toString() },
43
+ ];
31
44
  class InstrumentCommand extends clipanion_1.Command {
32
45
  constructor() {
46
+ var _a, _b;
33
47
  super(...arguments);
34
- this.configPath = clipanion_1.Option.String('--config'); // todo
35
- this.ddService = clipanion_1.Option.String('--dd-service, --ddservice');
36
- this.dryRun = clipanion_1.Option.Boolean('-d,--dry,--dry-run', false); // todo
48
+ // private configPath = Option.String('--config') implement if requested by customers
49
+ this.dryRun = clipanion_1.Option.Boolean('-d,--dry,--dry-run', false);
37
50
  this.environment = clipanion_1.Option.String('--env');
38
- this.extraTags = clipanion_1.Option.String('--extra-tags,--extraTags'); // todo
39
- this.project = clipanion_1.Option.String('-p,--project');
40
- this.services = clipanion_1.Option.Array('-s,--service,--services', []);
41
- this.interactive = clipanion_1.Option.Boolean('-i,--interactive', false); // todo
42
- this.logging = clipanion_1.Option.String('--logging'); // todo
43
- this.logLevel = clipanion_1.Option.String('--log-level,--logLevel'); // todo
44
- this.regExPattern = clipanion_1.Option.String('--services-regex,--servicesRegex'); // todo
45
- this.region = clipanion_1.Option.String('-r,--region');
46
- this.sourceCodeIntegration = clipanion_1.Option.Boolean('-s,--source-code-integration,--sourceCodeIntegration', true); // todo
47
- this.uploadGitMetadata = clipanion_1.Option.Boolean('-u,--upload-git-metadata,--uploadGitMetadata', true); // todo
48
- this.tracing = clipanion_1.Option.String('--tracing'); // todo
51
+ this.extraTags = clipanion_1.Option.String('--extra-tags,--extraTags');
52
+ this.project = clipanion_1.Option.String('-p,--project', {
53
+ description: 'GCP project ID',
54
+ });
55
+ this.services = clipanion_1.Option.Array('-s,--service,--services', [], {
56
+ description: 'Cloud Run service(s) to instrument',
57
+ });
58
+ this.interactive = clipanion_1.Option.Boolean('-i,--interactive', false, {
59
+ description: 'Prompt for flags one at a time',
60
+ });
61
+ this.region = clipanion_1.Option.String('-r,--region', {
62
+ description: 'GCP region your service(s) are deployed in',
63
+ });
64
+ this.logLevel = clipanion_1.Option.String('--log-level,--logLevel');
65
+ this.sourceCodeIntegration = clipanion_1.Option.Boolean('--source-code-integration,--sourceCodeIntegration', true);
66
+ this.uploadGitMetadata = clipanion_1.Option.Boolean('-u,--upload-git-metadata,--uploadGitMetadata', true);
67
+ this.tracing = clipanion_1.Option.String('--tracing');
49
68
  this.version = clipanion_1.Option.String('--version');
50
- this.llmobs = clipanion_1.Option.String('--llmobs'); // todo
51
- this.healthCheckPort = clipanion_1.Option.String('--port,--health-check-port,--healthCheckPort'); // todo
52
- this.config = {
53
- services: [],
54
- tracing: 'true',
55
- logging: 'true',
69
+ this.llmobs = clipanion_1.Option.String('--llmobs');
70
+ this.healthCheckPort = clipanion_1.Option.String('--port,--health-check-port,--healthCheckPort');
71
+ this.sidecarImage = clipanion_1.Option.String('--image,--sidecar-image', DEFAULT_SIDECAR_IMAGE, {
72
+ description: `The image to use for the sidecar container. Defaults to '${DEFAULT_SIDECAR_IMAGE}'`,
73
+ });
74
+ this.sidecarName = clipanion_1.Option.String('--sidecar-name', constants_2.DEFAULT_SIDECAR_NAME, {
75
+ description: `(Not recommended) The name to use for the sidecar container. Defaults to '${constants_2.DEFAULT_SIDECAR_NAME}'`,
76
+ });
77
+ this.sharedVolumeName = clipanion_1.Option.String('--shared-volume-name', constants_2.DEFAULT_VOLUME_NAME, {
78
+ description: `(Not recommended) The name to use for the shared volume. Defaults to '${constants_2.DEFAULT_VOLUME_NAME}'`,
79
+ });
80
+ this.sharedVolumePath = clipanion_1.Option.String('--shared-volume-path', DEFAULT_VOLUME_PATH, {
81
+ description: `(Not recommended) The path to use for the shared volume. Defaults to '${DEFAULT_VOLUME_PATH}'`,
82
+ });
83
+ this.logsPath = clipanion_1.Option.String('--logs-path', DEFAULT_LOGS_PATH, {
84
+ description: `(Not recommended) The path to use for the logs. Defaults to '${DEFAULT_LOGS_PATH}'. Must begin with the shared volume path.`,
85
+ });
86
+ this.sidecarCpus = clipanion_1.Option.String('--sidecar-cpus', '1', {
87
+ description: `The number of CPUs to allocate to the sidecar container. Defaults to 1.`,
88
+ });
89
+ this.sidecarMemory = clipanion_1.Option.String('--sidecar-memory', '512Mi', {
90
+ description: `The number of CPUs to allocate to the sidecar container. Defaults to '512Mi'.`,
91
+ });
92
+ this.fips = clipanion_1.Option.Boolean('--fips', false);
93
+ this.fipsIgnoreError = clipanion_1.Option.Boolean('--fips-ignore-error', false);
94
+ this.fipsConfig = {
95
+ fips: (_a = (0, env_1.toBoolean)(process.env[constants_1.FIPS_ENV_VAR])) !== null && _a !== void 0 ? _a : false,
96
+ fipsIgnoreError: (_b = (0, env_1.toBoolean)(process.env[constants_1.FIPS_IGNORE_ERROR_ENV_VAR])) !== null && _b !== void 0 ? _b : false,
56
97
  };
57
98
  }
58
99
  execute() {
59
- var _a, _b, _c, _d, _e;
100
+ var _a, _b;
60
101
  return __awaiter(this, void 0, void 0, function* () {
61
- // TODO FIPS
62
- this.context.stdout.write(chalk_1.default.bold((0, renderer_2.renderCloudRunInstrumentUninstrumentHeader)(Object.getPrototypeOf(this), this.dryRun)));
63
- // TODO resolve config from file
64
- // TODO dry run
65
- // TODO interactive
102
+ (0, fips_1.enableFips)(this.fips || this.fipsConfig.fips, this.fipsIgnoreError || this.fipsConfig.fipsIgnoreError);
103
+ this.context.stdout.write(`\n${(0, renderer_2.dryRunPrefix)(this.dryRun)}🐶 ${chalk_1.default.bold('Instrumenting Cloud Run service(s)')}\n\n`);
66
104
  // Verify DD API Key
67
105
  const isApiKeyValid = yield (0, apikey_1.newApiKeyValidator)({
68
106
  apiKey: process.env.DD_API_KEY,
@@ -72,25 +110,41 @@ class InstrumentCommand extends clipanion_1.Command {
72
110
  this.context.stdout.write((0, renderer_1.renderSoftWarning)(`Invalid API Key stored in the environment variable ${chalk_1.default.bold('DD_API_KEY')}: ${(0, utils_1.maskString)((_b = process.env.DD_API_KEY) !== null && _b !== void 0 ? _b : '')}\nEnsure you copied the value and not the Key ID.`));
73
111
  return 1;
74
112
  }
113
+ if (this.interactive) {
114
+ if (!this.project) {
115
+ this.project = yield (0, prompt_1.requestGCPProject)();
116
+ }
117
+ if (!this.region) {
118
+ this.region = yield (0, prompt_1.requestGCPRegion)();
119
+ }
120
+ if (this.services.length === 0) {
121
+ const serviceName = yield (0, prompt_1.requestServiceName)();
122
+ this.services = [serviceName];
123
+ }
124
+ const envSite = process.env[constants_1.CI_SITE_ENV_VAR];
125
+ if (!(0, validation_1.isValidDatadogSite)(envSite)) {
126
+ process.env[constants_1.CI_SITE_ENV_VAR] = yield (0, prompt_1.requestSite)();
127
+ }
128
+ }
75
129
  // Validate required variables
76
- this.context.stdout.write(chalk_1.default.bold('\n🔍 Verifying command flags...\n'));
77
- const project = (_c = this.project) !== null && _c !== void 0 ? _c : this.config.project;
78
- if (!project) {
79
- this.context.stdout.write(chalk_1.default.yellow('No project specified for instrumentation. Please use the --project flag.\n'));
130
+ if (!this.project) {
131
+ this.context.stdout.write(chalk_1.default.yellow('Invalid or missing project. Please use the --project flag.\n'));
80
132
  }
81
- const services = this.services.length > 0 ? this.services : this.config.services;
82
- if (services.length === 0) {
83
- this.context.stdout.write(chalk_1.default.yellow('No services specified for instrumentation. Please use the --service flag.\n'));
133
+ if (this.services.length === 0) {
134
+ this.context.stdout.write(chalk_1.default.yellow('Invalid or missing service(s). Please use the --service flag.\n'));
84
135
  }
85
- const region = (_d = this.region) !== null && _d !== void 0 ? _d : this.config.region;
86
- if (!region) {
87
- this.context.stdout.write(chalk_1.default.yellow('No region specified for instrumentation. Please use the --region flag.\n'));
136
+ if (!this.region) {
137
+ this.context.stdout.write(chalk_1.default.yellow('Invalid or missing region. Please use the --region flag.\n'));
88
138
  }
89
- const ddService = (_e = this.ddService) !== null && _e !== void 0 ? _e : process.env[constants_1.SERVICE_ENV_VAR];
139
+ const ddService = process.env[constants_1.SERVICE_ENV_VAR];
90
140
  if (!ddService) {
91
- this.context.stdout.write(chalk_1.default.yellow('No DD_SERVICE specified for instrumentation. Please use the DD_SERVICE env var or the --dd-service flag.\n'));
141
+ this.context.stdout.write((0, renderer_1.renderSoftWarning)('No DD_SERVICE env var found. Will default to the service name.'));
92
142
  }
93
- if (!project || !services || !services.length || !region || !ddService) {
143
+ if (this.extraTags && !this.extraTags.match(constants_1.EXTRA_TAGS_REG_EXP)) {
144
+ this.context.stderr.write((0, renderer_1.renderError)('Extra tags do not comply with the <key>:<value> array.\n'));
145
+ return 1;
146
+ }
147
+ if (!this.project || !this.services || !this.services.length || !this.region) {
94
148
  return 1;
95
149
  }
96
150
  this.context.stdout.write(chalk_1.default.green('✔ Required flags verified\n'));
@@ -101,46 +155,54 @@ class InstrumentCommand extends clipanion_1.Command {
101
155
  this.context.stderr.write((0, renderer_2.renderAuthenticationInstructions)());
102
156
  return 1;
103
157
  }
104
- this.context.stdout.write(chalk_1.default.green('✔ GCP credentials verified!\n'));
158
+ this.context.stdout.write(chalk_1.default.green('✔ GCP credentials verified!\n\n'));
159
+ // Source code integration
160
+ if (this.sourceCodeIntegration) {
161
+ try {
162
+ const gitData = yield (0, instrument_helpers_1.getGitData)();
163
+ if (this.uploadGitMetadata) {
164
+ yield (0, instrument_helpers_1.uploadGitData)(this.context);
165
+ }
166
+ if (this.extraTags) {
167
+ this.extraTags += `,git.commit.sha:${gitData.commitSha},git.repository_url:${gitData.gitRemote}`;
168
+ }
169
+ else {
170
+ this.extraTags = `git.commit.sha:${gitData.commitSha},git.repository_url:${gitData.gitRemote}`;
171
+ }
172
+ }
173
+ catch (err) {
174
+ this.context.stdout.write((0, renderer_1.renderSoftWarning)(`Couldn't add source code integration, continuing without it. ${err}`));
175
+ }
176
+ }
105
177
  // Instrument services with sidecar
106
178
  try {
107
- yield this.instrumentSidecar(project, services, region, ddService);
179
+ yield this.instrumentSidecar(this.project, this.services, this.region, ddService);
108
180
  }
109
181
  catch (error) {
110
- this.context.stderr.write(chalk_1.default.red(`\nInstrumentation failed: ${error}`));
182
+ this.context.stderr.write((0, renderer_2.dryRunPrefix)(this.dryRun) + (0, renderer_1.renderError)(`Uninstrumentation failed: ${error}\n`));
111
183
  return 1;
112
184
  }
113
- this.context.stdout.write('\n✅ Cloud Run instrumentation completed successfully!\n');
185
+ if (!this.dryRun) {
186
+ this.context.stdout.write('\n✅ Cloud Run instrumentation completed successfully!\n');
187
+ }
114
188
  return 0;
115
189
  });
116
190
  }
117
191
  instrumentSidecar(project, services, region, ddService) {
118
192
  return __awaiter(this, void 0, void 0, function* () {
119
193
  const client = new ServicesClient();
120
- this.context.stdout.write(chalk_1.default.bold('\n⬇️ Fetching existing service configurations from Cloud Run...\n'));
121
- const existingServiceConfigs = [];
122
- for (const serviceName of services) {
123
- const servicePath = client.servicePath(project, region, serviceName);
124
- const existingService = yield (0, renderer_2.withSpinner)(`Fetching configuration for ${chalk_1.default.bold(serviceName)}...`, () => __awaiter(this, void 0, void 0, function* () {
125
- try {
126
- const [serv] = yield client.getService({ name: servicePath });
127
- return serv;
128
- }
129
- catch (error) {
130
- throw new Error(`Service ${serviceName} not found in project ${project}, region ${region}.\n\nNo services were instrumented.\n`);
131
- }
132
- }), `Fetched service configuration for ${chalk_1.default.bold(serviceName)}`);
133
- existingServiceConfigs.push(existingService);
134
- }
135
- this.context.stdout.write(chalk_1.default.bold('\n🚀 Instrumenting Cloud Run services with sidecar...\n'));
194
+ this.context.stdout.write(chalk_1.default.bold(`\n${(0, renderer_2.dryRunPrefix)(this.dryRun)}⬇️ Fetching existing service configurations from Cloud Run...\n`));
195
+ const existingServiceConfigs = yield (0, utils_2.fetchServiceConfigs)(client, project, region, services);
196
+ this.context.stdout.write(chalk_1.default.bold(`\n${(0, renderer_2.dryRunPrefix)(this.dryRun)}🚀 Instrumenting Cloud Run services with sidecar...\n`));
136
197
  for (let i = 0; i < existingServiceConfigs.length; i++) {
137
198
  const serviceConfig = existingServiceConfigs[i];
138
199
  const serviceName = services[i];
139
200
  try {
140
- yield this.instrumentService(client, serviceConfig, serviceName, ddService);
201
+ const actualDDService = ddService !== null && ddService !== void 0 ? ddService : serviceName;
202
+ yield this.instrumentService(client, serviceConfig, serviceName, actualDDService);
141
203
  }
142
204
  catch (error) {
143
- this.context.stderr.write(chalk_1.default.red(`Failed to instrument service ${serviceName}: ${error}\n`));
205
+ this.context.stderr.write((0, renderer_2.dryRunPrefix)(this.dryRun) + (0, renderer_1.renderError)(`Failed to instrument service ${serviceName}: ${error}\n`));
144
206
  throw error;
145
207
  }
146
208
  }
@@ -149,43 +211,121 @@ class InstrumentCommand extends clipanion_1.Command {
149
211
  instrumentService(client, existingService, serviceName, ddService) {
150
212
  return __awaiter(this, void 0, void 0, function* () {
151
213
  const updatedService = this.createInstrumentedServiceConfig(existingService, ddService);
152
- yield (0, renderer_2.withSpinner)(`Instrumenting service ${serviceName}...`, () => __awaiter(this, void 0, void 0, function* () {
214
+ this.context.stdout.write((0, utils_2.generateConfigDiff)(existingService, updatedService));
215
+ if (this.dryRun) {
216
+ this.context.stdout.write(`\n\n${(0, renderer_2.dryRunPrefix)(this.dryRun)}Would have updated service ${chalk_1.default.bold(serviceName)} with the above changes.\n`);
217
+ return;
218
+ }
219
+ else if (this.interactive) {
220
+ const confirmed = yield (0, prompt_1.requestConfirmation)('\nDo you want to apply the changes?');
221
+ if (!confirmed) {
222
+ throw new Error('Instrumentation cancelled by user.');
223
+ }
224
+ }
225
+ yield (0, renderer_2.withSpinner)(`Instrumenting service ${chalk_1.default.bold(serviceName)}...`, () => __awaiter(this, void 0, void 0, function* () {
153
226
  const [operation] = yield client.updateService({
154
227
  service: updatedService,
155
228
  });
156
229
  yield operation.promise();
157
- }), `Instrumented service ${serviceName}`);
230
+ }), `Instrumented service ${chalk_1.default.bold(serviceName)}`);
158
231
  });
159
232
  }
160
233
  createInstrumentedServiceConfig(service, ddService) {
161
234
  const template = service.template || {};
162
235
  const containers = template.containers || [];
163
236
  const volumes = template.volumes || [];
164
- // Check if sidecar already exists
165
- const existingSidecarIndex = containers.findIndex((c) => c.name === SIDECAR_NAME);
237
+ const existingSidecarContainer = containers.find((c) => c.name === this.sidecarName);
238
+ const newSidecarContainer = this.buildSidecarContainer(existingSidecarContainer, ddService);
239
+ // Update all app containers to add volume mounts and env vars if they don't have them
240
+ const updatedContainers = containers.map((container) => {
241
+ if (container.name === this.sidecarName) {
242
+ return newSidecarContainer;
243
+ }
244
+ return this.updateAppContainer(container, ddService);
245
+ });
246
+ // Add sidecar if it doesn't exist
247
+ if (!existingSidecarContainer) {
248
+ updatedContainers.push(newSidecarContainer);
249
+ }
250
+ // Add shared volume if it doesn't exist
251
+ const hasSharedVolume = volumes.some((volume) => volume.name === this.sharedVolumeName);
252
+ const updatedVolumes = hasSharedVolume
253
+ ? volumes
254
+ : [
255
+ ...volumes,
256
+ {
257
+ name: this.sharedVolumeName,
258
+ emptyDir: {
259
+ medium: EMPTY_DIR_VOLUME_SOURCE_MEMORY,
260
+ },
261
+ },
262
+ ];
263
+ return Object.assign(Object.assign({}, service), { template: Object.assign(Object.assign({}, template), { containers: updatedContainers, volumes: updatedVolumes,
264
+ // Let GCR generate the next revision name
265
+ revision: undefined }) });
266
+ }
267
+ buildSidecarContainer(existingSidecarContainer, ddService) {
268
+ var _a, _b, _c;
269
+ const newEnvVars = {};
270
+ for (const envVar of (_a = existingSidecarContainer === null || existingSidecarContainer === void 0 ? void 0 : existingSidecarContainer.env) !== null && _a !== void 0 ? _a : []) {
271
+ newEnvVars[envVar.name] = envVar.value;
272
+ }
273
+ // Add these env vars to the container if they don't already exist,
274
+ // but leave them unchanged if they already exist in the container.
275
+ for (const { name, value } of DEFAULT_ENV_VARS) {
276
+ if (!(name in newEnvVars)) {
277
+ newEnvVars[name] = value;
278
+ }
279
+ }
280
+ // Overwrite existing env vars with these if they already exist
281
+ // and add them to the container if they don't exist yet.
282
+ newEnvVars[constants_1.API_KEY_ENV_VAR] = (_b = process.env[constants_1.API_KEY_ENV_VAR]) !== null && _b !== void 0 ? _b : '';
283
+ newEnvVars[constants_1.SERVICE_ENV_VAR] = ddService;
284
+ if (process.env[constants_1.SITE_ENV_VAR]) {
285
+ newEnvVars[constants_1.SITE_ENV_VAR] = process.env[constants_1.SITE_ENV_VAR];
286
+ }
287
+ if (this.tracing) {
288
+ newEnvVars[constants_1.DD_TRACE_ENABLED_ENV_VAR] = this.tracing;
289
+ }
290
+ if (this.environment) {
291
+ newEnvVars[constants_1.ENVIRONMENT_ENV_VAR] = this.environment;
292
+ }
293
+ if (this.version) {
294
+ newEnvVars[constants_1.VERSION_ENV_VAR] = this.version;
295
+ }
296
+ if (this.logLevel) {
297
+ newEnvVars[constants_1.DD_LOG_LEVEL_ENV_VAR] = this.logLevel;
298
+ }
299
+ if (this.extraTags) {
300
+ newEnvVars[constants_1.DD_TAGS_ENV_VAR] = this.extraTags;
301
+ }
302
+ newEnvVars[constants_1.LOGS_PATH_ENV_VAR] = this.logsPath;
303
+ // If port is specified, overwrite any existing value
304
+ // If port is not specified but already exists, leave the existing value unchanged
305
+ // If port is not specified and does not exist, default to 5555
306
+ let healthCheckPort = (_c = newEnvVars[constants_1.HEALTH_PORT_ENV_VAR]) !== null && _c !== void 0 ? _c : DEFAULT_HEALTH_CHECK_PORT.toString();
307
+ if (this.healthCheckPort) {
308
+ const newHealthCheckPort = Number(this.healthCheckPort);
309
+ if (!Number.isNaN(newHealthCheckPort)) {
310
+ healthCheckPort = newHealthCheckPort.toString();
311
+ newEnvVars[constants_1.HEALTH_PORT_ENV_VAR] = healthCheckPort;
312
+ }
313
+ }
314
+ const newEnv = Object.entries(newEnvVars).map(([name, value]) => ({ name, value }));
166
315
  // Create sidecar container with volume mount and environment variables
167
- const sidecarContainer = {
168
- name: SIDECAR_NAME,
169
- image: 'gcr.io/datadoghq/serverless-init:latest',
316
+ return {
317
+ name: this.sidecarName,
318
+ image: this.sidecarImage,
170
319
  volumeMounts: [
171
320
  {
172
- name: VOLUME_NAME,
173
- mountPath: VOLUME_MOUNT_PATH,
321
+ name: this.sharedVolumeName,
322
+ mountPath: this.sharedVolumePath,
174
323
  },
175
324
  ],
176
- env: [
177
- { name: constants_1.SITE_ENV_VAR, value: process.env.DD_SITE || constants_1.DATADOG_SITE_US1 },
178
- { name: constants_1.LOGS_PATH_ENV_VAR, value: `${VOLUME_MOUNT_PATH}/logs/*.log` },
179
- { name: constants_1.API_KEY_ENV_VAR, value: process.env.DD_API_KEY },
180
- { name: constants_1.HEALTH_PORT_ENV_VAR, value: '12345' },
181
- { name: constants_1.LOGS_INJECTION_ENV_VAR, value: 'true' },
182
- { name: constants_1.SERVICE_ENV_VAR, value: ddService },
183
- ...(this.environment ? [{ name: constants_1.ENVIRONMENT_ENV_VAR, value: this.environment }] : []),
184
- ...(this.version ? [{ name: constants_1.VERSION_ENV_VAR, value: this.version }] : []),
185
- ],
325
+ env: newEnv,
186
326
  startupProbe: {
187
327
  tcpSocket: {
188
- port: 12345,
328
+ port: healthCheckPort,
189
329
  },
190
330
  initialDelaySeconds: 0,
191
331
  periodSeconds: 10,
@@ -194,66 +334,48 @@ class InstrumentCommand extends clipanion_1.Command {
194
334
  },
195
335
  resources: {
196
336
  limits: {
197
- memory: '512Mi',
198
- cpu: '1',
337
+ memory: this.sidecarMemory,
338
+ cpu: this.sidecarCpus,
199
339
  },
200
340
  },
201
341
  };
202
- // Update all containers to add volume mounts if they don't have them
203
- const updatedContainers = containers.map((container) => {
204
- if (container.name === SIDECAR_NAME) {
205
- return sidecarContainer;
206
- }
207
- // Add volume mount to main containers if not already present
208
- const existingVolumeMounts = container.volumeMounts || [];
209
- const hasSharedVolumeMount = existingVolumeMounts.some((mount) => mount.name === VOLUME_NAME);
210
- const existingEnvVars = container.env || [];
211
- const updatedContainer = Object.assign({}, container);
212
- if (!hasSharedVolumeMount) {
213
- updatedContainer.volumeMounts = [
214
- ...existingVolumeMounts,
215
- {
216
- name: VOLUME_NAME,
217
- mountPath: VOLUME_MOUNT_PATH,
218
- },
219
- ];
220
- }
221
- // Update environment variables
222
- const updatedEnvVars = [...existingEnvVars];
223
- // Replace DD_SERVICE with new value
224
- const serviceEnvIndex = updatedEnvVars.findIndex((envVar) => envVar.name === constants_1.SERVICE_ENV_VAR);
225
- if (serviceEnvIndex >= 0) {
226
- updatedEnvVars[serviceEnvIndex] = { name: constants_1.SERVICE_ENV_VAR, value: ddService };
227
- }
228
- else {
229
- updatedEnvVars.push({ name: constants_1.SERVICE_ENV_VAR, value: ddService });
230
- }
231
- // Default to DD_LOGS_INJECTION=true, but don't overwrite existing value
232
- const hasLogsInjection = updatedEnvVars.some((envVar) => envVar.name === constants_1.LOGS_INJECTION_ENV_VAR);
233
- if (!hasLogsInjection) {
234
- updatedEnvVars.push({ name: constants_1.LOGS_INJECTION_ENV_VAR, value: 'true' });
235
- }
236
- updatedContainer.env = updatedEnvVars;
237
- return updatedContainer;
238
- });
239
- // Add sidecar if it doesn't exist
240
- if (existingSidecarIndex < 0) {
241
- updatedContainers.push(sidecarContainer);
242
- }
243
- // Add shared volume if it doesn't exist
244
- const hasSharedVolume = volumes.some((volume) => volume.name === VOLUME_NAME);
245
- const updatedVolumes = hasSharedVolume
246
- ? volumes
247
- : [
248
- ...volumes,
342
+ }
343
+ // Add volume mount and update required env vars
344
+ updateAppContainer(appContainer, ddService) {
345
+ var _a;
346
+ const existingVolumeMounts = appContainer.volumeMounts || [];
347
+ const hasSharedVolumeMount = existingVolumeMounts.some((mount) => mount.name === this.sharedVolumeName);
348
+ const existingEnvVars = appContainer.env || [];
349
+ const updatedContainer = Object.assign({}, appContainer);
350
+ if (!hasSharedVolumeMount) {
351
+ updatedContainer.volumeMounts = [
352
+ ...existingVolumeMounts,
249
353
  {
250
- name: VOLUME_NAME,
251
- emptyDir: {
252
- medium: EMPTY_DIR_VOLUME_SOURCE_MEMORY,
253
- },
354
+ name: this.sharedVolumeName,
355
+ mountPath: this.sharedVolumePath,
254
356
  },
255
357
  ];
256
- return Object.assign(Object.assign({}, service), { template: Object.assign(Object.assign({}, template), { containers: updatedContainers, volumes: updatedVolumes }) });
358
+ }
359
+ // Update environment variables
360
+ const newEnvVars = {};
361
+ for (const { name, value } of existingEnvVars) {
362
+ newEnvVars[name] = value;
363
+ }
364
+ // Default to DD_LOGS_INJECTION=true, but don't overwrite existing value
365
+ if (!(constants_1.LOGS_INJECTION_ENV_VAR in newEnvVars)) {
366
+ newEnvVars[constants_1.LOGS_INJECTION_ENV_VAR] = 'true';
367
+ }
368
+ // Replace or add other env vars
369
+ newEnvVars[constants_1.SERVICE_ENV_VAR] = ddService;
370
+ newEnvVars[constants_1.API_KEY_ENV_VAR] = (_a = process.env[constants_1.API_KEY_ENV_VAR]) !== null && _a !== void 0 ? _a : '';
371
+ if (this.llmobs) {
372
+ newEnvVars[constants_1.DD_LLMOBS_ENABLED_ENV_VAR] = 'true';
373
+ newEnvVars[constants_1.DD_LLMOBS_ML_APP_ENV_VAR] = this.llmobs;
374
+ // serverless-init is installed, so agentless mode should be false
375
+ newEnvVars[constants_1.DD_LLMOBS_AGENTLESS_ENABLED_ENV_VAR] = 'false';
376
+ }
377
+ updatedContainer.env = Object.entries(newEnvVars).map(([name, value]) => ({ name, value }));
378
+ return updatedContainer;
257
379
  }
258
380
  }
259
381
  exports.InstrumentCommand = InstrumentCommand;
@@ -1 +1 @@
1
- {"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../src/commands/cloud-run/instrument.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,kDAAyB;AACzB,yCAAyC;AAEzC,+CAUwB;AACxB,iDAAuD;AACvD,qDAAwD;AACxD,+CAA8C;AAG9C,yCAAoH;AACpH,mCAA2C;AAE3C,uEAAuE;AACvE,MAAM,EAAC,cAAc,EAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AAErD,uEAAuE;AACvE,MAAM,8BAA8B,GAAG,CAAC,CAAA;AAExC,MAAM,YAAY,GAAG,iBAAiB,CAAA;AACtC,MAAM,WAAW,GAAG,eAAe,CAAA;AACnC,MAAM,iBAAiB,GAAG,gBAAgB,CAAA;AAE1C,MAAa,i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AAC,IAAI,KAAK,WAAW,CAAC,CAAA;QAC7E,MAAM,cAAc,GAAG,eAAe;YACpC,CAAC,CAAC,OAAO;YACT,CAAC,CAAC;gBACE,GAAG,OAAO;gBACV;oBACE,IAAI,EAAE,WAAW;oBACjB,QAAQ,EAAE;wBACR,MAAM,EAAE,8BAA8B;qBACvC;iBACF;aACF,CAAA;QAEL,uCACK,OAAO,KACV,QAAQ,kCACH,QAAQ,KACX,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,cAAc,OAE1B;IACH,CAAC;;AAvSH,8CAwSC;AAvSC,oEAAoE;AACtD,uBAAK,GAAG,CAAC,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,AAAhC,CAAgC;AAErC,uBAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,mDAAmD;CACjE,CAAC,AAHiB,CAGjB"}
1
+ {"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../src/commands/cloud-run/instrument.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,kDAAyB;AACzB,yCAAyC;AAEzC,+CAoBwB;AACxB,iDAAuD;AACvD,2CAA2C;AAC3C,6CAA6C;AAC7C,6EAA8E;AAC9E,qDAAqE;AACrE,+CAA8C;AAC9C,yDAA2D;AAE3D,2CAAqE;AACrE,qCAAkH;AAClH,yCAAsF;AACtF,mCAAoF;AAEpF,uEAAuE;AACvE,MAAM,EAAC,cAAc,EAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AAErD,uEAAuE;AACvE,MAAM,8BAA8B,GAAG,CAAC,CAAA;AAExC,MAAM,mBAAmB,GAAG,gBAAgB,CAAA;AAC5C,MAAM,iBAAiB,GAAG,2BAA2B,CAAA;AACrD,MAAM,yBAAyB,GAAG,IAAI,CAAA;AACtC,MAAM,qBAAqB,GAAG,yCAAyC,CAAA;AAEvE,MAAM,gBAAgB,GAAc;IAClC,EAAC,IAAI,EAAE,wB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BAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,mDAAmD;CACjE,CAAC,AAHiB,CAGjB"}
@@ -25,25 +25,6 @@ export interface LogConfig {
25
25
  fileName: string;
26
26
  severityFilter?: string;
27
27
  }
28
- /**
29
- * Configuration options provided by the user through
30
- * the CLI in order to instrument properly.
31
- */
32
- export interface CloudRunConfigOptions {
33
- project?: string;
34
- environment?: string;
35
- extraTags?: string;
36
- services: string[];
37
- interactive?: boolean;
38
- logging?: string;
39
- logLevel?: string;
40
- profile?: string;
41
- region?: string;
42
- service?: string;
43
- tracing?: string;
44
- version?: string;
45
- llmobs?: string;
46
- }
47
28
  /**
48
29
  * Interface for Unified Service Tagging.
49
30
  *
@@ -0,0 +1,5 @@
1
+ export declare const requestGCPProject: () => Promise<string>;
2
+ export declare const requestGCPRegion: (defaultRegion?: string) => Promise<string>;
3
+ export declare const requestServiceName: () => Promise<string>;
4
+ export declare const requestSite: () => Promise<string>;
5
+ export declare const requestConfirmation: (message: string, defaultValue?: boolean) => Promise<boolean>;