Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ By [@SimonSapin](https://github.com/SimonSapin)

## 🚀 Features

### rhai logging functions now accept Dynamic parameters ([PR #1521](https://github.com/apollographql/router/pull/1521))

Prior to this change, rhai logging functions worked with string parameters. This change means that any valid rhai object
may now be passed as a logging parameter.

By [@garypen](https://github.com/garypen)

### Reduce initial memory footprint by lazily populating introspection query cache ([#1516](https://github.com/apollographql/router/issues/1516))

In an early alpha release of the Router, we only executed certain "known" introspection queries because of prior technical constraints that prohibited us from doing something more flexible. Because the set of introspection queries was "known", it made sense to cache them.
Expand All @@ -304,7 +311,6 @@ This change removes the cache entirely and allows introspection queries served b

By [@o0Ignition0o](https://github.com/o0Ignition0o)


### Expose query plan in extensions for GraphQL response (experimental) ([PR #1470](https://github.com/apollographql/router/pull/1470))

Expose query plan in extensions for GraphQL response. Only experimental for now, no documentation available.
Expand Down
32 changes: 13 additions & 19 deletions apollo-router/src/plugins/rhai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1251,20 +1251,20 @@ impl Rhai {
Ok(())
})
// Register a series of logging functions
.register_fn("log_trace", |x: &str| {
tracing::trace!("{}", x);
.register_fn("log_trace", |out: Dynamic| {
tracing::trace!(%out, "rhai_trace");
})
.register_fn("log_debug", |x: &str| {
tracing::debug!("{}", x);
.register_fn("log_debug", |out: Dynamic| {
tracing::debug!(%out, "rhai_debug");
})
.register_fn("log_info", |x: &str| {
tracing::info!("{}", x);
.register_fn("log_info", |out: Dynamic| {
tracing::info!(%out, "rhai_info");
})
.register_fn("log_warn", |x: &str| {
tracing::warn!("{}", x);
.register_fn("log_warn", |out: Dynamic| {
tracing::warn!(%out, "rhai_warn");
})
.register_fn("log_error", |x: &str| {
tracing::error!("{}", x);
.register_fn("log_error", |out: Dynamic| {
tracing::error!(%out, "rhai_error");
})
// Register a function for printing to stderr
.register_fn("eprint", |x: &str| {
Expand Down Expand Up @@ -1445,15 +1445,9 @@ mod tests {
let mut mock_service = MockExecutionService::new();
mock_service.expect_clone().return_once(move || {
let mut mock_service = MockExecutionService::new();
mock_service
.expect_call()
.times(1)
.returning(move |req: ExecutionRequest| {
Ok(ExecutionResponse::fake_builder()
.context(req.context)
.build())
});

// The execution_service in test.rhai throws an exception, so we never
// get a call into the mock service...
mock_service.expect_call().never();
mock_service
});

Expand Down