@vercel/devlow-bench 0.3.1 → 0.3.2
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/dist/interfaces/datadog.js +15 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import datadogApiClient from "@datadog/datadog-api-client";
|
|
2
2
|
import os from "os";
|
|
3
|
+
import { command } from "../shell.js";
|
|
3
4
|
function toIdentifier(str) {
|
|
4
5
|
return str.replace(/\//g, ".").replace(/ /g, "_");
|
|
5
6
|
}
|
|
@@ -8,6 +9,18 @@ const UNIT_MAPPING = {
|
|
|
8
9
|
requests: "request",
|
|
9
10
|
bytes: "byte",
|
|
10
11
|
};
|
|
12
|
+
const GIT_SHA = process.env.GITHUB_SHA ??
|
|
13
|
+
(await (async () => {
|
|
14
|
+
const cmd = command("git", ["rev-parse", "HEAD"]);
|
|
15
|
+
await cmd.ok();
|
|
16
|
+
return cmd.output.trim();
|
|
17
|
+
})());
|
|
18
|
+
const GIT_BRANCH = process.env.GITHUB_REF_NAME ??
|
|
19
|
+
(await (async () => {
|
|
20
|
+
const cmd = command("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
21
|
+
await cmd.ok();
|
|
22
|
+
return cmd.output.trim();
|
|
23
|
+
})());
|
|
11
24
|
export default function createInterface({ apiKey = process.env.DATADOG_API_KEY, appKey = process.env.DATADOG_APP_KEY, host = process.env.DATADOG_HOST || os.hostname(), } = {}) {
|
|
12
25
|
if (!apiKey)
|
|
13
26
|
throw new Error("Datadog API key is required (set DATADOG_API_KEY)");
|
|
@@ -21,6 +34,8 @@ export default function createInterface({ apiKey = process.env.DATADOG_API_KEY,
|
|
|
21
34
|
`arch:${os.arch()}`,
|
|
22
35
|
`total_memory:${Math.round(os.totalmem() / 1024 / 1024 / 1024)}`,
|
|
23
36
|
`node_version:${process.version}`,
|
|
37
|
+
`git_sha:${GIT_SHA}`,
|
|
38
|
+
`git_branch:${GIT_BRANCH}`,
|
|
24
39
|
];
|
|
25
40
|
const configuration = datadogApiClient.client.createConfiguration({
|
|
26
41
|
authMethods: {
|