Skip to content

Commit eac43a8

Browse files
committed
Merge remote-tracking branch 'origin/main' into u/mtomka/refine-runtime-trait
2 parents 9f082a7 + 367e484 commit eac43a8

File tree

112 files changed

+1484
-799
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1484
-799
lines changed

.github/workflows/fossa.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: FOSSA scanning
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
fossa:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
17+
- uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0
18+
with:
19+
api-key: ${{secrets.FOSSA_API_KEY}}
20+
team: OpenTelemetry
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on: [pull_request]
2+
name: benchmark pull requests
3+
jobs:
4+
runBenchmark:
5+
name: run benchmark
6+
permissions:
7+
pull-requests: write
8+
runs-on: ubuntu-latest
9+
if: ${{ contains(github.event.pull_request.labels.*.name, 'performance') }}
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: arduino/setup-protoc@v3
13+
- uses: dtolnay/rust-toolchain@master
14+
with:
15+
toolchain: stable
16+
- uses: boa-dev/criterion-compare-action@v3
17+
with:
18+
cwd: opentelemetry
19+
branchName: ${{ github.base_ref }}
20+
- uses: boa-dev/criterion-compare-action@v3
21+
with:
22+
cwd: opentelemetry-appender-tracing
23+
features: spec_unstable_logs_enabled
24+
branchName: ${{ github.base_ref }}
25+
- uses: boa-dev/criterion-compare-action@v3
26+
with:
27+
cwd: opentelemetry-sdk
28+
features: rt-tokio,testing,metrics,logs,spec_unstable_metrics_views
29+
branchName: ${{ github.base_ref }}

.github/workflows/pr_naming.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: PR Conventional Commit Validation
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
7+
jobs:
8+
validate-pr-title:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: PR Conventional Commit Validation
12+
uses: ytanikin/[email protected]
13+
with:
14+
task_types: '["build","chore","ci","docs","feat","fix","perf","refactor","revert","test"]'
15+
add_label: 'false'

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ Open a pull request against the main
7878
[opentelemetry-rust](https://github.com/open-telemetry/opentelemetry-rust)
7979
repo.
8080

81+
Your pull request should be named according to the
82+
[conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard. This ensures that
83+
when the PR is squashed into `main`, the resulting commit message is consistent and makes it easier
84+
for us to generate a changelog standard.
85+
8186
> **Note**
8287
> It is recommended to run [pre-commit script](scripts/precommit.sh) to catch any issues locally.
8388

Cargo.toml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pin-project-lite = "0.2"
3636
prost = "0.13"
3737
prost-build = "0.13"
3838
prost-types = "0.13"
39-
rand = { version = "0.8", default-features = false }
39+
rand = { version = "0.9", default-features = false }
4040
reqwest = { version = "0.12", default-features = false }
4141
serde = { version = "1.0", default-features = false }
4242
serde_json = "1.0"
@@ -53,9 +53,37 @@ tracing = { version = ">=0.1.40", default-features = false }
5353
tracing-core = { version = ">=0.1.33", default-features = false }
5454
tracing-subscriber = { version = "0.3", default-features = false }
5555
url = { version = "2.5", default-features = false }
56+
anyhow = "1.0.94"
57+
base64 = "0.22.1"
58+
chrono = { version = "0.4.34", default-features = false }
59+
ctor = "0.2.9"
60+
ctrlc = "3.2.5"
61+
futures-channel = "0.3"
62+
futures-sink = "0.3"
63+
glob = "0.3.1"
64+
hex = "0.4.3"
65+
lazy_static = "1.4.0"
66+
num-format = "0.4.4"
67+
num_cpus = "1.15.0"
68+
opentelemetry-appender-tracing = { path = "opentelemetry-appender-tracing", default-features = false }
69+
opentelemetry-otlp = { path = "opentelemetry-otlp" }
70+
opentelemetry-stdout = { path = "opentelemetry-stdout" }
71+
percent-encoding = "2.0"
72+
rstest = "0.23.0"
73+
schemars = "0.8"
74+
sysinfo = "0.32"
75+
tempfile = "3.3.0"
76+
testcontainers = "0.23.1"
77+
tracing-log = "0.2"
78+
tracing-opentelemetry = "0.29"
79+
typed-builder = "0.20"
80+
uuid = "1.3"
5681

5782
# Aviod use of crates.io version of these crates through the tracing-opentelemetry dependencies
5883
[patch.crates-io]
5984
opentelemetry = { path = "opentelemetry" }
6085
opentelemetry_sdk = { path = "opentelemetry-sdk" }
6186
opentelemetry-stdout = { path = "opentelemetry-stdout" }
87+
88+
[workspace.lints.clippy]
89+
all = { level = "warn", priority = 1 }

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ you're more than welcome to participate!
186186
### Approvers
187187

188188
* [Shaun Cox](https://github.com/shaun-cox)
189+
* [Scott Gerring](https://github.com/scottgerring)
189190

190191
### Emeritus
191192

docs/design/logs.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,22 @@ this crate.
280280
## Performance
281281

282282
// Call out things done specifically for performance
283+
// Rough draft
284+
285+
1. `LogRecord` is stack allocated and not Boxed unless required by the component
286+
needing to store it beyond the logging call. (eg: BatchProcessor)
287+
2. LogRecords's Attribute storage is specially designed struct, that holds up to
288+
five attributes in stack.
289+
3. When passing `LogRecord`s to processor, a mutable ref is passed. This allows
290+
calling multiple processors one after another, without the need for cloning.
291+
4. `Logger` provides a `Enabled` check which can optimize performance when
292+
no-one is interested in the log. The check is passed from `Logger` to the
293+
processor, which may consult its exporter to make the decision. An example use
294+
case - an ETW or user-events exporter can check for the presence of listener and
295+
convey that decision back to logger, allowing appender to avoid even the cost of
296+
creating a `LogRecord` in the first place if there is no listener. This check is
297+
done for each log emission, and can react dynamically to changes in interest, by
298+
enabling/disabling ETW/user-event listener.
283299

284300
### Perf test - benchmarks
285301

@@ -289,6 +305,23 @@ this crate.
289305

290306
// Share ~~ numbers
291307

308+
## Internal logs
309+
310+
OTel itself is instrumented with `tracing` crate to emit internal logs about its
311+
operations. This is feature gated under "internal-logs", and is enabled by
312+
default for all components. The `opentelemetry` provide few helper macros
313+
`otel_warn` etc., which in turn invokes various `tracing` macros like `warn!`
314+
etc. The cargo package name will be set as `target` when using `tracing`. For
315+
example, logs from `opentelemetry-otlp` will have target set to
316+
"opentelemetry-otlp".
317+
318+
The helper macros are part of public API, so can be used by anyone. But it is
319+
only meant for OTel components itself and anyone writing extensions like custom
320+
Exporters etc.
321+
322+
// TODO: Document the principles followed when selecting severity for internal
323+
logs // TODO: Document how this can cause circular loop and plans to address it.
324+
292325
## Summary
293326

294327
- OpenTelemetry Logs does not provide a user-facing logging API.

examples/logs-basic/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ publish = false
77

88
[dependencies]
99
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["logs"] }
10-
opentelemetry-stdout = { path = "../../opentelemetry-stdout", features = ["logs"]}
11-
opentelemetry-appender-tracing = { path = "../../opentelemetry-appender-tracing", default-features = false}
10+
opentelemetry-stdout = { workspace = true, features = ["logs"] }
11+
opentelemetry-appender-tracing = { workspace = true }
1212
tracing = { workspace = true, features = ["std"]}
1313
tracing-subscriber = { workspace = true, features = ["env-filter","registry", "std", "fmt"] }

examples/metrics-advanced/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ publish = false
88
[dependencies]
99
opentelemetry = { path = "../../opentelemetry", features = ["metrics"] }
1010
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["spec_unstable_metrics_views", "rt-tokio"] }
11-
opentelemetry-stdout = { path = "../../opentelemetry-stdout", features = ["metrics"] }
11+
opentelemetry-stdout = { workspace = true, features = ["metrics"] }
1212
tokio = { workspace = true, features = ["full"] }

examples/metrics-advanced/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use opentelemetry::global;
22
use opentelemetry::Key;
33
use opentelemetry::KeyValue;
4-
use opentelemetry_sdk::metrics::{
5-
Aggregation, Instrument, PeriodicReader, SdkMeterProvider, Stream, Temporality,
6-
};
4+
use opentelemetry_sdk::metrics::{Aggregation, Instrument, SdkMeterProvider, Stream, Temporality};
75
use opentelemetry_sdk::Resource;
86
use std::error::Error;
97

0 commit comments

Comments
 (0)