Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): update Rust dependencies (2022-W39) #1295

Merged
merged 4 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
305 changes: 171 additions & 134 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/pinga/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM rust:$RUST_VERSION as cache
ARG RUST_VERSION
ARG BIN=pinga

RUN apt-get update && apt-get install -y lld
RUN apt-get update && apt-get install -y lld protobuf-compiler
WORKDIR /usr/src
COPY . .

Expand Down
2 changes: 1 addition & 1 deletion bin/sdf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM rust:$RUST_VERSION as cache
ARG RUST_VERSION
ARG BIN=sdf

RUN apt-get update && apt-get install -y lld
RUN apt-get update && apt-get install -y lld protobuf-compiler
WORKDIR /usr/src
COPY . .

Expand Down
2 changes: 1 addition & 1 deletion bin/veritech/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FROM rust:$RUST_VERSION as cache
ARG RUST_VERSION
ARG BIN=veritech

RUN apt-get update && apt-get install -y lld
RUN apt-get update && apt-get install -y lld protobuf-compiler
WORKDIR /usr/src
COPY . .

Expand Down
4 changes: 2 additions & 2 deletions lib/dal/src/func/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub trait FuncDispatch: std::fmt::Debug {
skip_all,
level = "debug",
fields(
otel.kind = % SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
si.func.result = Empty
Expand Down Expand Up @@ -260,7 +260,7 @@ pub trait FuncBackend {
skip_all,
level = "debug",
fields(
otel.kind = % SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
si.func.result = Empty
Expand Down
28 changes: 14 additions & 14 deletions lib/si-data/src/nats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl Client {
messaging.system = Empty,
messaging.url = Empty,
net.transport = Empty,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
)
Expand Down Expand Up @@ -176,7 +176,7 @@ impl Client {
messaging.url = %self.metadata.messaging_url,
messaging.subject = Empty,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -222,7 +222,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -289,7 +289,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Producer,
otel.kind = %FormattedSpanKind(SpanKind::Producer),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -359,7 +359,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -413,7 +413,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -465,7 +465,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -501,7 +501,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.name = %format!("{} receive", &sub_span_subject),
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -540,7 +540,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
)
Expand Down Expand Up @@ -581,7 +581,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
)
Expand Down Expand Up @@ -622,7 +622,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
)
Expand Down Expand Up @@ -661,7 +661,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
)
Expand Down Expand Up @@ -746,7 +746,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
)
Expand Down Expand Up @@ -799,7 +799,7 @@ impl Client {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Producer,
otel.kind = %FormattedSpanKind(SpanKind::Producer),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down
8 changes: 4 additions & 4 deletions lib/si-data/src/nats/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Message {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Producer,
otel.kind = %FormattedSpanKind(SpanKind::Producer),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -112,7 +112,7 @@ impl Message {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Producer,
otel.kind = %FormattedSpanKind(SpanKind::Producer),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -153,7 +153,7 @@ impl Message {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Producer,
otel.kind = %FormattedSpanKind(SpanKind::Producer),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down Expand Up @@ -195,7 +195,7 @@ impl Message {
messaging.system = %self.metadata.messaging_system,
messaging.url = %self.metadata.messaging_url,
net.transport = %self.metadata.net_transport,
otel.kind = %SpanKind::Producer,
otel.kind = %FormattedSpanKind(SpanKind::Producer),
otel.name = Empty,
otel.status_code = Empty,
otel.status_message = Empty,
Expand Down
8 changes: 4 additions & 4 deletions lib/si-data/src/nats/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Subscription {
messaging_destination_kind: "topic",
messaging_operation: "process",
messaging_subject: subject.clone(),
process_otel_kind: SpanKind::Consumer.to_string(),
process_otel_kind: FormattedSpanKind(SpanKind::Consumer).to_string(),
process_otel_name: format!("{} process", subject),
};

Expand Down Expand Up @@ -85,7 +85,7 @@ impl Subscription {
messaging.system = %self.metadata.messaging_system(),
messaging.url = %self.metadata.messaging_url(),
net.transport = %self.metadata.net_transport(),
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
)
Expand Down Expand Up @@ -126,7 +126,7 @@ impl Subscription {
messaging.system = %self.metadata.messaging_system(),
messaging.url = %self.metadata.messaging_url(),
net.transport = %self.metadata.net_transport(),
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
)
Expand Down Expand Up @@ -184,7 +184,7 @@ impl Subscription {
messaging.system = %self.metadata.messaging_system(),
messaging.url = %self.metadata.messaging_url(),
net.transport = %self.metadata.net_transport(),
otel.kind = %SpanKind::Client,
otel.kind = %FormattedSpanKind(SpanKind::Client),
otel.status_code = Empty,
otel.status_message = Empty,
)
Expand Down
10 changes: 5 additions & 5 deletions lib/telemetry-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ library = [
]

[dependencies]
opentelemetry = { version = "0.17.0", features = ["rt-tokio", "trace"] }
opentelemetry = { version = "0.18.0", features = ["rt-tokio", "trace"] }
thiserror = { version = "1.0" }
tokio = { version = "1.12.0", features = ["rt", "sync"] }
tokio = { version = "1.12.0", features = ["rt", "signal", "sync"] }
tracing = { version = "0.1" }

# library only
async-trait = { version = "0.1.51", optional = true }

# application only
derive_builder = { version = "0.11.2", optional = true }
opentelemetry-otlp = { version = "0.10.0", optional = true }
opentelemetry-semantic-conventions = { version = "0.9.0", optional = true }
tracing-opentelemetry = { version = "0.17.2", optional = true }
opentelemetry-otlp = { version = "0.11.0", optional = true }
opentelemetry-semantic-conventions = { version = "0.10.0", optional = true }
tracing-opentelemetry = { version = "0.18.0", optional = true }
tracing-subscriber = { version = "0.3.11", optional = true, features = ['env-filter', 'std'] }
28 changes: 18 additions & 10 deletions lib/telemetry-rs/src/library.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{borrow::Cow, env, result::Result};
use std::{borrow::Cow, env, fmt, result::Result};

use async_trait::async_trait;
use thiserror::Error;
Expand All @@ -7,13 +7,27 @@ use tokio::sync::mpsc;
pub use opentelemetry::trace::SpanKind;

pub mod prelude {
pub use super::{SpanExt, SpanKind};
pub use super::{FormattedSpanKind, SpanExt, SpanKind};
pub use tracing::{
self, debug, debug_span, error, event, field::Empty, info, info_span, instrument, span,
trace, trace_span, warn, Instrument, Level, Span,
};
}

pub struct FormattedSpanKind(pub SpanKind);

impl fmt::Display for FormattedSpanKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.0 {
SpanKind::Client => write!(f, "client"),
SpanKind::Server => write!(f, "server"),
SpanKind::Producer => write!(f, "producer"),
SpanKind::Consumer => write!(f, "consumer"),
SpanKind::Internal => write!(f, "internal"),
}
}
}

pub trait SpanExt {
fn record_ok(&self);
fn record_err<E>(&self, err: E) -> E
Expand All @@ -23,20 +37,14 @@ pub trait SpanExt {

impl SpanExt for tracing::Span {
fn record_ok(&self) {
self.record(
"otel.status_code",
&opentelemetry::trace::StatusCode::Ok.as_str(),
);
self.record("otel.status_code", "OK");
}

fn record_err<E>(&self, err: E) -> E
where
E: std::error::Error,
{
self.record(
"otel.status_code",
&opentelemetry::trace::StatusCode::Error.as_str(),
);
self.record("otel.status_code", "ERROR");
self.record("otel.status_message", &err.to_string().as_str());
err
}
Expand Down
2 changes: 1 addition & 1 deletion mk/rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ default--check-lint:
## check-doc: Checks all documentation for the Rust crate
default--check-doc:
$(call header,$@)
env RUSTDOCFLAGS="-Dwarnings" cargo doc --all
env RUSTDOCFLAGS="-Dwarnings" cargo doc --all-features --no-deps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE! This will help a lot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it was causing CI to fail otherwise because a crate was using a nightly-only cfg for rustdoc, oi!

.PHONY: default--check-doc

## check-format: Checks all code formatting for the Rust crate
Expand Down