Skip to content

Commit 2ecf7be

Browse files
authored
Merge branch 'aws:main' into main
2 parents b14fec0 + 17bf10f commit 2ecf7be

File tree

68 files changed

+16302
-5168
lines changed

Some content is hidden

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

68 files changed

+16302
-5168
lines changed

.github/workflows/csharp-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: windows-latest
1616
steps:
1717
- name: Sync Code
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
- name: Build
2020
run: |
2121
dotnet build -c Release ./telemetry/csharp/AwsToolkit.Telemetry.sln

.github/workflows/lint-telemetry-definitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Sync Code
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

1616
- name: Compile the Validation code
1717
run: |

buildspec/kotlinTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ phases:
1010
- |
1111
# TODO - iterate through the subdirectories to have one build script per runtime
1212
cd telemetry/jetbrains
13-
./gradlew test
13+
./gradlew build
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<!-- Source generators must target netstandard 2.0, and this project will be a dependency. -->
5+
<TargetFramework>netstandard2.0</TargetFramework>
6+
7+
<RootNamespace>Amazon.AwsToolkit.Telemetry.Events.Generator.Core</RootNamespace>
8+
<AssemblyName>Amazon.AwsToolkit.Telemetry.Events.Generator.Core</AssemblyName>
9+
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
14+
<PackageReference Include="System.CodeDom" Version="8.0.0" />
15+
</ItemGroup>
16+
17+
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Core
2+
{
3+
public static class Constants
4+
{
5+
public const string DefaultEventsNamespace = "Amazon.AwsToolkit.Telemetry.Events.Generated";
6+
}
7+
}

telemetry/csharp/AwsToolkit.Telemetry.Events.Generator/DefinitionsBuilder.cs renamed to telemetry/csharp/AwsToolkit.Telemetry.Events.Generator.Core/DefinitionsBuilder.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
using System;
1+
using Amazon.AwsToolkit.Telemetry.Events.Generator.Core.Models;
2+
using Amazon.AwsToolkit.Telemetry.Events.Generator.Core.Utils;
3+
using System;
24
using System.CodeDom;
35
using System.CodeDom.Compiler;
46
using System.Collections.Generic;
57
using System.Globalization;
68
using System.IO;
79
using System.Linq;
810
using System.Reflection;
9-
using Amazon.AwsToolkit.Telemetry.Events.Generator.Models;
10-
using Amazon.AwsToolkit.Telemetry.Events.Generator.Utils;
1111

12-
namespace Amazon.AwsToolkit.Telemetry.Events.Generator
12+
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Core
1313
{
1414
/// <summary>
1515
/// Generates code that allows programs like the Toolkit to instantiate and publish Telemetry Events
@@ -112,9 +112,9 @@ public string Build()
112112
blankNamespace.Imports.Add(new CodeNamespaceImport("System.Collections.Generic"));
113113
// All generated code is expected to be placed in, or somewhere with a dependency on,
114114
// AwsToolkit.Telemetry.Events.Generated
115-
if (_namespace != Options.DefaultEventsNamespace)
115+
if (_namespace != Constants.DefaultEventsNamespace)
116116
{
117-
blankNamespace.Imports.Add(new CodeNamespaceImport(Options.DefaultEventsNamespace));
117+
blankNamespace.Imports.Add(new CodeNamespaceImport(Constants.DefaultEventsNamespace));
118118
}
119119
blankNamespace.Imports.Add(new CodeNamespaceImport("Amazon.AwsToolkit.Telemetry.Events.Core"));
120120

@@ -295,8 +295,13 @@ private CodeTypeDeclaration CreateMetricDataClass(Metric metric)
295295

296296
// Initialize the passive field based on this metric declaration
297297
// Generate: this.Passive = true/false;
298-
var valueFieldRef = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "Passive");
299-
typeConstructor.Statements.Add(new CodeAssignStatement(valueFieldRef, new CodePrimitiveExpression(metric.passive)));
298+
var passiveFieldRef = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "Passive");
299+
typeConstructor.Statements.Add(new CodeAssignStatement(passiveFieldRef, new CodePrimitiveExpression(metric.passive)));
300+
301+
// Initialize the TrackPerformance field based on this metric declaration
302+
// Generate: this.TrackPerformance = true/false;
303+
var performanceFieldRef = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "TrackPerformance");
304+
typeConstructor.Statements.Add(new CodeAssignStatement(performanceFieldRef, new CodePrimitiveExpression(metric.trackPerformance)));
300305

301306
cls.Members.Add(typeConstructor);
302307

@@ -399,6 +404,7 @@ private CodeMemberMethod CreateRecordMetricMethodByDataClass(Metric metric)
399404
tryStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(datum, "MetricName"), new CodePrimitiveExpression(metric.name)));
400405
tryStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(datum, "Unit"), GetMetricUnitExpression(metric)));
401406
tryStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(datum, "Passive"), new CodeFieldReferenceExpression(payload, "Passive")));
407+
tryStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(datum, "TrackPerformance"), new CodeFieldReferenceExpression(payload, "TrackPerformance")));
402408

403409
// Set Datum.Value to (payload.Value ?? 1)
404410
var payloadValue = new CodeFieldReferenceExpression(payload, "Value");

telemetry/csharp/AwsToolkit.Telemetry.Events.Generator/Models/Metadata.cs renamed to telemetry/csharp/AwsToolkit.Telemetry.Events.Generator.Core/Models/Metadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ReSharper disable InconsistentNaming
2-
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Models
2+
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Core.Models
33
{
44
public class Metadata
55
{
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ReSharper disable InconsistentNaming
2-
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Models
2+
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Core.Models
33
{
44
public class Metric
55
{
@@ -8,5 +8,6 @@ public class Metric
88
public Metadata[] metadata { get; set; }
99
public string unit { get; set; }
1010
public bool passive { get; set; }
11+
public bool trackPerformance { get; set; }
1112
}
1213
}

telemetry/csharp/AwsToolkit.Telemetry.Events.Generator/Models/MetricType.cs renamed to telemetry/csharp/AwsToolkit.Telemetry.Events.Generator.Core/Models/MetricType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ReSharper disable InconsistentNaming
2-
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Models
2+
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Core.Models
33
{
44
public class MetricType
55
{

telemetry/csharp/AwsToolkit.Telemetry.Events.Generator/Models/TelemetryDefinitions.cs renamed to telemetry/csharp/AwsToolkit.Telemetry.Events.Generator.Core/Models/TelemetryDefinitions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Linq;
44
using Newtonsoft.Json;
55

6-
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Models
6+
namespace Amazon.AwsToolkit.Telemetry.Events.Generator.Core.Models
77
{
88
public class TelemetryDefinitions
99
{

0 commit comments

Comments
 (0)