Skip to content

Commit

Permalink
Enable Subscription Functionality for GraphiQL-Explorer (#1125)
Browse files Browse the repository at this point in the history
Co-authored-by: Rafał Pitoń <[email protected]>
Co-authored-by: pytest-benchmark <>
  • Loading branch information
fabiangfd and rafalp authored Oct 25, 2023
1 parent 48fd7c7 commit b468817
Show file tree
Hide file tree
Showing 14 changed files with 2,378 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ariadne/explorer/graphiql.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ def __init__(
title: str = "Ariadne GraphQL",
explorer_plugin: bool = False,
default_query: str = DEFAULT_QUERY,
subscription_url: str = "",
) -> None:
self.parsed_html = render_template(
GRAPHIQL_HTML,
{
"title": title,
"enable_explorer_plugin": explorer_plugin,
"default_query": escape_default_query(default_query),
"subscription_url": subscription_url,
},
)

Expand Down
5 changes: 5 additions & 0 deletions ariadne/explorer/templates/graphiql.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
<script>
var fetcher = GraphiQL.createFetcher({
url: window.location.href,
{% if subscription_url %}
subscriptionUrl: "{{ subscription_url }}",
{% else %}
subscriptionUrl: (window.location.protocol === "https:" ? "wss" : "ws") + "://" + window.location.host + window.location.pathname,
{% endif %}
});

function AriadneGraphiQL() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
{
"machine_info": {
"node": "fv-az1250-266",
"processor": "x86_64",
"machine": "x86_64",
"python_compiler": "GCC 11.4.0",
"python_implementation": "CPython",
"python_implementation_version": "3.10.13",
"python_version": "3.10.13",
"python_build": [
"main",
"Aug 28 2023 08:28:42"
],
"release": "6.2.0-1014-azure",
"system": "Linux",
"cpu": {
"python_version": "3.10.13.final.0 (64 bit)",
"cpuinfo_version": [
9,
0,
0
],
"cpuinfo_version_string": "9.0.0",
"arch": "X86_64",
"bits": 64,
"count": 2,
"arch_string_raw": "x86_64",
"vendor_id_raw": "GenuineIntel",
"brand_raw": "Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz",
"hz_advertised_friendly": "2.6000 GHz",
"hz_actual_friendly": "2.0951 GHz",
"hz_advertised": [
2600000000,
0
],
"hz_actual": [
2095077000,
0
],
"stepping": 4,
"model": 85,
"family": 6,
"flags": [
"3dnowprefetch",
"abm",
"adx",
"aes",
"apic",
"avx",
"avx2",
"avx512bw",
"avx512cd",
"avx512dq",
"avx512f",
"avx512vl",
"bmi1",
"bmi2",
"clflush",
"clflushopt",
"cmov",
"constant_tsc",
"cpuid",
"cx16",
"cx8",
"de",
"erms",
"f16c",
"fma",
"fpu",
"fsgsbase",
"fxsr",
"hle",
"ht",
"hypervisor",
"invpcid",
"invpcid_single",
"lahf_lm",
"lm",
"mca",
"mce",
"md_clear",
"mmx",
"movbe",
"msr",
"mtrr",
"nopl",
"nx",
"osxsave",
"pae",
"pat",
"pcid",
"pclmulqdq",
"pdpe1gb",
"pge",
"pni",
"popcnt",
"pse",
"pse36",
"pti",
"rdrand",
"rdrnd",
"rdseed",
"rdtscp",
"rep_good",
"rtm",
"sep",
"smap",
"smep",
"ss",
"sse",
"sse2",
"sse4_1",
"sse4_2",
"ssse3",
"syscall",
"tsc",
"vme",
"xsave",
"xsavec",
"xsaveopt",
"xsaves",
"xtopology"
],
"l3_cache_size": 37486592,
"l2_cache_size": 2097152,
"l1_data_cache_size": 65536,
"l1_instruction_cache_size": 65536,
"l2_cache_line_size": 256,
"l2_cache_associativity": 6
}
},
"commit_info": {
"id": "73ce096d9b567ead19faf6554c1c5018ef773787",
"time": "2023-10-24T13:24:53+00:00",
"author_time": "2023-10-24T13:24:53+00:00",
"dirty": false,
"project": "ariadne",
"branch": "master"
},
"benchmarks": [
{
"group": null,
"name": "test_query_without_extensions",
"fullname": "benchmark/test_extensions.py::test_query_without_extensions",
"params": null,
"param": null,
"extra_info": {},
"options": {
"disable_gc": false,
"timer": "perf_counter",
"min_rounds": 5,
"max_time": 1.0,
"min_time": 5e-06,
"warmup": false
},
"stats": {
"min": 1.6618058119999972,
"max": 1.7346449559999968,
"mean": 1.6955735507999976,
"stddev": 0.031798397439802464,
"rounds": 5,
"median": 1.7008382500000039,
"iqr": 0.05636636599999889,
"q1": 1.664090188999996,
"q3": 1.7204565549999948,
"iqr_outliers": 0,
"stddev_outliers": 2,
"outliers": "2;0",
"ld15iqr": 1.6618058119999972,
"hd15iqr": 1.7346449559999968,
"ops": 0.5897709359338524,
"total": 8.477867753999988,
"iterations": 1
}
},
{
"group": null,
"name": "test_query_with_noop_extension",
"fullname": "benchmark/test_extensions.py::test_query_with_noop_extension",
"params": null,
"param": null,
"extra_info": {},
"options": {
"disable_gc": false,
"timer": "perf_counter",
"min_rounds": 5,
"max_time": 1.0,
"min_time": 5e-06,
"warmup": false
},
"stats": {
"min": 1.671564552999996,
"max": 1.7630059709999983,
"mean": 1.718160531999996,
"stddev": 0.0413684094332238,
"rounds": 5,
"median": 1.724863451999994,
"iqr": 0.07700485250001066,
"q1": 1.6775821457499909,
"q3": 1.7545869982500015,
"iqr_outliers": 0,
"stddev_outliers": 2,
"outliers": "2;0",
"ld15iqr": 1.671564552999996,
"hd15iqr": 1.7630059709999983,
"ops": 0.5820177925027569,
"total": 8.59080265999998,
"iterations": 1
}
},
{
"group": null,
"name": "test_query_with_open_telemetry_extension",
"fullname": "benchmark/test_extensions.py::test_query_with_open_telemetry_extension",
"params": null,
"param": null,
"extra_info": {},
"options": {
"disable_gc": false,
"timer": "perf_counter",
"min_rounds": 5,
"max_time": 1.0,
"min_time": 5e-06,
"warmup": false
},
"stats": {
"min": 2.0004514440000207,
"max": 2.102721115999998,
"mean": 2.051136749,
"stddev": 0.03878771006323934,
"rounds": 5,
"median": 2.051837250999995,
"iqr": 0.05530808599999659,
"q1": 2.0229952522499985,
"q3": 2.078303338249995,
"iqr_outliers": 0,
"stddev_outliers": 2,
"outliers": "2;0",
"ld15iqr": 2.0004514440000207,
"hd15iqr": 2.102721115999998,
"ops": 0.48753453444171124,
"total": 10.255683744999999,
"iterations": 1
}
},
{
"group": null,
"name": "test_query_with_open_tracing_extension",
"fullname": "benchmark/test_extensions.py::test_query_with_open_tracing_extension",
"params": null,
"param": null,
"extra_info": {},
"options": {
"disable_gc": false,
"timer": "perf_counter",
"min_rounds": 5,
"max_time": 1.0,
"min_time": 5e-06,
"warmup": false
},
"stats": {
"min": 1.8273924780000073,
"max": 1.9061192089999963,
"mean": 1.8702541318000043,
"stddev": 0.0379858529240782,
"rounds": 5,
"median": 1.8883763050000084,
"iqr": 0.07008226699998943,
"q1": 1.8301663275000095,
"q3": 1.900248594499999,
"iqr_outliers": 0,
"stddev_outliers": 2,
"outliers": "2;0",
"ld15iqr": 1.8273924780000073,
"hd15iqr": 1.9061192089999963,
"ops": 0.5346866947100721,
"total": 9.351270659000022,
"iterations": 1
}
}
],
"datetime": "2023-10-24T13:26:26.299630",
"version": "4.0.0"
}
Loading

0 comments on commit b468817

Please sign in to comment.