-
Notifications
You must be signed in to change notification settings - Fork 247
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
feat(wasi-observe): WASI Observe factor implementation #2787
base: main
Are you sure you want to change the base?
Conversation
f9de9d9
to
9f26551
Compare
0bbb37b
to
4461b03
Compare
43dcddc
to
1741e59
Compare
eb8dc27
to
f1487d5
Compare
77c48df
to
5f2c7c1
Compare
Signed-off-by: Caleb Schoepp <[email protected]>
5f2c7c1
to
810d05f
Compare
@@ -66,7 +66,7 @@ terminal = { path = "crates/terminal" } | |||
|
|||
subprocess = "0.2.9" | |||
tempfile = "3.8.0" | |||
tokio = { version = "1.23", features = ["full"] } | |||
tokio = { version = "1.40", features = ["full"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was necessary to make fake-opentelemetry-collector
happy which relies on an up to date version of tokio
.
|
||
impl From<tracer::SpanContext> for opentelemetry::trace::SpanContext { | ||
fn from(sc: tracer::SpanContext) -> Self { | ||
// TODO(Reviewer): Should this be try_from instead an propagate this error out of the WIT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these conversions end up being fallible b/c we're parsing things that must conform to a format. Right now I handle this by just quelling the error and silently omitting the invalid data. This doesn't feel like a great user experience (even if it is documented in the WIT interface).
An alternative would be to make this try_from
and then expose the error out through the WIT interface. This would make change:
start: func(name: string, options: option<start-options>) -> span;
tostart: func(name: string, options: option<start-options>) -> result<span>;
add-link: func(link: link);
toadd-link: func(link: link) -> result<()>;
I don't love the idea of exposing errors out of these functions just for the incorrect parsing of a span context. I'm not sure what the right choice is here.
@@ -1463,3 +1397,573 @@ route = "/..." | |||
Ok(()) | |||
} | |||
} | |||
|
|||
// TODO(Reviewer): How can I move this to a new file? I wasn't able to get the imports to work out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't figure out how to put this module in another file, but still import things from the testcases module.
import tracer; | ||
} | ||
|
||
// TODO(Reviewer): Should we make this an experimental wasi package or a Spin package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest that we land WASI Observe as a release candidate wasi:[email protected]
. I think it is the right choice to put it in the WASI namespace b/c WASI Observe is a phase 1 proposal.
If we're feeling conservative we could add this to a new http-trigger-experimental
world where we make less support guarantees.
package fermyon:spin@2.0.0;
/// The full world of a guest targeting an http-trigger
world http-trigger {
include platform;
export wasi:http/incoming-handler@0.2.0;
}
/// Like `http-trigger`, but using WASI 0.2.0-rc-2023-10-18
world http-trigger-rc20231018 {
include platform-rc20231018;
export wasi:http/incoming-handler@0.2.0-rc-2023-10-18;
}
/// Like `http-trigger`, but experimental and with no support guarantees
world http-trigger-experimental {
include platform-experimental;
export wasi:http/incoming-handler@0.2.0;
}
/// The imports needed for a guest to run on a Spin host
world platform {
include wasi:cli/imports@0.2.0;
import wasi:http/outgoing-handler@0.2.0;
import llm;
import redis;
import mqtt;
import postgres;
import mysql;
import sqlite;
import key-value;
import variables;
}
/// Like `platform`, but using WASI 0.2.0-rc-2023-10-18
world platform-rc20231018 {
include wasi:cli/reactor@0.2.0-rc-2023-10-18;
import wasi:http/outgoing-handler@0.2.0-rc-2023-10-18;
import llm;
import redis;
import mqtt;
import postgres;
import mysql;
import sqlite;
import key-value;
import variables;
}
/// Like `platform`, but experimental and with no support guarantees
world platform-experimental {
include platform;
include wasi:observe/imports@0.2.2-rc2024-09-17;
}
} | ||
|
||
// TODO(Reviewer): Should we make this an experimental wasi package or a Spin package | ||
// TODO(Reviewer): Would adding a metrics interface to this in a future version be a breaking change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dicej does adding a new interface to a wold constitute a breaking change?
Signed-off-by: Caleb Schoepp <[email protected]>
TODO item for Caleb: It seems that this is not working with the Rust |
ObserveFactor
to handle proper span nesting of other factors.