Skip to content

Commit aafd4cb

Browse files
prontclaude
andauthored
fix(demo_logs source): drop fakedata_generator, fix broken fake domains (#25236)
* fix(demo_logs source): drop fakedata_generator, fix broken fake domains The fakedata_generator crate (v0.7.1) has an upstream bug: its get_dataset() match table is missing a "tlds" arm, so gen_domain() falls through to an empty JSON string. That fails to parse and the crate prints "Failed getting dataset for tlds. EOF while parsing a value at line 1 column 0" to stderr on every call, while gen_domain() returns "<name>.Error: dataset not found" as the fake domain. Drop the dependency (and its transitive passt dep) and inline the three functions demo_logs actually used: gen_domain, gen_ipv4, gen_username. Domains now look like "random.io" instead of "random.Error: dataset not found", and stderr is quiet. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(releasing): changelog fragment for demo_logs fakedata fix Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(demo_logs source): drop stale comment, allow TLDs/fakedata in spelling Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(demo_logs source): swap fake domain name list to unique entries Replace the 8-word domain-name pool with fresh placeholder-style entries so nothing in lib/fakedata derives from the fakedata_generator crate's data. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1c70988 commit aafd4cb

6 files changed

Lines changed: 61 additions & 26 deletions

File tree

.github/actions/spelling/allow.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Evercoss
154154
exactlyonce
155155
Explay
156156
Fabro
157+
fakedata
157158
fakeintake
158159
FAQs
159160
fargate
@@ -509,6 +510,7 @@ timeseries
509510
timespan
510511
timestamped
511512
Tizen
513+
TLDs
512514
Tmobile
513515
tobz
514516
Tomtec

Cargo.lock

Lines changed: 0 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE-3rdparty.csv

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ event-listener-strategy,https://github.com/smol-rs/event-listener-strategy,Apach
270270
evmap,https://github.com/jonhoo/rust-evmap,MIT OR Apache-2.0,Jon Gjengset <jon@thesquareplanet.com>
271271
evmap-derive,https://github.com/jonhoo/rust-evmap,MIT OR Apache-2.0,Jon Gjengset <jon@thesquareplanet.com>
272272
exitcode,https://github.com/benwilber/exitcode,Apache-2.0,Ben Wilber <benwilber@gmail.com>
273-
fakedata_generator,https://github.com/KevinGimbel/fakedata_generator,MIT,Kevin Gimbel <kevin@gimbel.dev>
274273
fallible-iterator,https://github.com/sfackler/rust-fallible-iterator,MIT OR Apache-2.0,Steven Fackler <sfackler@gmail.com>
275274
fancy-regex,https://github.com/fancy-regex/fancy-regex,MIT,"Raph Levien <raph@google.com>, Robin Stocker <robin@nibor.org>, Keith Hall <keith.hall@available.systems>"
276275
fastrand,https://github.com/smol-rs/fastrand,Apache-2.0 OR MIT,Stjepan Glavina <stjepang@gmail.com>
@@ -536,7 +535,6 @@ parking_lot,https://github.com/Amanieu/parking_lot,MIT OR Apache-2.0,Amanieu d'A
536535
parking_lot_core,https://github.com/Amanieu/parking_lot,MIT OR Apache-2.0,Amanieu d'Antras <amanieu@gmail.com>
537536
parquet,https://github.com/apache/arrow-rs,Apache-2.0,Apache Arrow <dev@arrow.apache.org>
538537
parse-size,https://github.com/kennytm/parse-size,MIT,kennytm <kennytm@gmail.com>
539-
passt,https://github.com/kevingimbel/passt,MIT OR Apache-2.0,Kevin Gimbel <hallo@kevingimbel.com>
540538
paste,https://github.com/dtolnay/paste,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
541539
pastey,https://github.com/as1100k/pastey,MIT OR Apache-2.0,"Aditya Kumar <git@adityais.dev>, David Tolnay <dtolnay@gmail.com>"
542540
pbkdf2,https://github.com/RustCrypto/password-hashes/tree/master/pbkdf2,MIT OR Apache-2.0,RustCrypto Developers
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The text content generated by the `demo_logs` source has changed: the
2+
pool of fake usernames and the pool of fake domain TLDs are now both
3+
defined inside Vector rather than pulled from an external crate. The
4+
line formats (`apache_common`, `apache_error`, `json`, `syslog`,
5+
`bsd_syslog`) are unchanged. If any of your tests or downstream
6+
pipelines assert on specific generated usernames or TLDs, please
7+
update those expectations.
8+
9+
authors: pront

lib/fakedata/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ license = "MPL-2.0"
88

99
[dependencies]
1010
chrono.workspace = true
11-
fakedata_generator = "0.7.1"
1211
rand.workspace = true

lib/fakedata/src/logs.rs

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,44 @@ use chrono::{
33
format::{DelayedFormat, StrftimeItems},
44
prelude::Local,
55
};
6-
use fakedata_generator::{gen_domain, gen_ipv4, gen_username};
76
use rand::{Rng, rng};
87

8+
static FAKE_USERNAMES: [&str; 20] = [
9+
"log_whisperer",
10+
"commit_conductor",
11+
"cache_cowboy",
12+
"compile_captain",
13+
"latency_llama",
14+
"yaml_yoda",
15+
"regex_rider",
16+
"semver_sage",
17+
"kernel_keith",
18+
"pixel_pilgrim",
19+
"kubectl_kev",
20+
"pipeline_pat",
21+
"telemetry_tina",
22+
"merge_maria",
23+
"parser_pete",
24+
"debug_duchess",
25+
"nullable_nate",
26+
"grep_greg",
27+
"stderr_stan",
28+
"segfault_sue",
29+
];
30+
31+
static FAKE_DOMAIN_NAMES: [&str; 8] = [
32+
"acme",
33+
"contoso",
34+
"widgets",
35+
"example",
36+
"placeholder",
37+
"sample",
38+
"foobar",
39+
"testbench",
40+
];
41+
42+
static FAKE_DOMAIN_TLDS: [&str; 8] = ["com", "net", "org", "io", "dev", "co", "app", "biz"];
43+
944
static APPLICATION_NAMES: [&str; 10] = [
1045
"auth", "data", "deploy", "etl", "scraper", "cron", "ingress", "egress", "alerter", "fwd",
1146
];
@@ -156,7 +191,11 @@ fn application() -> &'static str {
156191
}
157192

158193
fn domain() -> String {
159-
gen_domain()
194+
format!(
195+
"{}.{}",
196+
random_from_array(&FAKE_DOMAIN_NAMES),
197+
random_from_array(&FAKE_DOMAIN_TLDS),
198+
)
160199
}
161200

162201
fn error_level() -> &'static str {
@@ -188,7 +227,14 @@ fn http_version() -> &'static str {
188227
}
189228

190229
fn ipv4_address() -> String {
191-
gen_ipv4()
230+
let mut r = rng();
231+
format!(
232+
"{}.{}.{}.{}",
233+
r.random_range(1..255),
234+
r.random_range(1..255),
235+
r.random_range(1..255),
236+
r.random_range(1..255),
237+
)
192238
}
193239

194240
fn pid() -> usize {
@@ -208,7 +254,7 @@ fn referer() -> String {
208254
}
209255

210256
fn username() -> String {
211-
gen_username()
257+
(*random_from_array(&FAKE_USERNAMES)).to_string()
212258
}
213259

214260
fn syslog_version() -> usize {

0 commit comments

Comments
 (0)