1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Copyright © 2023 - 2026 Static Site Generator (SSG). All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! OpenTelemetry build-pipeline tracing scaffolding (issue #422).
//!
//! This module is intentionally a *scaffold*. The full deliverable
//! ships in two phases:
//!
//! 1. **Phase A (this commit)** — `otel` Cargo feature, `--trace` CLI
//! flag, an `init_if_enabled` initialiser that attaches a
//! `tracing-subscriber` JSON formatter to stdout, and one demo
//! span around `pipeline::execute_build_pipeline` via
//! `#[tracing::instrument]`.
//!
//! 2. **Phase B (deferred follow-up)** — per-plugin spans inside
//! `PluginManager::run_*`, file-count + duration + peak-RSS
//! delta fields, OTLP/gRPC + Jaeger exporter wiring, and a
//! Grafana dashboard JSON. Phase B requires `tokio` to be
//! introduced; the rest of SSG is rayon-based, so that
//! architectural decision is deliberately deferred.
//!
//! When the `otel` feature is **off**, this module compiles to an
//! empty stub — `init_if_enabled` is a no-op. Callers may invoke it
//! unconditionally and it will simply do nothing.
/// Initialises tracing if both:
///
/// 1. The crate was compiled with the `otel` feature, and
/// 2. `enabled` is `true` (typically driven by the `--trace` CLI flag).
///
/// On `(true, true)`: installs a `tracing-subscriber` global
/// dispatcher with JSON formatting to stdout, level filter from
/// `RUST_LOG` (default `info`).
///
/// In any other case: returns immediately, no global state mutated.
///
/// # Returns
///
/// `true` if a subscriber was installed; `false` otherwise.