Skip to content

Commit 57014aa

Browse files
authored
Update TagListGenerator to always useReadOnlySpan<byte> properties (#8486)
## Summary of changes Update the tag list generator to always use `ReadOnlySpan<byte>` properties instead of `byte[]` ## Reason for change After moving our vendored `Span<T>` implementation into the `System` namespace, various optimizations open up to us, including using `ReadOnlySpan<byte>` properties on .NET Framework instead of `static readonly byte[]` to avoid startup costs. ## Implementation details Replace the code generated by the generator, and update the generated code ## Test coverage Covered by snapshot tests and behaviour is covered by existing tests. We'll check the benchmarks to make sure that we _don't_ see any perf impact (there shouldn't be, impact should just be reduced startup costs) ## Other details Depends on a stack updating our vendored system code - #8391 - #8454 - #8455 - #8459 - #8461 - #8469 - #8476 - #8477
1 parent 0068997 commit 57014aa

250 files changed

Lines changed: 2680 additions & 7354 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tracer/src/Datadog.Trace.SourceGenerators/TagsListGenerator/Sources.cs

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,11 @@ partial class ")
8989

9090
sb.Append(
9191
@"
92-
#if NETCOREAPP
9392
private static ReadOnlySpan<byte> ")
9493
.Append(property.PropertyName)
95-
.Append(@"Bytes => new byte[] { ")
94+
.Append(@"Bytes => [")
9695
.Append(tagByteArray)
97-
.Append(@" };")
98-
.Append(
99-
@"
100-
#else
101-
private static readonly byte[] ")
102-
.Append(property.PropertyName)
103-
.Append(@"Bytes = new byte[] { ")
104-
.Append(tagByteArray)
105-
.Append(@" };")
106-
.Append(
107-
@"
108-
#endif");
96+
.AppendLine(@"];");
10997
}
11098
}
11199

@@ -125,28 +113,15 @@ partial class ")
125113

126114
sb.Append(
127115
@"
128-
#if NETCOREAPP
129116
private static ReadOnlySpan<byte> ")
130117
.Append(property.PropertyName)
131-
.Append(@"Bytes => new byte[] { ")
132-
.Append(tagByteArray)
133-
.Append(@" };")
134-
.Append(
135-
@"
136-
#else
137-
private static readonly byte[] ")
138-
.Append(property.PropertyName)
139-
.Append(@"Bytes = new byte[] { ")
118+
.Append(@"Bytes => [")
140119
.Append(tagByteArray)
141-
.Append(@" };")
142-
.Append(
143-
@"
144-
#endif");
120+
.AppendLine(@"];");
145121
}
146122

147123
sb.Append(
148124
@"
149-
150125
public override string? GetTag(string key)
151126
{
152127
return key switch
@@ -283,11 +258,6 @@ protected override void WriteAdditionalTags(System.Text.StringBuilder sb)
283258

284259
if (tagList.MetricProperties.HasValues())
285260
{
286-
if (tagList.TagProperties.IsDefaultOrEmpty)
287-
{
288-
sb.AppendLine();
289-
}
290-
291261
sb.Append(
292262
@"
293263
public override double? GetMetric(string key)

tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AerospikeTags.g.cs

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,22 @@ namespace Datadog.Trace.Tagging
1515
partial class AerospikeTags
1616
{
1717
// SpanKindBytes = MessagePack.Serialize("span.kind");
18-
#if NETCOREAPP
19-
private static ReadOnlySpan<byte> SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 };
20-
#else
21-
private static readonly byte[] SpanKindBytes = new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 };
22-
#endif
18+
private static ReadOnlySpan<byte> SpanKindBytes => [169, 115, 112, 97, 110, 46, 107, 105, 110, 100];
19+
2320
// InstrumentationNameBytes = MessagePack.Serialize("component");
24-
#if NETCOREAPP
25-
private static ReadOnlySpan<byte> InstrumentationNameBytes => new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
26-
#else
27-
private static readonly byte[] InstrumentationNameBytes = new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
28-
#endif
21+
private static ReadOnlySpan<byte> InstrumentationNameBytes => [169, 99, 111, 109, 112, 111, 110, 101, 110, 116];
22+
2923
// KeyBytes = MessagePack.Serialize("aerospike.key");
30-
#if NETCOREAPP
31-
private static ReadOnlySpan<byte> KeyBytes => new byte[] { 173, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 107, 101, 121 };
32-
#else
33-
private static readonly byte[] KeyBytes = new byte[] { 173, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 107, 101, 121 };
34-
#endif
24+
private static ReadOnlySpan<byte> KeyBytes => [173, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 107, 101, 121];
25+
3526
// NamespaceBytes = MessagePack.Serialize("aerospike.namespace");
36-
#if NETCOREAPP
37-
private static ReadOnlySpan<byte> NamespaceBytes => new byte[] { 179, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 110, 97, 109, 101, 115, 112, 97, 99, 101 };
38-
#else
39-
private static readonly byte[] NamespaceBytes = new byte[] { 179, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 110, 97, 109, 101, 115, 112, 97, 99, 101 };
40-
#endif
27+
private static ReadOnlySpan<byte> NamespaceBytes => [179, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 110, 97, 109, 101, 115, 112, 97, 99, 101];
28+
4129
// SetNameBytes = MessagePack.Serialize("aerospike.setname");
42-
#if NETCOREAPP
43-
private static ReadOnlySpan<byte> SetNameBytes => new byte[] { 177, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 115, 101, 116, 110, 97, 109, 101 };
44-
#else
45-
private static readonly byte[] SetNameBytes = new byte[] { 177, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 115, 101, 116, 110, 97, 109, 101 };
46-
#endif
30+
private static ReadOnlySpan<byte> SetNameBytes => [177, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 115, 101, 116, 110, 97, 109, 101];
31+
4732
// UserKeyBytes = MessagePack.Serialize("aerospike.userkey");
48-
#if NETCOREAPP
49-
private static ReadOnlySpan<byte> UserKeyBytes => new byte[] { 177, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 117, 115, 101, 114, 107, 101, 121 };
50-
#else
51-
private static readonly byte[] UserKeyBytes = new byte[] { 177, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 117, 115, 101, 114, 107, 101, 121 };
52-
#endif
33+
private static ReadOnlySpan<byte> UserKeyBytes => [177, 97, 101, 114, 111, 115, 112, 105, 107, 101, 46, 117, 115, 101, 114, 107, 101, 121];
5334

5435
public override string? GetTag(string key)
5536
{

tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AerospikeV1Tags.g.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,10 @@ namespace Datadog.Trace.Tagging
1515
partial class AerospikeV1Tags
1616
{
1717
// PeerServiceBytes = MessagePack.Serialize("peer.service");
18-
#if NETCOREAPP
19-
private static ReadOnlySpan<byte> PeerServiceBytes => new byte[] { 172, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101 };
20-
#else
21-
private static readonly byte[] PeerServiceBytes = new byte[] { 172, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101 };
22-
#endif
18+
private static ReadOnlySpan<byte> PeerServiceBytes => [172, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101];
19+
2320
// PeerServiceSourceBytes = MessagePack.Serialize("_dd.peer.service.source");
24-
#if NETCOREAPP
25-
private static ReadOnlySpan<byte> PeerServiceSourceBytes => new byte[] { 183, 95, 100, 100, 46, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101, 46, 115, 111, 117, 114, 99, 101 };
26-
#else
27-
private static readonly byte[] PeerServiceSourceBytes = new byte[] { 183, 95, 100, 100, 46, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101, 46, 115, 111, 117, 114, 99, 101 };
28-
#endif
21+
private static ReadOnlySpan<byte> PeerServiceSourceBytes => [183, 95, 100, 100, 46, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101, 46, 115, 111, 117, 114, 99, 101];
2922

3023
public override string? GetTag(string key)
3124
{

tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AspNetCoreEndpointTags.g.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ namespace Datadog.Trace.Tagging
1515
partial class AspNetCoreEndpointTags
1616
{
1717
// AspNetCoreEndpointBytes = MessagePack.Serialize("aspnet_core.endpoint");
18-
#if NETCOREAPP
19-
private static ReadOnlySpan<byte> AspNetCoreEndpointBytes => new byte[] { 180, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 101, 110, 100, 112, 111, 105, 110, 116 };
20-
#else
21-
private static readonly byte[] AspNetCoreEndpointBytes = new byte[] { 180, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 101, 110, 100, 112, 111, 105, 110, 116 };
22-
#endif
18+
private static ReadOnlySpan<byte> AspNetCoreEndpointBytes => [180, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 101, 110, 100, 112, 111, 105, 110, 116];
2319

2420
public override string? GetTag(string key)
2521
{

tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AspNetCoreMvcTags.g.cs

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,25 @@ namespace Datadog.Trace.Tagging
1515
partial class AspNetCoreMvcTags
1616
{
1717
// SpanKindBytes = MessagePack.Serialize("span.kind");
18-
#if NETCOREAPP
19-
private static ReadOnlySpan<byte> SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 };
20-
#else
21-
private static readonly byte[] SpanKindBytes = new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 };
22-
#endif
18+
private static ReadOnlySpan<byte> SpanKindBytes => [169, 115, 112, 97, 110, 46, 107, 105, 110, 100];
19+
2320
// InstrumentationNameBytes = MessagePack.Serialize("component");
24-
#if NETCOREAPP
25-
private static ReadOnlySpan<byte> InstrumentationNameBytes => new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
26-
#else
27-
private static readonly byte[] InstrumentationNameBytes = new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
28-
#endif
21+
private static ReadOnlySpan<byte> InstrumentationNameBytes => [169, 99, 111, 109, 112, 111, 110, 101, 110, 116];
22+
2923
// AspNetCoreControllerBytes = MessagePack.Serialize("aspnet_core.controller");
30-
#if NETCOREAPP
31-
private static ReadOnlySpan<byte> AspNetCoreControllerBytes => new byte[] { 182, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 99, 111, 110, 116, 114, 111, 108, 108, 101, 114 };
32-
#else
33-
private static readonly byte[] AspNetCoreControllerBytes = new byte[] { 182, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 99, 111, 110, 116, 114, 111, 108, 108, 101, 114 };
34-
#endif
24+
private static ReadOnlySpan<byte> AspNetCoreControllerBytes => [182, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 99, 111, 110, 116, 114, 111, 108, 108, 101, 114];
25+
3526
// AspNetCoreActionBytes = MessagePack.Serialize("aspnet_core.action");
36-
#if NETCOREAPP
37-
private static ReadOnlySpan<byte> AspNetCoreActionBytes => new byte[] { 178, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 97, 99, 116, 105, 111, 110 };
38-
#else
39-
private static readonly byte[] AspNetCoreActionBytes = new byte[] { 178, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 97, 99, 116, 105, 111, 110 };
40-
#endif
27+
private static ReadOnlySpan<byte> AspNetCoreActionBytes => [178, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 97, 99, 116, 105, 111, 110];
28+
4129
// AspNetCoreAreaBytes = MessagePack.Serialize("aspnet_core.area");
42-
#if NETCOREAPP
43-
private static ReadOnlySpan<byte> AspNetCoreAreaBytes => new byte[] { 176, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 97, 114, 101, 97 };
44-
#else
45-
private static readonly byte[] AspNetCoreAreaBytes = new byte[] { 176, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 97, 114, 101, 97 };
46-
#endif
30+
private static ReadOnlySpan<byte> AspNetCoreAreaBytes => [176, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 97, 114, 101, 97];
31+
4732
// AspNetCorePageBytes = MessagePack.Serialize("aspnet_core.page");
48-
#if NETCOREAPP
49-
private static ReadOnlySpan<byte> AspNetCorePageBytes => new byte[] { 176, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 112, 97, 103, 101 };
50-
#else
51-
private static readonly byte[] AspNetCorePageBytes = new byte[] { 176, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 112, 97, 103, 101 };
52-
#endif
33+
private static ReadOnlySpan<byte> AspNetCorePageBytes => [176, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 112, 97, 103, 101];
34+
5335
// AspNetCoreRouteBytes = MessagePack.Serialize("aspnet_core.route");
54-
#if NETCOREAPP
55-
private static ReadOnlySpan<byte> AspNetCoreRouteBytes => new byte[] { 177, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 114, 111, 117, 116, 101 };
56-
#else
57-
private static readonly byte[] AspNetCoreRouteBytes = new byte[] { 177, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 114, 111, 117, 116, 101 };
58-
#endif
36+
private static ReadOnlySpan<byte> AspNetCoreRouteBytes => [177, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 114, 111, 117, 116, 101];
5937

6038
public override string? GetTag(string key)
6139
{

tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AspNetCoreSingleSpanTags.g.cs

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,16 @@ namespace Datadog.Trace.Tagging
1515
partial class AspNetCoreSingleSpanTags
1616
{
1717
// InstrumentationNameBytes = MessagePack.Serialize("component");
18-
#if NETCOREAPP
19-
private static ReadOnlySpan<byte> InstrumentationNameBytes => new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
20-
#else
21-
private static readonly byte[] InstrumentationNameBytes = new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
22-
#endif
18+
private static ReadOnlySpan<byte> InstrumentationNameBytes => [169, 99, 111, 109, 112, 111, 110, 101, 110, 116];
19+
2320
// AspNetCoreRouteBytes = MessagePack.Serialize("aspnet_core.route");
24-
#if NETCOREAPP
25-
private static ReadOnlySpan<byte> AspNetCoreRouteBytes => new byte[] { 177, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 114, 111, 117, 116, 101 };
26-
#else
27-
private static readonly byte[] AspNetCoreRouteBytes = new byte[] { 177, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 114, 111, 117, 116, 101 };
28-
#endif
21+
private static ReadOnlySpan<byte> AspNetCoreRouteBytes => [177, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 114, 111, 117, 116, 101];
22+
2923
// AspNetCoreEndpointBytes = MessagePack.Serialize("aspnet_core.endpoint");
30-
#if NETCOREAPP
31-
private static ReadOnlySpan<byte> AspNetCoreEndpointBytes => new byte[] { 180, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 101, 110, 100, 112, 111, 105, 110, 116 };
32-
#else
33-
private static readonly byte[] AspNetCoreEndpointBytes = new byte[] { 180, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 101, 110, 100, 112, 111, 105, 110, 116 };
34-
#endif
24+
private static ReadOnlySpan<byte> AspNetCoreEndpointBytes => [180, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 101, 110, 100, 112, 111, 105, 110, 116];
25+
3526
// HttpRouteBytes = MessagePack.Serialize("http.route");
36-
#if NETCOREAPP
37-
private static ReadOnlySpan<byte> HttpRouteBytes => new byte[] { 170, 104, 116, 116, 112, 46, 114, 111, 117, 116, 101 };
38-
#else
39-
private static readonly byte[] HttpRouteBytes = new byte[] { 170, 104, 116, 116, 112, 46, 114, 111, 117, 116, 101 };
40-
#endif
27+
private static ReadOnlySpan<byte> HttpRouteBytes => [170, 104, 116, 116, 112, 46, 114, 111, 117, 116, 101];
4128

4229
public override string? GetTag(string key)
4330
{

tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AspNetCoreTags.g.cs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,13 @@ namespace Datadog.Trace.Tagging
1515
partial class AspNetCoreTags
1616
{
1717
// InstrumentationNameBytes = MessagePack.Serialize("component");
18-
#if NETCOREAPP
19-
private static ReadOnlySpan<byte> InstrumentationNameBytes => new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
20-
#else
21-
private static readonly byte[] InstrumentationNameBytes = new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
22-
#endif
18+
private static ReadOnlySpan<byte> InstrumentationNameBytes => [169, 99, 111, 109, 112, 111, 110, 101, 110, 116];
19+
2320
// AspNetCoreRouteBytes = MessagePack.Serialize("aspnet_core.route");
24-
#if NETCOREAPP
25-
private static ReadOnlySpan<byte> AspNetCoreRouteBytes => new byte[] { 177, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 114, 111, 117, 116, 101 };
26-
#else
27-
private static readonly byte[] AspNetCoreRouteBytes = new byte[] { 177, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 114, 111, 117, 116, 101 };
28-
#endif
21+
private static ReadOnlySpan<byte> AspNetCoreRouteBytes => [177, 97, 115, 112, 110, 101, 116, 95, 99, 111, 114, 101, 46, 114, 111, 117, 116, 101];
22+
2923
// HttpRouteBytes = MessagePack.Serialize("http.route");
30-
#if NETCOREAPP
31-
private static ReadOnlySpan<byte> HttpRouteBytes => new byte[] { 170, 104, 116, 116, 112, 46, 114, 111, 117, 116, 101 };
32-
#else
33-
private static readonly byte[] HttpRouteBytes = new byte[] { 170, 104, 116, 116, 112, 46, 114, 111, 117, 116, 101 };
34-
#endif
24+
private static ReadOnlySpan<byte> HttpRouteBytes => [170, 104, 116, 116, 112, 46, 114, 111, 117, 116, 101];
3525

3626
public override string? GetTag(string key)
3727
{

tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AspNetTags.g.cs

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,22 @@ namespace Datadog.Trace.Tagging
1515
partial class AspNetTags
1616
{
1717
// AspNetRouteBytes = MessagePack.Serialize("aspnet.route");
18-
#if NETCOREAPP
19-
private static ReadOnlySpan<byte> AspNetRouteBytes => new byte[] { 172, 97, 115, 112, 110, 101, 116, 46, 114, 111, 117, 116, 101 };
20-
#else
21-
private static readonly byte[] AspNetRouteBytes = new byte[] { 172, 97, 115, 112, 110, 101, 116, 46, 114, 111, 117, 116, 101 };
22-
#endif
18+
private static ReadOnlySpan<byte> AspNetRouteBytes => [172, 97, 115, 112, 110, 101, 116, 46, 114, 111, 117, 116, 101];
19+
2320
// AspNetControllerBytes = MessagePack.Serialize("aspnet.controller");
24-
#if NETCOREAPP
25-
private static ReadOnlySpan<byte> AspNetControllerBytes => new byte[] { 177, 97, 115, 112, 110, 101, 116, 46, 99, 111, 110, 116, 114, 111, 108, 108, 101, 114 };
26-
#else
27-
private static readonly byte[] AspNetControllerBytes = new byte[] { 177, 97, 115, 112, 110, 101, 116, 46, 99, 111, 110, 116, 114, 111, 108, 108, 101, 114 };
28-
#endif
21+
private static ReadOnlySpan<byte> AspNetControllerBytes => [177, 97, 115, 112, 110, 101, 116, 46, 99, 111, 110, 116, 114, 111, 108, 108, 101, 114];
22+
2923
// AspNetActionBytes = MessagePack.Serialize("aspnet.action");
30-
#if NETCOREAPP
31-
private static ReadOnlySpan<byte> AspNetActionBytes => new byte[] { 173, 97, 115, 112, 110, 101, 116, 46, 97, 99, 116, 105, 111, 110 };
32-
#else
33-
private static readonly byte[] AspNetActionBytes = new byte[] { 173, 97, 115, 112, 110, 101, 116, 46, 97, 99, 116, 105, 111, 110 };
34-
#endif
24+
private static ReadOnlySpan<byte> AspNetActionBytes => [173, 97, 115, 112, 110, 101, 116, 46, 97, 99, 116, 105, 111, 110];
25+
3526
// AspNetAreaBytes = MessagePack.Serialize("aspnet.area");
36-
#if NETCOREAPP
37-
private static ReadOnlySpan<byte> AspNetAreaBytes => new byte[] { 171, 97, 115, 112, 110, 101, 116, 46, 97, 114, 101, 97 };
38-
#else
39-
private static readonly byte[] AspNetAreaBytes = new byte[] { 171, 97, 115, 112, 110, 101, 116, 46, 97, 114, 101, 97 };
40-
#endif
27+
private static ReadOnlySpan<byte> AspNetAreaBytes => [171, 97, 115, 112, 110, 101, 116, 46, 97, 114, 101, 97];
28+
4129
// HttpRouteBytes = MessagePack.Serialize("http.route");
42-
#if NETCOREAPP
43-
private static ReadOnlySpan<byte> HttpRouteBytes => new byte[] { 170, 104, 116, 116, 112, 46, 114, 111, 117, 116, 101 };
44-
#else
45-
private static readonly byte[] HttpRouteBytes = new byte[] { 170, 104, 116, 116, 112, 46, 114, 111, 117, 116, 101 };
46-
#endif
30+
private static ReadOnlySpan<byte> HttpRouteBytes => [170, 104, 116, 116, 112, 46, 114, 111, 117, 116, 101];
31+
4732
// InstrumentationNameBytes = MessagePack.Serialize("component");
48-
#if NETCOREAPP
49-
private static ReadOnlySpan<byte> InstrumentationNameBytes => new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
50-
#else
51-
private static readonly byte[] InstrumentationNameBytes = new byte[] { 169, 99, 111, 109, 112, 111, 110, 101, 110, 116 };
52-
#endif
33+
private static ReadOnlySpan<byte> InstrumentationNameBytes => [169, 99, 111, 109, 112, 111, 110, 101, 110, 116];
5334

5435
public override string? GetTag(string key)
5536
{

tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsDynamoDbTags.g.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,10 @@ namespace Datadog.Trace.Tagging
1515
partial class AwsDynamoDbTags
1616
{
1717
// TableNameBytes = MessagePack.Serialize("tablename");
18-
#if NETCOREAPP
19-
private static ReadOnlySpan<byte> TableNameBytes => new byte[] { 169, 116, 97, 98, 108, 101, 110, 97, 109, 101 };
20-
#else
21-
private static readonly byte[] TableNameBytes = new byte[] { 169, 116, 97, 98, 108, 101, 110, 97, 109, 101 };
22-
#endif
18+
private static ReadOnlySpan<byte> TableNameBytes => [169, 116, 97, 98, 108, 101, 110, 97, 109, 101];
19+
2320
// SpanKindBytes = MessagePack.Serialize("span.kind");
24-
#if NETCOREAPP
25-
private static ReadOnlySpan<byte> SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 };
26-
#else
27-
private static readonly byte[] SpanKindBytes = new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 };
28-
#endif
21+
private static ReadOnlySpan<byte> SpanKindBytes => [169, 115, 112, 97, 110, 46, 107, 105, 110, 100];
2922

3023
public override string? GetTag(string key)
3124
{

0 commit comments

Comments
 (0)