Skip to content

Commit d7e51c5

Browse files
authored
Merge branch 'main' into cijothomas/metricsdk-add-moretesetes
2 parents 88652af + a34c5ee commit d7e51c5

File tree

8 files changed

+222
-2
lines changed

8 files changed

+222
-2
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
external-types:
5454
strategy:
5555
matrix:
56-
example: [opentelemetry, opentelemetry-sdk]
56+
example: [opentelemetry, opentelemetry-sdk, opentelemetry-otlp, opentelemetry-zipkin]
5757
runs-on: ubuntu-latest
5858
steps:
5959
- uses: actions/checkout@v4

.github/workflows/markdown-link-check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v4
1616

1717
- name: Install markdown-link-check
18-
run: npm install -g markdown-link-check
18+
run: npm install -g markdown-link-check@3.11.2
1919

2020
- name: Run markdown-link-check
2121
run: |

RELEASING.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Releasing OpenTelemetry Rust
2+
3+
The primary audience for this is the SIG Maintainers. It provides the list of steps for how to release the crates and the
4+
considerations to make before releasing the crate. It may provide use to consumers of the crate if/when we develop a
5+
release cadence.
6+
7+
## Release cadence
8+
9+
As of Feb 2024, there is no established cadence for the OpenTelemetry crates. The balance is required between too many
10+
breaking changes in a single release, and since we have instability flipping between implementations across 0.x
11+
releases. Perhaps once we've established a 1.0 we can consider adopting a consistent release cadence.
12+
13+
## Considerations
14+
15+
A draft PR can be created, but before releasing consider the following:
16+
17+
* Are there any pending pull requests which should be included in the next release?
18+
* Are they blockers?
19+
* Are there any unresolved issues which should be resolved before the next release?
20+
* Bring it up at a SIG meeting, this can usually get some of these questions answered sooner than later. It will also
21+
help establish a person to perform the release. Ideally this can be someone different each time to ensure that the
22+
process is documented.
23+
24+
## Steps to Release
25+
26+
1. Create a release PR
27+
- For each crate
28+
- Bump appropriate version
29+
- Update change logs to reflect release version.
30+
- Update API/SDK version as necessary
31+
- Attach `integration test` label to the PR to run integration tests
32+
- If there's a large enough set of changes, consider writing a migration guide.
33+
2. Merge the PR
34+
- Get reviews from other Maintainers
35+
- Ensure that there haven't been any interfering PRs
36+
3. Tag the release commit based on the [tagging convention](#tagging-convention). It should usually be a bump on minor version before 1.0
37+
4. Create Github Release
38+
5. [Publish](#publishing-crates) to crates.io using the version as of the release commit
39+
6. Post to [#otel-rust](https://cloud-native.slack.com/archives/C03GDP0H023) on CNCF Slack.
40+
41+
42+
## Tagging Convention
43+
44+
For each crate: it should be `<crate-name>-<version>` `<version>` being the simple `X.Y.Z`.
45+
46+
## Publishing Crates
47+
48+
For now we use the [basic procedure](https://doc.rust-lang.org/cargo/reference/publishing.html) from crates.io.
49+
50+
Follow this for each crate as necessary.
51+
52+
For any new crates remember to add open-telemetry/rust-maintainers to the list.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
# This is used with cargo-check-external-types to reduce the surface area of downstream crates from
4+
# the public API. Ideally this can have a few exceptions as possible.
5+
allowed_external_types = [
6+
"opentelemetry::*",
7+
"opentelemetry_http::*",
8+
"opentelemetry_sdk::*",
9+
# http is a pre 1.0 crate
10+
"http::uri::InvalidUri",
11+
"http::header::name::InvalidHeaderName",
12+
"http::header::value::InvalidHeaderValue",
13+
# prost is a pre 1.0 crate
14+
"prost::error::EncodeError",
15+
# tonic is a pre 1.0 crate
16+
"tonic::status::Code",
17+
"tonic::status::Status",
18+
"tonic::metadata::map::MetadataMap",
19+
"tonic::transport::channel::Channel",
20+
"tonic::transport::error::Error",
21+
"tonic::service::interceptor::Interceptor",
22+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
# This is used with cargo-check-external-types to reduce the surface area of downstream crates from
4+
# the public API. Ideally this can have a few exceptions as possible.
5+
allowed_external_types = [
6+
"opentelemetry::*",
7+
"opentelemetry_http::*",
8+
"opentelemetry_sdk::*",
9+
# http is a pre 1.0 crate
10+
"http::error::Error",
11+
"http::uri::InvalidUri",
12+
]

opentelemetry/Cargo.toml

+10
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,13 @@ otel_unstable = []
4242

4343
[dev-dependencies]
4444
opentelemetry_sdk = { path = "../opentelemetry-sdk" } # for documentation tests
45+
criterion = { version = "0.3" }
46+
47+
[[bench]]
48+
name = "metrics"
49+
harness = false
50+
required-features = ["metrics"]
51+
52+
[[bench]]
53+
name = "attributes"
54+
harness = false

opentelemetry/benches/attributes.rs

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
use criterion::{black_box, criterion_group, criterion_main, Criterion};
2+
use opentelemetry::KeyValue;
3+
4+
// Run this benchmark with:
5+
// cargo bench --bench attributes
6+
7+
fn criterion_benchmark(c: &mut Criterion) {
8+
attributes_creation(c);
9+
}
10+
11+
fn attributes_creation(c: &mut Criterion) {
12+
c.bench_function("CreateOTelKeyValue", |b| {
13+
b.iter(|| {
14+
let _v1 = black_box(KeyValue::new("attribute1", "value1"));
15+
});
16+
});
17+
18+
c.bench_function("CreateKeyValueTuple", |b| {
19+
b.iter(|| {
20+
let _v1 = black_box(("attribute1", "value1"));
21+
});
22+
});
23+
24+
#[allow(clippy::useless_vec)]
25+
c.bench_function("CreateVector_KeyValue", |b| {
26+
b.iter(|| {
27+
let _v1 = black_box(vec![
28+
KeyValue::new("attribute1", "value1"),
29+
KeyValue::new("attribute2", "value2"),
30+
KeyValue::new("attribute3", "value3"),
31+
KeyValue::new("attribute4", "value4"),
32+
]);
33+
});
34+
});
35+
36+
#[allow(clippy::useless_vec)]
37+
c.bench_function("CreateVector_StringPairs", |b| {
38+
b.iter(|| {
39+
let _v1 = black_box(vec![
40+
("attribute1", "value1"),
41+
("attribute2", "value2"),
42+
("attribute3", "value3"),
43+
("attribute4", "value4"),
44+
]);
45+
});
46+
});
47+
}
48+
49+
criterion_group!(benches, criterion_benchmark);
50+
51+
criterion_main!(benches);

opentelemetry/benches/metrics.rs

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
use criterion::{criterion_group, criterion_main, Criterion};
2+
use opentelemetry::{
3+
metrics::{noop::NoopMeterProvider, Counter, MeterProvider as _},
4+
KeyValue,
5+
};
6+
7+
// Run this benchmark with:
8+
// cargo bench --bench metrics --features=metrics
9+
10+
fn create_counter() -> Counter<u64> {
11+
let meter_provider: NoopMeterProvider = NoopMeterProvider::default();
12+
let meter = meter_provider.meter("benchmarks");
13+
let counter = meter.u64_counter("counter_bench").init();
14+
counter
15+
}
16+
17+
fn criterion_benchmark(c: &mut Criterion) {
18+
counter_add(c);
19+
}
20+
21+
fn counter_add(c: &mut Criterion) {
22+
let counter = create_counter();
23+
24+
c.bench_function("Counter_NoAttributes", |b| {
25+
b.iter(|| {
26+
counter.add(1, &[]);
27+
});
28+
});
29+
30+
c.bench_function("Counter_AddWithInlineStaticAttributes", |b| {
31+
b.iter(|| {
32+
counter.add(
33+
1,
34+
&[
35+
KeyValue::new("attribute1", "value1"),
36+
KeyValue::new("attribute2", "value2"),
37+
KeyValue::new("attribute3", "value3"),
38+
KeyValue::new("attribute4", "value4"),
39+
],
40+
);
41+
});
42+
});
43+
44+
c.bench_function("Counter_AddWithStaticArray", |b| {
45+
b.iter(|| {
46+
let kv = [
47+
KeyValue::new("attribute1", "value1"),
48+
KeyValue::new("attribute2", "value2"),
49+
KeyValue::new("attribute3", "value3"),
50+
KeyValue::new("attribute4", "value4"),
51+
];
52+
53+
counter.add(1, &kv);
54+
});
55+
});
56+
57+
c.bench_function("Counter_AddWithDynamicAttributes", |b| {
58+
b.iter(|| {
59+
let kv = vec![
60+
KeyValue::new("attribute1", "value1"),
61+
KeyValue::new("attribute2", "value2"),
62+
KeyValue::new("attribute3", "value3"),
63+
KeyValue::new("attribute4", "value4"),
64+
];
65+
66+
counter.add(1, &kv);
67+
});
68+
});
69+
}
70+
71+
criterion_group!(benches, criterion_benchmark);
72+
73+
criterion_main!(benches);

0 commit comments

Comments
 (0)