Skip to content

Commit 86f6caf

Browse files
committed
Fine-tune symfony profiler
1 parent e9a3bca commit 86f6caf

File tree

3 files changed

+131
-124
lines changed

3 files changed

+131
-124
lines changed

src/Extension/Symfony/config.yaml

Lines changed: 120 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,132 @@
11
type_lang:
2-
#
3-
# ----------------------------------------------------------------------------
4-
# Common Config
5-
# ----------------------------------------------------------------------------
6-
#
7-
object_as_array: ~
8-
strict_types: ~
2+
#
3+
# ----------------------------------------------------------------------------
4+
# Common Config
5+
# ----------------------------------------------------------------------------
6+
#
7+
object_as_array: ~
8+
strict_types: ~
99

10-
#
11-
# ----------------------------------------------------------------------------
12-
# Types List
13-
# ----------------------------------------------------------------------------
14-
#
15-
# List of additional type builders. Each builder should
16-
# be registered as service builder class:
17-
#
18-
types:
19-
# - App\Mapper\Builder\ExampleTypeBuilder
20-
# - ...
10+
#
11+
# ----------------------------------------------------------------------------
12+
# Types List
13+
# ----------------------------------------------------------------------------
14+
#
15+
# List of additional type builders. Each builder should
16+
# be registered as service builder class:
17+
#
18+
types:
19+
# - App\Mapper\Builder\ExampleTypeBuilder
20+
# - ...
2121

22-
#
23-
# ----------------------------------------------------------------------------
24-
# Types Coercers
25-
# ----------------------------------------------------------------------------
26-
#
27-
# List of additional type coercers. Each key should be valid type
28-
# class; each value should be registered as service coercer class:
29-
#
30-
coercions:
31-
# App\Mapper\ExampleType: App\Mapper\Coercer\ExampleCoercer
32-
# ...: ...
22+
#
23+
# ----------------------------------------------------------------------------
24+
# Types Coercers
25+
# ----------------------------------------------------------------------------
26+
#
27+
# List of additional type coercers. Each key should be valid type
28+
# class; each value should be registered as service coercer class:
29+
#
30+
coercions:
31+
# App\Mapper\ExampleType: App\Mapper\Coercer\ExampleCoercer
32+
# ...: ...
3333

34-
#
35-
# ----------------------------------------------------------------------------
36-
# Metadata Configuration
37-
# ----------------------------------------------------------------------------
38-
#
39-
meta:
40-
# Enable/disable attributes metadata, defaults to "true"
41-
attributes:
42-
enabled: ~
34+
#
35+
# ----------------------------------------------------------------------------
36+
# Metadata Configuration
37+
# ----------------------------------------------------------------------------
38+
#
39+
meta:
40+
# Enable/disable attributes metadata, defaults to "true"
41+
attributes:
42+
enabled: ~
4343

44-
# Enable/disable phpdoc metadata, by default depends on the availability
45-
# of the "type-lang/phpdoc-standard-tags" package
46-
phpdoc:
47-
enabled: ~
48-
param_tag_name: "param"
49-
var_tag_name: "var"
50-
return_tag_name: "return"
44+
# Enable/disable phpdoc metadata, by default depends on the availability
45+
# of the "type-lang/phpdoc-standard-tags" package
46+
phpdoc:
47+
enabled: ~
48+
param_tag_name: "param"
49+
var_tag_name: "var"
50+
return_tag_name: "return"
5151

52-
# Enable/disable yaml config metadata, defaults to "true"
53-
yaml:
54-
enabled: ~
55-
# List of configuration file directories
56-
directories:
57-
- '%kernel.project_dir%/config/mapper'
58-
# List of file extensions
59-
extensions:
60-
- '.yml'
61-
- '.yaml'
52+
# Enable/disable yaml config metadata, defaults to "true"
53+
yaml:
54+
enabled: ~
55+
# List of configuration file directories
56+
directories:
57+
- '%kernel.project_dir%/config/mapper'
58+
# List of file extensions
59+
extensions:
60+
- '.yml'
61+
- '.yaml'
6262

63-
#
64-
# ----------------------------------------------------------------------------
65-
# Logger Configuration
66-
# ----------------------------------------------------------------------------
67-
#
68-
logger:
69-
# Defaults to "%kernel.debug%"
70-
enabled: ~
71-
# service: Psr\Log\LoggerInterface
72-
# log_type_extraction: false
73-
# log_type_parse: false
74-
# log_type_fetch: false
75-
# log_type_cast: false
76-
# log_type_match: true
63+
#
64+
# ----------------------------------------------------------------------------
65+
# Logger Configuration
66+
# ----------------------------------------------------------------------------
67+
#
68+
logger:
69+
# Defaults to "%kernel.debug%"
70+
enabled: ~
71+
# service: Psr\Log\LoggerInterface
72+
# log_type_extraction: false
73+
# log_type_parse: false
74+
# log_type_fetch: false
75+
# log_type_cast: false
76+
# log_type_match: false
7777

78-
#
79-
# ----------------------------------------------------------------------------
80-
# Tracing Configuration
81-
# ----------------------------------------------------------------------------
82-
#
83-
tracing:
84-
# Defaults to "%kernel.debug%"
85-
enabled: ~
86-
# service: TypeLang\Mapper\Kernel\Tracing\TracerInterface
87-
# printer: TypeLang\Printer\PrinterInterface
88-
# trace_type_extraction: false
89-
# trace_type_parse: false
90-
# trace_type_fetch: false
91-
# trace_type_cast: true
92-
# trace_type_match: false
78+
#
79+
# ----------------------------------------------------------------------------
80+
# Tracing Configuration
81+
# ----------------------------------------------------------------------------
82+
#
83+
tracing:
84+
# Defaults to "%kernel.debug%"
85+
enabled: ~
86+
# service: TypeLang\Mapper\Kernel\Tracing\TracerInterface
87+
# printer: TypeLang\Printer\PrinterInterface
88+
# trace_type_extraction: false
89+
# trace_type_parse: false
90+
# trace_type_fetch: true
91+
# trace_type_cast: false
92+
# trace_type_match: false
9393

94-
#
95-
# ----------------------------------------------------------------------------
96-
# Cache Configuration
97-
# ----------------------------------------------------------------------------
98-
#
99-
cache:
100-
# Defaults to "!%kernel.debug%"
101-
enabled: ~
102-
# Cache service name, defaults to "cache.app"
103-
# service: cache.app
104-
#
105-
# One of "psr6"; "psr16", defaults to "psr6"
106-
# driver: psr6
107-
#
108-
# Optional cache prefix, defaults to "tlm_"
109-
# prefix: "tlm_"
110-
#
111-
# Cache TTL
112-
# ttl: 0
94+
#
95+
# ----------------------------------------------------------------------------
96+
# Cache Configuration
97+
# ----------------------------------------------------------------------------
98+
#
99+
cache:
100+
# Defaults to "!%kernel.debug%"
101+
enabled: ~
102+
# Cache service name, defaults to "cache.app"
103+
# service: cache.app
104+
#
105+
# One of "psr6"; "psr16", defaults to "psr6"
106+
# driver: psr6
107+
#
108+
# Optional cache prefix, defaults to "tlm_"
109+
# prefix: "tlm_"
110+
#
111+
# Cache TTL
112+
# ttl: 0
113113

114-
#
115-
# ----------------------------------------------------------------------------
116-
# Second-Level Cache Configuration
117-
# ----------------------------------------------------------------------------
118-
#
119-
memoization:
120-
# AST in-memory cache, defaults to "true"
121-
# parser:
122-
# enabled: ~
123-
# min_types: 30
124-
# max_types: 100
114+
#
115+
# ----------------------------------------------------------------------------
116+
# Second-Level Cache Configuration
117+
# ----------------------------------------------------------------------------
118+
#
119+
memoization:
120+
# AST in-memory cache, defaults to "true"
121+
# parser:
122+
# enabled: ~
123+
# min_types: 30
124+
# max_types: 100
125125

126-
# Types in-memory cache, defaults to "true"
127-
# types:
128-
# enabled: ~
126+
# Types in-memory cache, defaults to "true"
127+
# types:
128+
# enabled: ~
129129

130-
# Metadata in-memory cache, defaults to "true"
131-
# meta:
132-
# enabled: ~
130+
# Metadata in-memory cache, defaults to "true"
131+
# meta:
132+
# enabled: ~

src/Kernel/Repository/Factory/DefaultTypeRepositoryFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class DefaultTypeRepositoryFactory implements TypeRepositoryFactoryInterfa
3131
/**
3232
* Default value for {@see DefaultTypeRepositoryFactory::$enableTypeMatchLogging}
3333
*/
34-
public const DEFAULT_TYPE_MATCH_LOGGING_OPTION = true;
34+
public const DEFAULT_TYPE_MATCH_LOGGING_OPTION = false;
3535

3636
/**
3737
* Default value for {@see DefaultTypeRepositoryFactory::$enableTypeCastLogging}
@@ -41,7 +41,7 @@ final class DefaultTypeRepositoryFactory implements TypeRepositoryFactoryInterfa
4141
/**
4242
* Default value for {@see DefaultTypeRepositoryFactory::$enableTracing}
4343
*/
44-
public const DEFAULT_TRACING_OPTION = false;
44+
public const DEFAULT_TRACING_OPTION = true;
4545

4646
/**
4747
* Default value for {@see DefaultTypeRepositoryFactory::$enableTypeMatchTracing}
@@ -51,7 +51,7 @@ final class DefaultTypeRepositoryFactory implements TypeRepositoryFactoryInterfa
5151
/**
5252
* Default value for {@see DefaultTypeRepositoryFactory::$enableTypeCastTracing}
5353
*/
54-
public const DEFAULT_TYPE_CAST_TRACING_OPTION = true;
54+
public const DEFAULT_TYPE_CAST_TRACING_OPTION = false;
5555

5656
/**
5757
* Default value for {@see DefaultTypeRepositoryFactory::$enableMemoization}

src/Kernel/Tracing/SymfonyStopwatchTracer.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@ public function __construct(
1919

2020
public function start(string $name): SpanInterface
2121
{
22+
/**
23+
* Fixes a Symfony Profiler bug that cuts off all FQN classes.
24+
*
25+
* @var string $formatted
26+
*/
27+
$formatted = \preg_replace('/\\\\?(?:\w+\\\\)+(\w+)/isum', '$1', $name);
28+
2229
return new SymfonyStopwatchSpan(
23-
event: $this->stopwatch->start($name, $this->category),
30+
event: $this->stopwatch->start($formatted, $this->category),
2431
);
2532
}
2633
}

0 commit comments

Comments
 (0)