@datadog/datadog-ci 2.16.1 → 2.17.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 (72) hide show
  1. package/dist/commands/git-metadata/git.d.ts +0 -1
  2. package/dist/commands/git-metadata/git.js +5 -20
  3. package/dist/commands/git-metadata/git.js.map +1 -1
  4. package/dist/commands/git-metadata/gitdb.js +31 -21
  5. package/dist/commands/git-metadata/gitdb.js.map +1 -1
  6. package/dist/commands/junit/api.js +16 -13
  7. package/dist/commands/junit/api.js.map +1 -1
  8. package/dist/commands/junit/interfaces.d.ts +4 -1
  9. package/dist/commands/junit/upload.d.ts +6 -0
  10. package/dist/commands/junit/upload.js +34 -12
  11. package/dist/commands/junit/upload.js.map +1 -1
  12. package/dist/commands/junit/utils.d.ts +1 -0
  13. package/dist/commands/junit/utils.js +11 -1
  14. package/dist/commands/junit/utils.js.map +1 -1
  15. package/dist/commands/lambda/cli.js +2 -1
  16. package/dist/commands/lambda/cli.js.map +1 -1
  17. package/dist/commands/lambda/constants.d.ts +1 -0
  18. package/dist/commands/lambda/constants.js +17 -1
  19. package/dist/commands/lambda/constants.js.map +1 -1
  20. package/dist/commands/lambda/flare.d.ts +127 -0
  21. package/dist/commands/lambda/flare.js +656 -0
  22. package/dist/commands/lambda/flare.js.map +1 -0
  23. package/dist/commands/lambda/functions/commons.d.ts +14 -1
  24. package/dist/commands/lambda/functions/commons.js +53 -11
  25. package/dist/commands/lambda/functions/commons.js.map +1 -1
  26. package/dist/commands/lambda/instrument.js +43 -41
  27. package/dist/commands/lambda/instrument.js.map +1 -1
  28. package/dist/commands/lambda/renderers/common-renderer.d.ts +42 -0
  29. package/dist/commands/lambda/renderers/common-renderer.js +51 -0
  30. package/dist/commands/lambda/renderers/common-renderer.js.map +1 -0
  31. package/dist/commands/lambda/renderers/flare-renderer.d.ts +9 -0
  32. package/dist/commands/lambda/renderers/flare-renderer.js +18 -0
  33. package/dist/commands/lambda/renderers/flare-renderer.js.map +1 -0
  34. package/dist/commands/lambda/{renderer.d.ts → renderers/instrument-uninstrument-renderer.d.ts} +2 -44
  35. package/dist/commands/lambda/{renderer.js → renderers/instrument-uninstrument-renderer.js} +30 -76
  36. package/dist/commands/lambda/renderers/instrument-uninstrument-renderer.js.map +1 -0
  37. package/dist/commands/lambda/uninstrument.js +31 -29
  38. package/dist/commands/lambda/uninstrument.js.map +1 -1
  39. package/dist/commands/react-native/renderer.js +2 -0
  40. package/dist/commands/react-native/renderer.js.map +1 -1
  41. package/dist/commands/sarif/api.js +1 -1
  42. package/dist/commands/sarif/api.js.map +1 -1
  43. package/dist/commands/synthetics/run-tests-command.d.ts +1 -0
  44. package/dist/commands/synthetics/run-tests-command.js +9 -2
  45. package/dist/commands/synthetics/run-tests-command.js.map +1 -1
  46. package/dist/commands/synthetics/tunnel/tunnel.d.ts +2 -2
  47. package/dist/commands/synthetics/tunnel/tunnel.js.map +1 -1
  48. package/dist/commands/synthetics/tunnel/websocket.d.ts +2 -2
  49. package/dist/commands/synthetics/tunnel/websocket.js.map +1 -1
  50. package/dist/commands/synthetics/utils.d.ts +1 -0
  51. package/dist/commands/synthetics/utils.js +21 -4
  52. package/dist/commands/synthetics/utils.js.map +1 -1
  53. package/dist/helpers/ci.d.ts +1 -0
  54. package/dist/helpers/file.d.ts +1 -1
  55. package/dist/helpers/file.js +3 -6
  56. package/dist/helpers/file.js.map +1 -1
  57. package/dist/helpers/git/format-git-sourcemaps-data.js +2 -2
  58. package/dist/helpers/git/format-git-sourcemaps-data.js.map +1 -1
  59. package/dist/helpers/git/get-git-data.d.ts +1 -0
  60. package/dist/helpers/git/get-git-data.js +14 -4
  61. package/dist/helpers/git/get-git-data.js.map +1 -1
  62. package/dist/helpers/interfaces.d.ts +2 -2
  63. package/dist/helpers/metrics.js +2 -2
  64. package/dist/helpers/metrics.js.map +1 -1
  65. package/dist/helpers/tags.d.ts +1 -0
  66. package/dist/helpers/tags.js +2 -1
  67. package/dist/helpers/tags.js.map +1 -1
  68. package/dist/helpers/utils.d.ts +3 -2
  69. package/dist/helpers/utils.js +26 -3
  70. package/dist/helpers/utils.js.map +1 -1
  71. package/package.json +4 -3
  72. package/dist/commands/lambda/renderer.js.map +0 -1
@@ -0,0 +1,127 @@
1
+ import { CloudWatchLogsClient, OutputLogEvent } from '@aws-sdk/client-cloudwatch-logs';
2
+ import { FunctionConfiguration, LambdaClient } from '@aws-sdk/client-lambda';
3
+ import { Command } from 'clipanion';
4
+ export declare class LambdaFlareCommand extends Command {
5
+ private isDryRun;
6
+ private withLogs;
7
+ private functionName?;
8
+ private region?;
9
+ private apiKey?;
10
+ private caseId?;
11
+ private email?;
12
+ private start?;
13
+ private end?;
14
+ private credentials?;
15
+ /**
16
+ * Entry point for the `lambda flare` command.
17
+ * Gathers lambda function configuration and sends it to Datadog.
18
+ * @returns 0 if the command ran successfully, 1 otherwise.
19
+ */
20
+ execute(): Promise<1 | 0>;
21
+ }
22
+ /**
23
+ * Validate the start and end flags and adds error messages if found
24
+ * @param start start time as a string
25
+ * @param end end time as a string
26
+ * @throws error if start or end are not valid numbers
27
+ * @returns [startMillis, endMillis] as numbers or [undefined, undefined] if both are undefined
28
+ */
29
+ export declare const validateStartEndFlags: (start: string | undefined, end: string | undefined) => number[] | undefined[];
30
+ /**
31
+ * Mask the environment variables in a Lambda function configuration
32
+ * @param config
33
+ */
34
+ export declare const maskConfig: (config: FunctionConfiguration) => FunctionConfiguration;
35
+ /**
36
+ * Delete a folder and all its contents
37
+ * @param folderPath the folder to delete
38
+ * @throws Error if the deletion fails
39
+ */
40
+ export declare const deleteFolder: (folderPath: string) => void;
41
+ /**
42
+ * Creates the root folder and the logs sub-folder
43
+ * @param rootFolderPath path to the root folder
44
+ * @param logsFolderPath path to the logs folder
45
+ * @param logs array of logs
46
+ * @throws Error if the root folder cannot be deleted or folders cannot be created
47
+ */
48
+ export declare const createDirectories: (rootFolderPath: string, logsFolderPath: string, logs: Map<string, OutputLogEvent[]>) => void;
49
+ /**
50
+ * Gets the LOG_STREAM_COUNT latest log stream names, sorted by last event time
51
+ * @param cwlClient CloudWatch Logs client
52
+ * @param logGroupName name of the log group
53
+ * @param startMillis start time in milliseconds or undefined if no start time is specified
54
+ * @param endMillis end time in milliseconds or undefined if no end time is specified
55
+ * @returns an array of the last LOG_STREAM_COUNT log stream names or an empty array if no log streams are found
56
+ * @throws Error if the log streams cannot be retrieved
57
+ */
58
+ export declare const getLogStreamNames: (cwlClient: CloudWatchLogsClient, logGroupName: string, startMillis: number | undefined, endMillis: number | undefined) => Promise<string[]>;
59
+ /**
60
+ * Gets the log events for a log stream
61
+ * @param cwlClient
62
+ * @param logGroupName
63
+ * @param logStreamName
64
+ * @param startMillis
65
+ * @param endMillis
66
+ * @returns the log events or an empty array if no log events are found
67
+ * @throws Error if the log events cannot be retrieved
68
+ */
69
+ export declare const getLogEvents: (cwlClient: CloudWatchLogsClient, logGroupName: string, logStreamName: string, startMillis: number | undefined, endMillis: number | undefined) => Promise<OutputLogEvent[]>;
70
+ /**
71
+ * Gets all CloudWatch logs for a function
72
+ * @param region
73
+ * @param functionName
74
+ * @param startMillis start time in milliseconds or undefined if no end time is specified
75
+ * @param endMillis end time in milliseconds or undefined if no end time is specified
76
+ * @returns a map of log stream names to log events or an empty map if no logs are found
77
+ */
78
+ export declare const getAllLogs: (region: string, functionName: string, startMillis: number | undefined, endMillis: number | undefined) => Promise<Map<string, OutputLogEvent[]>>;
79
+ /**
80
+ * Gets the tags for a function
81
+ * @param lambdaClient
82
+ * @param region
83
+ * @param arn
84
+ * @returns the tags or an empty object if no tags are found
85
+ * @throws Error if the tags cannot be retrieved
86
+ */
87
+ export declare const getTags: (lambdaClient: LambdaClient, region: string, arn: string) => Promise<Record<string, string>>;
88
+ /**
89
+ * Write the function config to a file
90
+ * @param filePath path to the file
91
+ * @param data the data to write
92
+ * @throws Error if the file cannot be written
93
+ */
94
+ export declare const writeFile: (filePath: string, data: string) => void;
95
+ /**
96
+ * Convert the log events to a CSV string
97
+ * @param logEvents array of log events
98
+ * @returns the CSV string
99
+ */
100
+ export declare const convertToCSV: (logEvents: OutputLogEvent[]) => string;
101
+ /**
102
+ * @param ms number of milliseconds to sleep
103
+ */
104
+ export declare const sleep: (ms: number) => Promise<void>;
105
+ /**
106
+ * Zip the contents of the flare folder
107
+ * @param rootFolderPath path to the root folder to zip
108
+ * @param zipPath path to save the zip file
109
+ * @throws Error if the zip fails
110
+ */
111
+ export declare const zipContents: (rootFolderPath: string, zipPath: string) => Promise<void>;
112
+ /**
113
+ * Calculates the full endpoint URL
114
+ * @throws Error if the site is invalid
115
+ * @returns the full endpoint URL
116
+ */
117
+ export declare const getEndpointUrl: () => string;
118
+ /**
119
+ * Send the zip file to Datadog support
120
+ * @param zipPath
121
+ * @param caseId
122
+ * @param email
123
+ * @param apiKey
124
+ * @param rootFolderPath
125
+ * @throws Error if the request fails
126
+ */
127
+ export declare const sendToDatadog: (zipPath: string, caseId: string, email: string, apiKey: string, rootFolderPath: string) => Promise<void>;