Commit 221c2fb
authored
feat(graphql): support collapse, depth, variables, and error extensions via env (#9111)
This lets `initialize.mjs` users configure the graphql plugin without code
changes, matching the env-var configuration other integrations already offer.
`DD_TRACE_GRAPHQL_COLLAPSE`, `DD_TRACE_GRAPHQL_DEPTH`, and
`DD_TRACE_GRAPHQL_VARIABLES` join the existing `DD_TRACE_GRAPHQL_ERROR_EXTENSIONS`
on the Config singleton and are forwarded to the graphql plugin through
plugin_manager, so they seed the plugin config as a base that a programmatic
`tracer.use('graphql', …)` value overrides, and remote config and config
telemetry observe them on Config like every other global option. `depth` rejects
anything outside `-1` and the non-negative integers via its allowed pattern.
1. `errorExtensions` becomes a programmatic plugin option too, not env-only; the
error-event extraction now reads the resolved plugin config instead of the
raw env name off the tracer config. A value set both programmatically and via
env now resolves programmatic-wins instead of env-always-wins.
2. An invalid programmatic `depth` falls back to the registered default `-1`
after logging, rather than to the env value, because the merge collapses the
global and programmatic values onto one key.
3. The `variables` env var accepts the array form only; the callback form stays
programmatic. An empty `variables`/`errorExtensions` array means no filter.
Fixes: #75461 parent c3db8f8 commit 221c2fb
13 files changed
Lines changed: 237 additions & 8 deletions
File tree
- packages
- datadog-plugin-graphql
- src
- test
- tools
- dd-trace
- src
- config
- test
- config
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2542 | 2542 | | |
2543 | 2543 | | |
2544 | 2544 | | |
| 2545 | + | |
2545 | 2546 | | |
2546 | 2547 | | |
2547 | 2548 | | |
| |||
2558 | 2559 | | |
2559 | 2560 | | |
2560 | 2561 | | |
2561 | | - | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
2562 | 2566 | | |
2563 | 2567 | | |
2564 | 2568 | | |
| |||
2567 | 2571 | | |
2568 | 2572 | | |
2569 | 2573 | | |
| 2574 | + | |
2570 | 2575 | | |
2571 | 2576 | | |
2572 | 2577 | | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
2573 | 2586 | | |
2574 | 2587 | | |
2575 | 2588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2674 | 2674 | | |
2675 | 2675 | | |
2676 | 2676 | | |
| 2677 | + | |
2677 | 2678 | | |
2678 | 2679 | | |
2679 | 2680 | | |
| |||
2690 | 2691 | | |
2691 | 2692 | | |
2692 | 2693 | | |
2693 | | - | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
2694 | 2698 | | |
2695 | 2699 | | |
2696 | 2700 | | |
| |||
2699 | 2703 | | |
2700 | 2704 | | |
2701 | 2705 | | |
| 2706 | + | |
2702 | 2707 | | |
2703 | 2708 | | |
2704 | 2709 | | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
2705 | 2718 | | |
2706 | 2719 | | |
2707 | 2720 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
| |||
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| 51 | + | |
44 | 52 | | |
45 | 53 | | |
46 | 54 | | |
| |||
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
61 | | - | |
| 69 | + | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
66 | 74 | | |
67 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
68 | 84 | | |
69 | 85 | | |
70 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
3 | 10 | | |
4 | 11 | | |
5 | 12 | | |
| |||
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | | - | |
33 | | - | |
| 39 | + | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2037 | 2037 | | |
2038 | 2038 | | |
2039 | 2039 | | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
2040 | 2098 | | |
2041 | 2099 | | |
2042 | 2100 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
256 | 258 | | |
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
| 263 | + | |
261 | 264 | | |
262 | 265 | | |
263 | 266 | | |
| |||
921 | 924 | | |
922 | 925 | | |
923 | 926 | | |
| 927 | + | |
| 928 | + | |
924 | 929 | | |
925 | 930 | | |
926 | 931 | | |
927 | 932 | | |
928 | 933 | | |
| 934 | + | |
929 | 935 | | |
930 | 936 | | |
931 | 937 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2757 | 2757 | | |
2758 | 2758 | | |
2759 | 2759 | | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
2760 | 2775 | | |
2761 | 2776 | | |
2762 | 2777 | | |
| |||
2792 | 2807 | | |
2793 | 2808 | | |
2794 | 2809 | | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
2795 | 2817 | | |
2796 | 2818 | | |
2797 | 2819 | | |
| |||
0 commit comments