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

gRPC refresh #2135

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

gRPC refresh #2135

wants to merge 7 commits into from

Conversation

darach
Copy link
Member

@darach darach commented Dec 15, 2022

Pull request

gRPC refresh.

Provoked by original work by @dak-x to add compression support to the otel connectors he discovered
that a lot more work would be required to upgrade tremor's gRPC connectivity across the board due to
changes in tonic ( gRPC ) and prost ( protobuf ) and changes to the protobuf specifications for OpenTelemetry
and the GCP connectors in tremor that leverage gRPC.

The relatively small and simple change. Was now no more a simple and quick undertaking.

This pull request captures the functional changes required to complete that work pending acceptance
tests against all the affected connectors as changes to GCP pulled in a new untested authentication
mechanism and library.

Once acceptance tests have been conducted the 😭 sob emoji may be removed and this draft promoted
to a full pull request.

Description

See above.

Related

Checklist

  • The RFC, if required, has been submitted and approved
  • Any user-facing impact of the changes is reflected in docs.tremor.rs
  • The code is tested
  • Use of unsafe code is reasoned about in a comment
  • Update CHANGELOG.md appropriately, recording any changes, bug fixes, or other observable changes in behavior
  • The performance impact of the change is measured (see below)

Performance

No functional or critical path changes - changes to generated tonic/prost should be negligeable but we do not have CI for GCP based connectors at this time so have no automated guarantees or assurances in our CI/CD systems at this time.

@darach
Copy link
Member Author

darach commented Dec 15, 2022

This draft assumes tremor-rs/tremor-otelapis#16 will be merged at some point - after we update github actions so that our CI has a working protoc 😬. Fun times.

Copy link
Member

@Licenser Licenser left a comment

Choose a reason for hiding this comment

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

Woooh! Much grpc!

@@ -10,15 +10,22 @@
## [0.13.0-rc.3]

### New features

- Otel rebased to v19 specification version and deprecated v18 features removed. Breaking change.
Copy link
Member

Choose a reason for hiding this comment

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

this got to move up to "Unreleased"

Cargo.toml Outdated
prost = "0.9.0"
prost-types = "0.9.0"
tremor-otelapis = { version = "0.2.4" }
tremor-otelapis = { path = "../tremor-otelapis" } # WAS ... , version = "0.2.5" }
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs to change back to the version before we can merge it

@@ -241,6 +245,10 @@ uuid = { version = "1.1", features = ["v4"] }

# wal
qwal = { git = "https://github.com/tremor-rs/qwal" }
warp = "0.3.3"
Copy link
Member

Choose a reason for hiding this comment

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

probably should move up to the GCP section

@@ -28,6 +28,7 @@ pub(crate) fn insert_id(meta: Option<&Value>) -> String {
get_or_default(meta, "insert_id")
}

#[allow(clippy::cast_possible_wrap)] // casting seconds to u64 here is safe
Copy link
Member

Choose a reason for hiding this comment

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

<3 love the explaining comment! We should always do that!

otherwise => Some(std::time::Duration::from_nanos(otherwise).into()),
otherwise => {
let mut duration = prost_types::Duration {
seconds: otherwise as i64 / 1_000_000_000i64,
Copy link
Member

Choose a reason for hiding this comment

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

fringe case but should we move the cast to the outside to ensure we're not loosing a bit?

Suggested change
seconds: otherwise as i64 / 1_000_000_000i64,
seconds: (otherwise / 1_000_000_000u64) as i64,

Comment on lines +152 to +161
if let Some(split) = has_meta.get("split") {
return Some(LogSplit {
uid: split.get("uid").as_str().unwrap_or("").to_string(),
index: split.get("line").as_i32().unwrap_or(0),
total_splits: split.get("total_splits").as_i32().unwrap_or(0),
});
}

// Otherwise, None as mapping is optional
None
Copy link
Member

Choose a reason for hiding this comment

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

Option allows for ? which lets us unnest the code here, and get_<type> on value combines get and as :)

Suggested change
if let Some(split) = has_meta.get("split") {
return Some(LogSplit {
uid: split.get("uid").as_str().unwrap_or("").to_string(),
index: split.get("line").as_i32().unwrap_or(0),
total_splits: split.get("total_splits").as_i32().unwrap_or(0),
});
}
// Otherwise, None as mapping is optional
None
let split = has_meta.get("split")?;
Some(LogSplit {
uid: split.get_str("uid").unwrap_or("").to_string(),
index: split.get_i32("line").unwrap_or(0),
total_splits: split.get_i32("total_splits").unwrap_or(0),
})

value: maybe_from_value(data.get("value"))?,
value: match data.get("value") {
Some(Value::Static(StaticNode::F64(v))) => Some(exemplar::Value::AsDouble(*v)),
Some(Value::Static(StaticNode::I64(v))) => Some(exemplar::Value::AsInt(*v)),
Copy link
Member

Choose a reason for hiding this comment

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

It's important to use as_i64 instead of matching on the value here otherwise it'll not match for other number types (like u64 or later 128 bit types that would "fit") (Same below)

@@ -208,13 +208,13 @@ sled = "0.34"

# opentelemetry
port_scanner = "0.1.5"
tonic = { version = "0.6.1", default-features = false, features = [
tonic = { version = "0.8.2", default-features = false, features = [
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tonic = { version = "0.8.2", default-features = false, features = [
tonic = { version = "0.8.3", default-features = false, features = [

Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
@Licenser
Copy link
Member

Does it make sense to keep this PR or a have things changed far enough after two years that it's worth closing this and taking a fresh look with the new connector design?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants