Skip to content

Commit 32ad5f0

Browse files
doc: add graphql cache configuration documentation
Signed-off-by: Rob Myers <[email protected]>
1 parent 8790531 commit 32ad5f0

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

docs/content/configuration.md

+3
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,9 @@ that requires GraphQL schemas.
875875
| `caching.inter_query_builtin_cache.stale_entry_eviction_period_seconds` | `int64` | No | Stale entry eviction period in seconds. OPA will drop expired items from the cache every `stale_entry_eviction_period_seconds`. By default, set to `0` indicating stale entry eviction is disabled. |
876876
| `caching.inter_query_builtin_value_cache.max_num_entries` | `int` | No | Maximum number of entries in the Inter-query value cache. OPA will drop random items from the cache if this limit is exceeded. By default, set to `0` indicating unlimited size. |
877877
| `caching.inter_query_builtin_value_cache.named.io_jwt.max_num_entries` | `int` | No | Maximum number of entries in the `io_jwt` cache, used by the [`io.jwt` token verification](../policy-reference/#tokens) built-in functions. OPA will drop random items from the cache if this limit is exceeded. By default, this cache is disabled. |
878+
| `caching.inter_query_builtin_value_cache.named.graphql_schema.max_num_entries` | `int` | No | Maximum number of entries in the `graphql_schema` cache, used by the [`graphql` builtins](../policy-reference/#graphql) built-in functions to cache parsed schemas. OPA will drop random items from the cache if this limit is exceeded. By default, this cache is set to a maximum of 10 entries. |
879+
| `caching.inter_query_builtin_value_cache.named.graphql_schema_ast.max_num_entries` | `int` | No | Maximum number of entries in the `graphql_schema_ast` cache, used by the [`graphql` builtins](../policy-reference/#graphql) built-in functions to cache parsed schemas ast.Value. OPA will drop random items from the cache if this limit is exceeded. By default, this cache is set to a maximum of 10 entries. |
880+
| `caching.inter_query_builtin_value_cache.named.graphql_schema_doc.max_num_entries` | `int` | No | Maximum number of entries in the `graphql_schema_doc` cache, used by the [`graphql` builtins](../policy-reference/#graphql) built-in functions to cache parsed schemas as a SchemaDocument. OPA will drop random items from the cache if this limit is exceeded. By default, this cache is set to a maximum of 10 entries. |
878881

879882
## Distributed tracing
880883

v1/plugins/discovery/discovery_test.go

+28-4
Original file line numberDiff line numberDiff line change
@@ -1721,8 +1721,11 @@ func TestReconfigureWithLocalOverride(t *testing.T) {
17211721
"inter_query_builtin_cache": {"max_size_bytes": 10000000, "forced_eviction_threshold_percentage": 90},
17221722
"inter_query_builtin_value_cache": {
17231723
"named": {
1724-
"io_jwt": {"max_num_entries": 55}
1725-
}
1724+
"io_jwt": {"max_num_entries": 55},
1725+
"graphql_schema": {"max_num_entries": 10},
1726+
"graphql_schema_ast": {"max_num_entries": 10},
1727+
"graphql_schema_doc": {"max_num_entries": 10}
1728+
}
17261729
}
17271730
}
17281731
}`)
@@ -1888,8 +1891,11 @@ func TestReconfigureWithLocalOverride(t *testing.T) {
18881891
"inter_query_builtin_cache": {"max_size_bytes": 200, "stale_entry_eviction_period_seconds": 10, "forced_eviction_threshold_percentage": 200},
18891892
"inter_query_builtin_value_cache": {
18901893
"named": {
1891-
"io_jwt": {"max_num_entries": 10}
1892-
}
1894+
"io_jwt": {"max_num_entries": 10},
1895+
"graphql_schema": {"max_num_entries": 11},
1896+
"graphql_schema_ast": {"max_num_entries": 12},
1897+
"graphql_schema_doc": {"max_num_entries": 13}
1898+
}
18931899
}
18941900
}
18951901
}
@@ -1906,6 +1912,9 @@ func TestReconfigureWithLocalOverride(t *testing.T) {
19061912
"caching.inter_query_builtin_cache.max_size_bytes",
19071913
"caching.inter_query_builtin_cache.forced_eviction_threshold_percentage",
19081914
"caching.inter_query_builtin_value_cache.named.io_jwt.max_num_entries",
1915+
"caching.inter_query_builtin_value_cache.named.graphql_schema.max_num_entries",
1916+
"caching.inter_query_builtin_value_cache.named.graphql_schema_ast.max_num_entries",
1917+
"caching.inter_query_builtin_value_cache.named.graphql_schema_doc.max_num_entries",
19091918
}
19101919
for _, k := range expectedOverriddenKeys {
19111920
if !strings.Contains(disco.status.Message, k) {
@@ -1928,6 +1937,12 @@ func TestReconfigureWithLocalOverride(t *testing.T) {
19281937
*maxNumEntriesInterQueryValueCache = 0
19291938
maxNumEntriesJWTValueCache := new(int)
19301939
*maxNumEntriesJWTValueCache = 55
1940+
maxNumEntriesGraphQLSchemaValueCache := new(int)
1941+
*maxNumEntriesGraphQLSchemaValueCache = 10
1942+
maxNumEntriesGraphQLSchemaAstValueCache := new(int)
1943+
*maxNumEntriesGraphQLSchemaAstValueCache = 10
1944+
maxNumEntriesGraphQLSchemaDocValueCache := new(int)
1945+
*maxNumEntriesGraphQLSchemaDocValueCache = 10
19311946

19321947
expectedCacheConf := &cache.Config{
19331948
InterQueryBuiltinCache: cache.InterQueryBuiltinCacheConfig{
@@ -1941,6 +1956,15 @@ func TestReconfigureWithLocalOverride(t *testing.T) {
19411956
"io_jwt": {
19421957
MaxNumEntries: maxNumEntriesJWTValueCache,
19431958
},
1959+
"graphql_schema": {
1960+
MaxNumEntries: maxNumEntriesGraphQLSchemaValueCache,
1961+
},
1962+
"graphql_schema_ast": {
1963+
MaxNumEntries: maxNumEntriesGraphQLSchemaAstValueCache,
1964+
},
1965+
"graphql_schema_doc": {
1966+
MaxNumEntries: maxNumEntriesGraphQLSchemaDocValueCache,
1967+
},
19441968
},
19451969
},
19461970
}

0 commit comments

Comments
 (0)