Skip to content

Commit 0f6ae7c

Browse files
authored
[CI] refcache refresh & cleanup + script update (#5818)
1 parent c8e8ca9 commit 0f6ae7c

File tree

4 files changed

+60
-344
lines changed

4 files changed

+60
-344
lines changed

content/en/blog/2024/profiling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ many more.
120120
2024 promises to be another big year for OpenTelemetry as we continue to
121121
implement and stabilize our existing tracing, metrics, and log signals while
122122
adding support for profiling, client-side RUM, and more. It’s a great time to
123-
get involvedcheck out our [website](https://opentelemetry.io) to learn more!
123+
get involved! To learn more, check out the rest of the [website](/).
124124

125125
[^1]: Pending due diligence and review by the OpenTelemetry maintainers.
126126

content/en/docs/contributing/development.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
title: Development setup and commands to build, serve, and more
33
linkTitle: Dev setup and more
4-
description:
5-
Learn how to set up a development environment for the opentelemetry.io site.
4+
description: Learn how to set up a development environment for this website.
65
weight: 60
76
---
87

98
The following instructions explain how to set up a development environment for
10-
the <https://opentelemetry.io/> website.
9+
this website.
1110

1211
## Cloud-IDE setup
1312

@@ -31,7 +30,8 @@ website files.
3130

3231
## Local setup
3332

34-
1. [Fork][] and then [clone][] this repository.
33+
1. [Fork][] and then [clone][] the website repository at
34+
<{{% _param github_repo %}}>.
3535
2. Go to the repository directory.
3636
3. Install or upgrade to the [**active LTS** release][nodejs-rel] of Node.js.
3737
We recommend using [nvm][] to manage your Node installation. Under Linux,

gulp-src/prune.js

+12-24
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function pruneTask() {
4545
},
4646
list: {
4747
type: 'boolean',
48-
description: 'List the <num> + 1 oldest entries. No entries are pruned.',
48+
description: 'List entry prune candidates. No entries are pruned.',
4949
},
5050
}).argv;
5151

@@ -85,11 +85,6 @@ async function pruneTask() {
8585
const json = await fs.readFile(refcacheFile, 'utf8');
8686
const entries = JSON.parse(json);
8787

88-
if (list) {
89-
listOldest(entries, n + 1);
90-
return;
91-
}
92-
9388
const numEntriesWith4xxStatus = prune4xxEntriesAndReturnCount(entries);
9489

9590
// Create array of entries of prune candidates by date, sorted by LastSeen:
@@ -111,39 +106,32 @@ async function pruneTask() {
111106
);
112107
}
113108

114-
if (n == 0) {
109+
var keysToPrune = pruneCandidatesByDate__sorted.map((item) => item[0]);
110+
if (n > 0) keysToPrune = keysToPrune.slice(0, n);
111+
112+
if (list) {
113+
listEntries(keysToPrune, entries);
114+
return;
115+
} else if (n == 0) {
115116
console.log(
116117
`WARN: num is ${n} so no entries will be pruned by date. Specify number of entries to prune as --num <n>.`,
117118
);
118119
if (numEntriesWith4xxStatus == 0) return;
119120
}
120121

121-
// Get keys of at most n entries to prune
122-
const keysToPrune = pruneCandidatesByDate__sorted
123-
.slice(0, n)
124-
.map((item) => item[0]);
125122
keysToPrune.forEach((key) => delete entries[key]);
126123
console.log(`INFO: ${keysToPrune.length} entries pruned.`);
127-
128124
const prettyJson = JSON.stringify(entries, null, 2) + '\n';
129125
await fs.writeFile(refcacheFile, prettyJson, 'utf8');
130126
} catch (err) {
131127
console.error(err);
132128
}
133129
}
134130

135-
function listOldest(entries, numberOfEntries) {
136-
const entriesArray = Object.keys(entries)
137-
.map((url) => [url, entries[url].LastSeen, entries[url].StatusCode])
138-
.sort((a, b) => new Date(a[1]) - new Date(b[1]));
139-
const oldestEntries = entriesArray.slice(0, numberOfEntries);
140-
141-
if (oldestEntries.length > 0)
142-
console.log(`Listing oldest ${numberOfEntries} entries:`);
143-
144-
oldestEntries.forEach((e) => {
145-
const date = new Date(e[1]);
146-
console.log(` ${formattedDate(date)} ${formattedTime(date)} for ${e[0]}`);
131+
function listEntries(keys, entries) {
132+
keys.forEach((key) => {
133+
const date = new Date(entries[key].LastSeen);
134+
console.log(` ${formattedDate(date)} ${formattedTime(date)} for ${key}`);
147135
});
148136
}
149137

0 commit comments

Comments
 (0)