File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -1255,14 +1255,26 @@ static inline void nr_php_execute_segment_add_metric(
1255
1255
bool create_metric ) {
1256
1256
char buf [METRIC_NAME_MAX_LEN ];
1257
1257
1258
- nr_php_execute_metadata_metric (metadata , buf , sizeof (buf ));
1259
-
1260
- if (create_metric ) {
1261
- nr_segment_add_metric (segment , buf , true);
1262
- }
1258
+ /*
1259
+ * If the name is not already set, use the metadata to get the class and
1260
+ * function name to name the metric and the segment.
1261
+ *
1262
+ * If the segment name is already set, use that to name the metric.
1263
+ */
1263
1264
if (!segment -> name ) {
1264
- /* Only set the segment name if it is not already set. */
1265
+ nr_php_execute_metadata_metric (metadata , buf , sizeof (buf ));
1266
+
1267
+ if (create_metric ) {
1268
+ nr_segment_add_metric (segment , buf , true);
1269
+ }
1265
1270
nr_segment_set_name (segment , buf );
1271
+ } else {
1272
+ /* Segment already named, so only create the metric with the name. */
1273
+ if (create_metric ) {
1274
+ nr_segment_add_metric (
1275
+ segment , nr_string_get (segment -> txn -> trace_strings , segment -> name ),
1276
+ true);
1277
+ }
1266
1278
}
1267
1279
}
1268
1280
You can’t perform that action at this time.
0 commit comments