Skip to content

Commit

Permalink
Revert "chore: log blueprint gen time (#2533)"
Browse files Browse the repository at this point in the history
This reverts commit 1295190.

# Conflicts:
#	src/core/blueprint/from_config.rs
  • Loading branch information
tusharmath committed Jul 27, 2024
1 parent 30ab5ad commit de6a9e7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ opentelemetry-stdout = { version = "0.4.0", features = [
opentelemetry-appender-tracing = { version = "0.4.0" }
opentelemetry-prometheus = "0.16.0"
phonenumber = "0.3.4"
chrono = {version = "0.4.38", features = ["wasmbind"]}
chrono = "0.4.38"
async-graphql-extension-apollo-tracing = { version = "3.2.15" }
headers = "0.3.9" # previous version until hyper is updated to 1+
mime = "0.3.17"
Expand Down
24 changes: 1 addition & 23 deletions src/cli/server/http_server.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use std::cell::Cell;
use std::ops::Deref;
use std::sync::Arc;

use anyhow::Result;
use tokio::sync::oneshot::{self};
use tracing::subscriber::DefaultGuard;

use super::http_1::start_http_1;
use super::http_2::start_http_2;
Expand All @@ -13,9 +11,6 @@ use crate::cli::telemetry::init_opentelemetry;
use crate::cli::CLIError;
use crate::core::blueprint::{Blueprint, Http};
use crate::core::config::ConfigModule;
thread_local! {
static TRACING_GUARD: Cell<Option<DefaultGuard>> = const { Cell::new(None) };
}

pub struct Server {
config_module: ConfigModule,
Expand Down Expand Up @@ -55,27 +50,10 @@ impl Server {
pub async fn fork_start(self) -> Result<()> {
let runtime = tokio::runtime::Builder::new_multi_thread()
.worker_threads(self.config_module.deref().server.get_workers())
.on_thread_start(|| {
// initialize default tracing setup for the cli execution for every thread that
// is spawned based on https://github.com/tokio-rs/tracing/issues/593#issuecomment-589857097
// and required due to the fact that later for tracing the global subscriber
// will be set by `src/cli/opentelemetry.rs` and until that we need
// to use the default tracing configuration for cli output. And
// since `set_default` works only for current thread incorporate this
// with tokio runtime
let guard = tracing::subscriber::set_default(
crate::core::tracing::default_tracing_tailcall(),
);

TRACING_GUARD.set(Some(guard));
})
.on_thread_stop(|| {
TRACING_GUARD.take();
})
.enable_all()
.build()?;

let result = runtime.spawn(self.start()).await?;
let result = runtime.spawn(async { self.start().await }).await?;
runtime.shutdown_background();

result
Expand Down
13 changes: 2 additions & 11 deletions src/core/blueprint/from_config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::collections::{BTreeMap, BTreeSet, HashMap};

use async_graphql::dynamic::SchemaBuilder;
use chrono::Utc;

use self::telemetry::to_opentelemetry;
use super::{Server, TypeLike};
Expand Down Expand Up @@ -124,9 +123,7 @@ impl TryFrom<&ConfigModule> for Blueprint {
type Error = ValidationError<String>;

fn try_from(config_module: &ConfigModule) -> Result<Self, Self::Error> {
let start = Utc::now().timestamp_millis();

let blueprint = config_blueprint()
config_blueprint()
.try_fold(
// Apply required transformers to the configuration
&config_module.to_owned().transform(Required).to_result()?,
Expand All @@ -139,12 +136,6 @@ impl TryFrom<&ConfigModule> for Blueprint {
Err(e) => Valid::fail(e.to_string()),
}
})
.to_result();

let end = Utc::now().timestamp_millis();
let elapsed = ((end - start) as f32) / 1000.0;
tracing::info!("🏭 Blueprint generated in {:.3} seconds", elapsed);

blueprint
.to_result()
}
}

2 comments on commit de6a9e7

@github-actions
Copy link

Choose a reason for hiding this comment

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

running 232 tests
test run_execution_spec::add-field-index-list.md ... ok
test run_execution_spec::add-field-many-list.md ... ok
test run_execution_spec::add-field-many.md ... ok
test run_execution_spec::add-field-modify.md ... ok
test run_execution_spec::add-field-with-modify.md ... ok
test run_execution_spec::add-field-with-composition.md ... ok
test run_execution_spec::add-field.md ... ok
test run_execution_spec::apollo-tracing.md ... ok
test run_execution_spec::async-cache-disabled.md ... ok
test run_execution_spec::async-cache-enabled.md ... ok
test run_execution_spec::async-cache-enable-multiple-resolvers.md ... FAILED
test run_execution_spec::async-cache-global.md ... ok
test run_execution_spec::async-cache-inflight-request.md ... ok
test run_execution_spec::auth-protected-without-auth.md ... ok
test run_execution_spec::auth-jwt.md ... ok
test run_execution_spec::auth-basic.md ... ok
test run_execution_spec::batching-disabled.md ... ok
test run_execution_spec::batching-default.md ... ok
test run_execution_spec::auth.md ... ok
test run_execution_spec::batching-group-by-default.md ... ok
test run_execution_spec::batching-group-by-optional-key.md ... ok
test run_execution_spec::batching-group-by.md ... ok
test run_execution_spec::batching-post.md ... ok
test run_execution_spec::batching.md ... ok
test run_execution_spec::cache-control.md ... ok
test run_execution_spec::caching-collision.md ... ok
test run_execution_spec::caching.md ... ok
test run_execution_spec::call-graphql-datasource.md ... ok
test run_execution_spec::call-multiple-steps-piping.md ... ok
test run_execution_spec::call-mutation.md ... ok
test run_execution_spec::call-operator.md ... ok
test run_execution_spec::cors-allow-cred-false.md ... ok
test run_execution_spec::cors-invalid-expose-headers.md ... ok
test run_execution_spec::cors-invalid-headers.md ... ok
test run_execution_spec::cors-invalid-methods.md ... ok
test run_execution_spec::cors-invalid-origins.md ... ok
test run_execution_spec::cors-allow-cred-true.md ... ok
test run_execution_spec::cors-allow-cred-vary.md ... ok
test run_execution_spec::custom-headers.md ... ok
test run_execution_spec::dedupe_batch_query_execution.md ... ok
test run_execution_spec::default-value-arg.md ... ok
test run_execution_spec::experimental-headers-error.md ... ok
test run_execution_spec::default-value-config.md ... ok
test run_execution_spec::env-value.md ... ok
test run_execution_spec::experimental-headers.md ... ok
test run_execution_spec::graphql-dataloader-batch-request.md ... ok
test run_execution_spec::graphql-dataloader-no-batch-request.md ... ok
test run_execution_spec::graphql-datasource-errors.md ... FAILED
test run_execution_spec::graphql-datasource-mutation.md ... ok
test run_execution_spec::graphql-datasource-no-args.md ... ok
test run_execution_spec::graphql-datasource-query-directives.md ... ok
test run_execution_spec::graphql-datasource-with-args.md ... ok
test run_execution_spec::graphql-datasource-with-empty-enum.md ... ok
test run_execution_spec::graphql-datasource-with-mandatory-enum.md ... FAILED
test run_execution_spec::graphql-nested-datasource.md ... ok
test run_execution_spec::grpc-batch.md ... ok
test run_execution_spec::grpc-json.md ... ok
test run_execution_spec::grpc-error.md ... ok
test run_execution_spec::grpc-map.md ... ok
test run_execution_spec::grpc-override-url-from-upstream.md ... ok
test run_execution_spec::grpc-oneof.md ... FAILED
test run_execution_spec::grpc-proto-with-same-package.md ... ok
test run_execution_spec::grpc-reflection.md ... ok
test run_execution_spec::grpc-simple.md ... ok
test run_execution_spec::grpc-url-from-upstream.md ... ok
test run_execution_spec::https.md ... ok
test run_execution_spec::inline-field.md ... FAILED
test run_execution_spec::inline-index-list.md ... ok
test run_execution_spec::input-type-protected-error.md ... ok
test run_execution_spec::io-cache.md ... ok
test run_execution_spec::inline-many-list.md ... ok
test run_execution_spec::inline-many.md ... ok
test run_execution_spec::js-directive.md ... FAILED
test run_execution_spec::modified-field.md ... ok
test run_execution_spec::mutation-put.md ... ok
test run_execution_spec::jsonplaceholder-call-post.md ... ok
test run_execution_spec::mutation.md ... ok
test run_execution_spec::n-plus-one-list.md ... ok
test run_execution_spec::n-plus-one.md ... ok
test run_execution_spec::nested-objects.md ... ok
test run_execution_spec::nested-recursive-types.md ... ok
test run_execution_spec::nesting-level3.md ... ok
test run_execution_spec::nullable-arg-query.md ... ok
test run_execution_spec::omit-index-list.md ... ok
test run_execution_spec::omit-resolved-by-parent.md ... FAILED
test run_execution_spec::recursive-types-no-resolver.md ... ok
test run_execution_spec::recursive-types-json.md ... ok
test run_execution_spec::omit-many.md ... ok
test run_execution_spec::ref-other-nested.md ... ok
test run_execution_spec::recursive-types.md ... ok
test run_execution_spec::ref-other.md ... ok
test run_execution_spec::related-fields-recursive.md ... ok
test run_execution_spec::rename-field.md ... ok
test run_execution_spec::request-to-upstream-batching.md ... ok
test run_execution_spec::resolve-with-headers.md ... ok
test run_execution_spec::resolve-with-vars.md ... ok
test run_execution_spec::resolved-by-parent.md ... FAILED
test run_execution_spec::rest-api-error.md ... ok
test run_execution_spec::rest-api-post.md ... ok
test run_execution_spec::rest-api.md ... ok
test run_execution_spec::showcase.md ... ok
test run_execution_spec::test-add-field-error.md ... ok
test run_execution_spec::simple-graphql.md ... ok
test run_execution_spec::simple-query.md ... ok
test run_execution_spec::test-add-field-list.md ... ok
test run_execution_spec::test-all-blueprint-errors.md ... ok
test run_execution_spec::test-batch-operator-post.md ... ok
test run_execution_spec::test-add-field.md ... ok
test run_execution_spec::test-add-link-to-empty-config.md ... ok
test run_execution_spec::test-call-operator-errors.md ... ok
test run_execution_spec::test-conflict-allowed-headers.md ... ok
test run_execution_spec::test-conflict-vars.md ... ok
test run_execution_spec::test-batching-group-by.md ... ok
test run_execution_spec::test-cache.md ... ok
test run_execution_spec::test-dbl-usage-many.md ... ok
test run_execution_spec::test-custom-scalar.md ... ok
test run_execution_spec::test-directives-undef-null-fields.md ... ok
test run_execution_spec::test-duplicated-link.md ... ok
test run_execution_spec::test-empty-link.md ... ok
test run_execution_spec::test-custom-types.md ... ok
test run_execution_spec::test-enable-jit.md ... ok
test run_execution_spec::test-description-many.md ... ok
test run_execution_spec::test-enum-aliases.md ... ok
test run_execution_spec::test-enum-empty.md ... ok
test run_execution_spec::test-enum-default.md ... ok
test run_execution_spec::test-enum-merge.md ... ok
test run_execution_spec::test-expr-error.md ... ok
test run_execution_spec::test-expr-scalar-as-string.md ... ok
test run_execution_spec::test-enum-description.md ... FAILED
test run_execution_spec::test-expr-with-add-field.md ... ok
test run_execution_spec::test-expr-with-inline.md ... ok
test run_execution_spec::test-enum.md ... FAILED
test run_execution_spec::test-field-already-implemented-from-Interface.md ... ok
test run_execution_spec::test-graphqlsource-no-base-url.md ... ok
test run_execution_spec::test-expr-with-mustache.md ... ok
test run_execution_spec::test-groupby-without-batching.md ... ok
test run_execution_spec::test-grpc-group-by.md ... ok
test run_execution_spec::test-grpc-invalid-method-format.md ... ok
test run_execution_spec::test-grpc-invalid-proto-id.md ... ok
test run_execution_spec::test-grpc-missing-fields.md ... ok
test run_execution_spec::test-grpc-nested-data.md ... ok
test run_execution_spec::test-grpc-nested-optional.md ... ok
test run_execution_spec::test-grpc-optional.md ... ok
test run_execution_spec::test-grpc-proto-path.md ... ok
test run_execution_spec::test-grpc-service-method.md ... ok
test run_execution_spec::test-grpc-service.md ... ok
test run_execution_spec::test-expr.md ... ok
test run_execution_spec::test-hostname-faliure.md ... ok
test run_execution_spec::test-graphqlsource.md ... ok
test run_execution_spec::test-grpc.md ... ok
test run_execution_spec::test-http-baseurl.md ... ok
test run_execution_spec::test-http-batchKey.md ... FAILED
test run_execution_spec::test-http-with-add-field.md ... ok
test run_execution_spec::test-http-with-inline.md ... ok
test run_execution_spec::test-http-with-mustache-expr.md ... ok
test run_execution_spec::test-http-headers.md ... ok
test run_execution_spec::test-inline-error.md ... ok
test run_execution_spec::test-http-tmpl.md ... ok
test run_execution_spec::test-http.md ... ok
test run_execution_spec::test-inline-list.md ... ok
test run_execution_spec::test-inline.md ... ok
test run_execution_spec::test-input-out.md ... ok
test run_execution_spec::test-input-with-arg-out.md ... ok
test run_execution_spec::test-input-documentation.md ... ok
test run_execution_spec::test-interface-from-json.md ... ok
test run_execution_spec::test-invalid-query-in-http.md ... ok
test run_execution_spec::test-invalid-server.md ... ok
test run_execution_spec::test-js-multi-onRequest-handlers.md ... ok
test run_execution_spec::test-js-multiple-scripts.md ... ok
test run_execution_spec::test-interface-result.md ... ok
test run_execution_spec::test-interface.md ... ok
test run_execution_spec::test-lack-resolver.md ... ok
test run_execution_spec::test-js-request-response-2.md ... ok
test run_execution_spec::test-merge-batch.md ... ok
test run_execution_spec::test-merge-nested.md ... ok
test run_execution_spec::test-js-request-response.md ... ok
test run_execution_spec::test-list-args.md ... ok
test run_execution_spec::test-merge-query.md ... ok
test run_execution_spec::test-merge-union.md ... ok
test run_execution_spec::test-merge-right-with-link-config.md ... ok
test run_execution_spec::test-missing-mutation-resolver.md ... ok
test run_execution_spec::test-missing-query-resolver.md ... ok
test run_execution_spec::test-missing-root-types.md ... ok
test run_execution_spec::test-missing-schema-query.md ... ok
test run_execution_spec::test-missing-argument-on-all-resolvers.md ... ok
test run_execution_spec::test-merge-server-sdl.md ... ok
test run_execution_spec::test-multiple-config-types.md ... ok
test run_execution_spec::test-multiple-resolvable-directives-on-field.md ... ok
test run_execution_spec::test-modify.md ... ok
test run_execution_spec::test-multi-interface.md ... ok
test run_execution_spec::test-nested-input.md ... ok
test run_execution_spec::test-no-base-url.md ... ok
test run_execution_spec::test-nested-value.md ... ok
test run_execution_spec::test-nested-link.md ... ok
test run_execution_spec::test-null-in-array.md ... ok
test run_execution_spec::test-null-in-object.md ... ok
test run_execution_spec::test-omit.md ... ok
test run_execution_spec::test-params-as-body.md ... ok
test run_execution_spec::test-omit-list.md ... ok
test run_execution_spec::test-query.md ... ok
test run_execution_spec::test-query-documentation.md ... ok
test run_execution_spec::test-response-header-value.md ... ok
test run_execution_spec::test-response-headers-multi.md ... ok
test run_execution_spec::test-response-headers-name.md ... ok
test run_execution_spec::test-ref-other.md ... ok
test run_execution_spec::test-response-header-merge.md ... ok
test run_execution_spec::test-scalars-builtin.md ... ok
test run_execution_spec::test-scalars-integers.md ... ok
test run_execution_spec::test-scalars-validation.md ... ok
test run_execution_spec::test-server-base-types.md ... ok
test run_execution_spec::test-set-cookie-headers.md ... ok
test run_execution_spec::test-server-vars.md ... ok
test run_execution_spec::test-static-value.md ... ok
test run_execution_spec::test-undefined-query.md ... ok
test run_execution_spec::test-scalars.md ... ok
test run_execution_spec::test-union-many-types.md ... ok
test run_execution_spec::test-union-same-types.md ... ok
test run_execution_spec::test-union-ambiguous.md ... FAILED
test run_execution_spec::test-tag.md ... ok
test run_execution_spec::test-upstream-headers.md ... ok
test run_execution_spec::undeclared-type-no-base-url.md ... ok
test run_execution_spec::undeclared-type.md ... ok
test run_execution_spec::upstream-batching.md ... ok
test run_execution_spec::test-union.md ... FAILED
test run_execution_spec::test-upstream.md ... ok
test run_execution_spec::upstream-fail-request.md ... ok
test run_execution_spec::with-args-url.md ... ok
test run_execution_spec::with-args.md ... ok
test run_execution_spec::with-nesting.md ... ok
test run_execution_spec::yaml-nested-unions.md ... ok
test run_execution_spec::yaml-union-in-type.md ... ok
test run_execution_spec::yaml-union.md ... ok

failures:

---- run_execution_spec::async-cache-enable-multiple-resolvers.md ----
test panicked: snapshot assertion for 'async-cache-enable-multiple-resolvers.md_0' failed in line 202

---- run_execution_spec::graphql-datasource-errors.md ----
test panicked: not yet implemented

---- run_execution_spec::graphql-datasource-with-mandatory-enum.md ----
test panicked: snapshot assertion for 'graphql-datasource-with-mandatory-enum.md_0' failed in line 202

---- run_execution_spec::grpc-oneof.md ----
test panicked: snapshot assertion for 'grpc-oneof.md_0' failed in line 202

---- run_execution_spec::inline-field.md ----
test panicked: snapshot assertion for 'inline-field.md_0' failed in line 202

---- run_execution_spec::js-directive.md ----
test panicked: snapshot assertion for 'js-directive.md_0' failed in line 202

---- run_execution_spec::omit-resolved-by-parent.md ----
test panicked: snapshot assertion for 'omit-resolved-by-parent.md_0' failed in line 202

---- run_execution_spec::resolved-by-parent.md ----
test panicked: snapshot assertion for 'resolved-by-parent.md_0' failed in line 202

---- run_execution_spec::test-enum-description.md ----
test panicked: snapshot assertion for 'test-enum-description.md_2' failed in line 202

---- run_execution_spec::test-enum.md ----
test panicked: snapshot assertion for 'test-enum.md_2' failed in line 202

---- run_execution_spec::test-http-batchKey.md ----
test panicked: snapshot assertion for 'test-http-batchKey.md_0' failed in line 202

---- run_execution_spec::test-union-ambiguous.md ----
test panicked: snapshot assertion for 'test-union-ambiguous.md_3' failed in line 202

---- run_execution_spec::test-union.md ----
test panicked: snapshot assertion for 'test-union.md_3' failed in line 202

failures:
run_execution_spec::async-cache-enable-multiple-resolvers.md
run_execution_spec::graphql-datasource-errors.md
run_execution_spec::graphql-datasource-with-mandatory-enum.md
run_execution_spec::grpc-oneof.md
run_execution_spec::inline-field.md
run_execution_spec::js-directive.md
run_execution_spec::omit-resolved-by-parent.md
run_execution_spec::resolved-by-parent.md
run_execution_spec::test-enum-description.md
run_execution_spec::test-enum.md
run_execution_spec::test-http-batchKey.md
run_execution_spec::test-union-ambiguous.md
run_execution_spec::test-union.md

test result: FAILED. 219 passed; 13 failed; 0 ignored; 0 measured; 0 filtered out; finished in 14.60s

@github-actions
Copy link

Choose a reason for hiding this comment

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

Running 30s test @ http://localhost:8000/graphql

4 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev
Latency 7.41ms 3.27ms 82.46ms 71.56%
Req/Sec 3.41k 181.81 3.81k 91.25%

407201 requests in 30.01s, 2.04GB read

Requests/sec: 13570.58

Transfer/sec: 69.65MB

Please sign in to comment.