@datadog/datadog-ci-plugin-container-app 5.22.1 → 5.24.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.
package/README.md CHANGED
@@ -35,6 +35,21 @@ datadog-ci container-app instrument \
35
35
  --env prod \
36
36
  --version 1.0.0
37
37
 
38
+ # Detect the application language and add its tracer automatically
39
+ datadog-ci container-app instrument \
40
+ --subscription-id <subscription-id> \
41
+ --resource-group <resource-group-name> \
42
+ --name <container-app-name> \
43
+ --tracing inject
44
+
45
+ # Add only the Python tracer
46
+ datadog-ci container-app instrument \
47
+ --subscription-id <subscription-id> \
48
+ --resource-group <resource-group-name> \
49
+ --name <container-app-name> \
50
+ --tracing inject \
51
+ --language python
52
+
38
53
  # Dry run to preview changes
39
54
  datadog-ci container-app instrument \
40
55
  --subscription-id <subscription-id> \
@@ -43,6 +58,22 @@ datadog-ci container-app instrument \
43
58
  --dry-run
44
59
  ```
45
60
 
61
+ ### Automatic APM instrumentation
62
+
63
+ Use `--tracing inject` to detect the application language and add its tracer without rebuilding the application image. Add `--language <language>` to copy only one tracer. Supported language values are `java`, `nodejs`, `csharp`, `python`, `ruby`, and `php`. The command copies the tracer through an init container and keeps the Datadog sidecar for trace transport.
64
+
65
+ `--tracer-version` and `--tracer-libc` require `--language`. Single-language injection uses the `latest` tracer version and `glibc` by default. Ruby injection does not support musl, and .NET tracer versions before 3.0 are not supported. Runtime support follows the [APM compatibility requirements](https://docs.datadoghq.com/tracing/trace_collection/compatibility/); `latest` can drop runtimes after they reach end of life.
66
+
67
+ Go tracers cannot be injected. Install `dd-trace-go` in the application image, and use `--tracing manual`.
68
+
69
+ Automatic instrumentation can increase cold-start delays when the app scales to zero. Automatic language detection copies a larger composite tracer image than selecting one language. For scale-to-zero workloads, install the tracer in the application image, and use `--tracing manual`.
70
+
71
+ For a Container App with multiple application containers, use `--container-name` to select one container. This differs from `--name`, which selects the Container App resource.
72
+
73
+ Tracing defaults to `manual`, which uses a tracer already installed in the application image. Use `--tracing disabled` to turn tracing off.
74
+
75
+ You can use any nonempty `--language` value without `--tracing inject` to set `DD_SOURCE` for log parsing. With `--tracing inject`, use Java, Node.js, .NET, Python, Ruby, or PHP.
76
+
46
77
  ### `uninstrument`
47
78
 
48
79
  Run `datadog-ci container-app uninstrument` to remove Datadog instrumentation from an Azure Container App. This command reverts the Container App configuration to its pre-instrumented state by removing the Datadog sidecar and associated environment variables.
@@ -102,7 +133,7 @@ You must expose these environment variables in the environment where you are run
102
133
  Configuration can be done using command-line arguments or a JSON configuration file (see the next section).
103
134
 
104
135
  #### `instrument`
105
- You can pass the following arguments to `instrument` to specify its behavior. These arguments override the values set in the configuration file, if any.
136
+ You can pass the following arguments to `instrument` to specify its behavior. Values in the configuration file override command-line arguments.
106
137
 
107
138
  <!-- BEGIN_USAGE:instrument -->
108
139
  | Argument | Shorthand | Description | Default |
@@ -124,6 +155,11 @@ You can pass the following arguments to `instrument` to specify its behavior. Th
124
155
  | `--sidecar-cpu` | | The number of CPUs to allocate to the sidecar container. | `0.5` |
125
156
  | `--sidecar-memory` | | The amount of memory (in GiB) to allocate to the sidecar container. | `1` |
126
157
  | `--sidecar-image` | | Override to pin a specific version tag or to use a mirrored image from a custom registry (e.g., ACR) to avoid pull rate limits. | `index.docker.io/datadog/serverless-init:latest` |
158
+ | `--tracing` | | Configure APM instrumentation. Use `manual` when the tracer is installed, `inject` to detect the language and add a tracer automatically, or `disabled` to turn tracing off. Add `--language` with `inject` to select one tracer. Defaults to `manual`. | |
159
+ | `--language` | | Set the application language for log parsing. With `--tracing inject`, this selects one tracer instead of detecting the language automatically. Supported injection values: `java`, `nodejs`, `csharp`, `python`, `ruby`, `php`. | |
160
+ | `--tracer-version` | | Set the tracer image tag for automatic instrumentation with `--language`. | `latest` |
161
+ | `--tracer-libc` | | Set the C standard library used by the application image with `--language`. Possible values: "glibc", "musl". | `glibc` |
162
+ | `--container-name` | | Select the application container to instrument when the Container App has multiple application containers. | |
127
163
  | `--source-code-integration` or `--sourceCodeIntegration` | | Whether to enable the Datadog Source Code integration. This tags your service(s) with the Git repository and the latest commit hash of the local directory. Specify `--no-source-code-integration` to disable. | `true` |
128
164
  | `--upload-git-metadata` or `--uploadGitMetadata` | | Whether to enable Git metadata uploading, as a part of the source code integration. Git metadata uploading is only required if you don't have the Datadog GitHub integration installed. Specify `--no-upload-git-metadata` to disable. | `true` |
129
165
  | `--extra-tags` or `--extraTags` | | Additional tags to add to the app in the format "key1:value1,key2:value2". | |
@@ -160,6 +196,8 @@ Instead of supplying arguments, you can create a configuration file in your proj
160
196
  "environment": "prod",
161
197
  "version": "1.0.0",
162
198
  "logPath": "/custom-path/*.log",
199
+ "tracing": "inject",
200
+ "language": "python",
163
201
  "sourceCodeIntegration": true,
164
202
  "uploadGitMetadata": true,
165
203
  "extraTags": "team:backend,project:api",
@@ -181,7 +219,8 @@ Alternatively, you can use resource IDs:
181
219
  "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.App/containerApps/<container-app-name2>"
182
220
  ],
183
221
  "service": "my-service",
184
- "environment": "prod"
222
+ "environment": "prod",
223
+ "tracing": "manual"
185
224
  }
186
225
  }
187
226
  ```
package/dist/bundle.d.ts CHANGED
@@ -6883,6 +6883,83 @@ declare class ContainerAppsAPIClient extends ServiceClient {
6883
6883
  logicApps: LogicApps;
6884
6884
  }
6885
6885
  //#endregion
6886
+ //#region ../base/dist/helpers/serverless/ssi/env.d.ts
6887
+ type EnvFragmentBase = {
6888
+ name: string;
6889
+ value: string;
6890
+ maxLength?: number;
6891
+ };
6892
+ type EnvSeparator = ' ' | ':' | ',';
6893
+ type AppendedEnvFragment = EnvFragmentBase & ({
6894
+ mode: 'append';
6895
+ separator?: EnvSeparator;
6896
+ preserveLeadingEmpty?: never;
6897
+ } | {
6898
+ mode: 'append';
6899
+ separator: EnvSeparator;
6900
+ preserveLeadingEmpty: true;
6901
+ });
6902
+ type PositionedEnvFragment = AppendedEnvFragment | (EnvFragmentBase & {
6903
+ mode: 'prepend';
6904
+ separator?: EnvSeparator;
6905
+ preserveLeadingEmpty?: never;
6906
+ });
6907
+ type ScalarEnvFragment = EnvFragmentBase & {
6908
+ mode: 'set-if-absent';
6909
+ separator?: never;
6910
+ preserveLeadingEmpty?: never;
6911
+ };
6912
+ /**
6913
+ * An environment value owned by instrumentation. `mode` controls placement, `separator` defines exact entry
6914
+ * boundaries, and `maxLength` limits the merged value in bytes. `preserveLeadingEmpty` retains the default entry in
6915
+ * path lists such as `PHP_INI_SCAN_DIR`.
6916
+ */
6917
+ type EnvFragment = PositionedEnvFragment | ScalarEnvFragment;
6918
+ //#endregion
6919
+ //#region ../base/dist/helpers/serverless/ssi/tracer.d.ts
6920
+ declare const LANGUAGE_METADATA: {
6921
+ readonly java: {
6922
+ readonly tracerLanguage: "java";
6923
+ readonly repository: "dd-trace-java";
6924
+ };
6925
+ readonly nodejs: {
6926
+ readonly tracerLanguage: "js";
6927
+ readonly repository: "dd-trace-js";
6928
+ };
6929
+ readonly csharp: {
6930
+ readonly tracerLanguage: "dotnet";
6931
+ readonly repository: "dd-trace-dotnet";
6932
+ };
6933
+ readonly python: {
6934
+ readonly tracerLanguage: "python";
6935
+ readonly repository: "dd-trace-py";
6936
+ };
6937
+ readonly ruby: {
6938
+ readonly tracerLanguage: "ruby";
6939
+ readonly repository: "dd-trace-rb";
6940
+ };
6941
+ readonly php: {
6942
+ readonly tracerLanguage: "php";
6943
+ readonly repository: "dd-trace-php";
6944
+ };
6945
+ };
6946
+ type Language = keyof typeof LANGUAGE_METADATA;
6947
+ //#endregion
6948
+ //#region ../base/dist/helpers/serverless/ssi/injection-spec.d.ts
6949
+ declare const LIBCS: readonly ["glibc", "musl"];
6950
+ type Libc = (typeof LIBCS)[number];
6951
+ /** Alternative paths for one required artifact; at least one must exist. */
6952
+ type RequiredArtifact = readonly [string, ...string[]];
6953
+ interface LanguageInjectionSpec {
6954
+ readonly image: string;
6955
+ readonly artifacts: readonly [RequiredArtifact, ...RequiredArtifact[]];
6956
+ readonly env: readonly EnvFragment[];
6957
+ }
6958
+ //#endregion
6959
+ //#region ../base/dist/helpers/serverless/ssi/tracing.d.ts
6960
+ declare const TRACING_MODES: readonly ["manual", "disabled", "inject"];
6961
+ type TracingMode = (typeof TRACING_MODES)[number];
6962
+ //#endregion
6886
6963
  //#region ../../node_modules/typanion/lib/types.d.ts
6887
6964
  declare type BoundCoercionFn = () => BoundCoercionFn;
6888
6965
  declare type CoercionFn = (v: any) => BoundCoercionFn;
@@ -7251,6 +7328,11 @@ type ContainerAppConfigOptions = Partial<{
7251
7328
  sharedVolumePath: string;
7252
7329
  logsPath: string;
7253
7330
  envVars: string[];
7331
+ tracing: TracingMode;
7332
+ language: string;
7333
+ tracerVersion: string;
7334
+ tracerLibc: Libc;
7335
+ containerName: string;
7254
7336
  sourceCodeIntegration: boolean;
7255
7337
  uploadGitMetadata: boolean;
7256
7338
  extraTags: string;
@@ -7286,6 +7368,11 @@ declare class ContainerAppInstrumentCommand extends ContainerAppCommand {
7286
7368
  private sidecarCpu;
7287
7369
  private sidecarMemory;
7288
7370
  private sidecarImage;
7371
+ private tracing;
7372
+ private language;
7373
+ private tracerVersion;
7374
+ private tracerLibc;
7375
+ private containerName;
7289
7376
  private sourceCodeIntegration;
7290
7377
  private uploadGitMetadata;
7291
7378
  private extraTags;
@@ -7293,20 +7380,46 @@ declare class ContainerAppInstrumentCommand extends ContainerAppCommand {
7293
7380
  execute(): Promise<number | void>;
7294
7381
  }
7295
7382
  //#endregion
7383
+ //#region ../base/dist/helpers/serverless/ssi/composite.d.ts
7384
+ interface CompositeInjectionSpec {
7385
+ readonly image: string;
7386
+ readonly mountPath: string;
7387
+ readonly env: readonly EnvFragment[];
7388
+ }
7389
+ //#endregion
7390
+ //#region src/ssi.d.ts
7391
+ type SsiConfigResult = ({
7392
+ kind: 'errors';
7393
+ errors: readonly string[];
7394
+ } | {
7395
+ kind: 'no-injection';
7396
+ tracing: Exclude<TracingMode, 'inject'>;
7397
+ } | {
7398
+ kind: 'single-language';
7399
+ language: Language;
7400
+ libc: Libc;
7401
+ spec: LanguageInjectionSpec;
7402
+ } | {
7403
+ kind: 'multi-language';
7404
+ spec: CompositeInjectionSpec;
7405
+ }) & {
7406
+ warnings: readonly string[];
7407
+ };
7408
+ //#endregion
7296
7409
  //#region src/commands/instrument.d.ts
7297
7410
  declare class PluginCommand$1 extends ContainerAppInstrumentCommand {
7298
7411
  private cred;
7299
7412
  private tagClient;
7300
7413
  execute(): Promise<0 | 1>;
7301
- processSubscription(subscriptionId: string, resourceGroupToNames: Record<string, string[]>, config: ContainerAppConfigOptions): Promise<boolean>;
7414
+ processSubscription(subscriptionId: string, resourceGroupToNames: Record<string, string[]>, config: ContainerAppConfigOptions, ssiConfig?: SsiConfigResult): Promise<boolean>;
7302
7415
  /**
7303
7416
  * Process an Azure Container App for instrumentation.
7304
7417
  * @returns A promise that resolves to a boolean indicating success or failure.
7305
7418
  */
7306
- processContainerApp(containerAppClient: ContainerAppsAPIClient, config: ContainerAppConfigOptions, resourceGroup: string, containerAppName: string): Promise<boolean>;
7307
- addTags(config: ContainerAppConfigOptions, subscriptionId: string, resourceGroup: string, containerApp: ContainerApp): Promise<void>;
7308
- instrumentSidecar(client: ContainerAppsAPIClient, config: ContainerAppConfigOptions, resourceGroup: string, containerApp: ContainerApp): Promise<void>;
7309
- createInstrumentedAppConfig(config: ContainerAppConfigOptions, subscriptionId: string, resourceGroup: string, containerApp: ContainerApp): ContainerApp;
7419
+ processContainerApp(containerAppClient: ContainerAppsAPIClient, config: ContainerAppConfigOptions, resourceGroup: string, containerAppName: string, ssiConfig?: SsiConfigResult): Promise<boolean>;
7420
+ addTags(config: ContainerAppConfigOptions, subscriptionId: string, resourceGroup: string, containerApp: ContainerApp, ssiConfig?: SsiConfigResult): Promise<void>;
7421
+ instrumentSidecar(client: ContainerAppsAPIClient, config: ContainerAppConfigOptions, resourceGroup: string, containerApp: ContainerApp, ssiConfig?: SsiConfigResult): Promise<void>;
7422
+ createInstrumentedAppConfig(config: ContainerAppConfigOptions, subscriptionId: string, resourceGroup: string, containerApp: ContainerApp, ssiConfig?: SsiConfigResult): ContainerApp;
7310
7423
  }
7311
7424
  //#endregion
7312
7425
  //#region ../base/dist/commands/container-app/uninstrument.d.ts