Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
26153fb
[Service Bus] Fix docs typo (#38211)
jsquire Aug 15, 2023
86b639f
Prepare for release (#38222)
JoshLove-msft Aug 15, 2023
ad896c0
Update CODEOWNERS file for Monitor (#38223)
scottaddie Aug 15, 2023
43760de
Add benchmark for patch model
annelo-msft Aug 15, 2023
f834b2a
Update CHANGELOG.md for release (#38228)
christothes Aug 15, 2023
9e5f176
Initial benchmark
annelo-msft Aug 15, 2023
19a3a2a
wip
annelo-msft Aug 15, 2023
5683fc0
updates
annelo-msft Aug 15, 2023
fb9fc06
Hold default serializer options in a static
annelo-msft Aug 15, 2023
125589e
Increment package version after release of Azure.Core.Expressions.Dat…
azure-sdk Aug 15, 2023
b6af79e
Add e2e use case to touch MJD changelist
annelo-msft Aug 16, 2023
5a3f6c0
Fix race condition involving session processor (#38220)
JoshLove-msft Aug 16, 2023
4c22a9a
Increment package version after release of Azure.Identity (#38213)
azure-sdk Aug 16, 2023
07e1925
Update Generator Version 3.0.0-beta.20230814.3 (#38205)
azure-sdk Aug 16, 2023
aaaae8a
Update AutoRest C# version to 3.0.0-beta.20230815.1 (#38232)
azure-sdk Aug 16, 2023
9865263
fix(ci): prepare-pipelines.xml is broken due to renamed property (#38…
archerzz Aug 16, 2023
a47fe27
Fix App Service Type issue (#37978)
mcgallan Aug 16, 2023
333a172
Increment package version after release of Azure.Messaging.ServiceBus…
azure-sdk Aug 16, 2023
ec8530d
Fix Datafactory Type Issue (#38208)
mcgallan Aug 16, 2023
4a17dc1
Increment package version after release of Azure.Data.Tables (#38238)
azure-sdk Aug 16, 2023
08671c8
Merge remote-tracking branch 'upstream/main' into core-patch-model-perf
annelo-msft Aug 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -563,14 +563,13 @@

# ServiceLabel: %Monitor %Service Attention
/sdk/monitor/ @SameergMS @dadunl
/sdk/monitor/ci.yml @nisha-bhatia @JoshLove-msft @pallavit @Azure/azure-sdk-write-monitor-data-plane

# PRLabel: %Monitor - Ingestion
/sdk/monitor/Azure.Monitor.Ingestion/ @nisha-bhatia @JoshLove-msft @pallavit
/sdk/monitor/ci.yml @nisha-bhatia @JoshLove-msft @pallavit
/sdk/monitor/Azure.Monitor.Ingestion/ @nisha-bhatia @JoshLove-msft @pallavit @Azure/azure-sdk-write-monitor-data-plane

# PRLabel: %Monitor - Query
/sdk/monitor/Azure.Monitor.Query/ @nisha-bhatia @JoshLove-msft @pallavit
/sdk/monitor/ci.yml @nisha-bhatia @JoshLove-msft @pallavit
/sdk/monitor/Azure.Monitor.Query/ @nisha-bhatia @JoshLove-msft @pallavit @Azure/azure-sdk-write-monitor-data-plane

# PRLabel: %Monitor - ApplicationInsights
# ServiceLabel: %Monitor - ApplicationInsights %Service Attention
Expand Down
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
All should have PrivateAssets="All" set so they don't become package dependencies
-->
<ItemGroup>
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20230814.2" PrivateAssets="All" />
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20230815.1" PrivateAssets="All" />
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20230811.4" PrivateAssets="All" />
<PackageReference Update="coverlet.collector" Version="3.2.0" PrivateAssets="All" />
<PackageReference Update="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1" PrivateAssets="All" />
Expand Down
2 changes: 1 addition & 1 deletion eng/emitter-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"main": "dist/src/index.js",
"dependencies": {
"@azure-tools/typespec-csharp": "0.2.0-beta.20230814.2"
"@azure-tools/typespec-csharp": "0.2.0-beta.20230815.1"
}
}
2 changes: 1 addition & 1 deletion eng/pipelines/prepare-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
trigger: none

variables:
NugetSecurityAnalysisWarningLevel: warn
nugetMultiFeedWarnLevel: warn

extends:
template: /eng/common/pipelines/templates/jobs/prepare-pipelines.yml
Expand Down
12 changes: 11 additions & 1 deletion sdk/core/Azure.Core.Expressions.DataFactory/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Release History

## 1.0.0-beta.5 (Unreleased)
## 1.0.0-beta.6 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

## 1.0.0-beta.5 (2023-08-15)

### Bugs Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>This is the implementation of the DataFactoryExpressions</Description>
<AssemblyTitle>Microsoft Azure DataFactory Expressions</AssemblyTitle>
<Version>1.0.0-beta.5</Version>
<Version>1.0.0-beta.6</Version>
<PackageTags>azure;datafactory</PackageTags>
<Nullable>enable</Nullable>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
Expand Down
30 changes: 29 additions & 1 deletion sdk/core/Azure.Core/perf/Serializations/JsonBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,23 @@ public void Serialize_PublicInterface()

[Benchmark]
[BenchmarkCategory("Internal")]
public T Deserialize_Internal()
public T Deserialize_Internal_JsonElement()
{
return Deserialize(_jsonDocument.RootElement);
}

protected virtual T Deserialize(BinaryData data)
{
return Deserialize(JsonDocument.Parse(data).RootElement);
}

[Benchmark]
[BenchmarkCategory("Internal")]
public T Deserialize_Internal_BinaryData()
{
return Deserialize(_data);
}

[Benchmark]
[BenchmarkCategory("Cast")]
public T Deserialize_ExplicitCast()
Expand Down Expand Up @@ -189,5 +201,21 @@ public void JsonDocumentFromBinaryData()
{
using var doc = JsonDocument.Parse(_data);
}

protected virtual void ModifyValues(T model) { }

[Benchmark]
[BenchmarkCategory("Usage")]
public void EndToEndUseCase()
{
// Instantiate an input model
T model = ModelSerializer.Deserialize<T>(_data);

// Set properties on it
ModifyValues(model);

// Send it over the wire - serialize
RequestContent content = CastToRequestContent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.IO;
using System.Text.Json;
using Azure.Core.Tests.PatchModels;

namespace Azure.Core.Perf.Serializations
{
public class SimplePatchModelBenchmark : JsonBenchmark<SimplePatchModel>
{
protected override SimplePatchModel CastFromResponse() => (SimplePatchModel)_response;

protected override RequestContent CastToRequestContent() => _model;

protected override SimplePatchModel Deserialize(JsonElement jsonElement)
{
using Stream stream = new MemoryStream();
using Utf8JsonWriter writer = new(stream);
jsonElement.WriteTo(writer);
writer.Flush();
stream.Position = 0;
return Deserialize(BinaryData.FromStream(stream));
}

protected override SimplePatchModel Deserialize(BinaryData data) => SimplePatchModel.Deserialize(data);

protected override void Serialize(Utf8JsonWriter writer) => _model.Serialize(writer);

protected override string JsonFileName => "SimplePatchModel.json";

protected override void ModifyValues(SimplePatchModel model)
{
model.Name = "xyz";
model.Count = 2;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Text.Json;
using Azure.Core.Tests.PatchModels;

namespace Azure.Core.Perf.Serializations
{
public class SimpleStandardModelBenchmark : JsonBenchmark<SimpleStandardModel>
{
protected override SimpleStandardModel CastFromResponse() => (SimpleStandardModel)_response;

protected override RequestContent CastToRequestContent() => _model;

protected override SimpleStandardModel Deserialize(JsonElement jsonElement)
{
return SimpleStandardModel.DeserializeSimpleStandardModel(jsonElement, new("J"));
}

protected override void Serialize(Utf8JsonWriter writer) => _model.Serialize(writer);

protected override string JsonFileName => "SimpleStandardModel.json";

protected override void ModifyValues(SimpleStandardModel model)
{
model.Name = "xyz";
model.Count = 2;
}
}
}
3 changes: 2 additions & 1 deletion sdk/core/Azure.Core/src/Shared/MutableJsonDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,12 @@ public void Dispose()
_originalDocument.Dispose();
}

private static JsonSerializerOptions DefaultSerializerOptions = new JsonSerializerOptions();
private MutableJsonDocument(JsonDocument document, ReadOnlyMemory<byte> utf8Json, JsonSerializerOptions? serializerOptions)
{
_originalDocument = document;
_original = utf8Json;
_serializerOptions = serializerOptions ?? new JsonSerializerOptions();
_serializerOptions = serializerOptions ?? DefaultSerializerOptions;
}

private class MutableJsonDocumentConverter : JsonConverter<MutableJsonDocument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
</ItemGroup>

<ItemGroup>
<None Update="TestData\SimpleStandardModel.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestData\SimplePatchModel.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestData\AvailabilitySetData.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "abc",
"count": 1,
"updatedOn": "2023-10-19T10:19:10.0190001Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "abc",
"count": 1,
"updatedOn": "2023-10-19T10:19:10.0190001Z"
}
92 changes: 92 additions & 0 deletions sdk/core/Azure.Core/tests/public/PatchModels/PatchModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,98 @@ public void CanRoundTripSimpleModel()
ValidatePatch("""{"count":2, "name":"xyz"}""", model);
}

#region Standard model

[Test]
public void CanSetIntProperty()
{
JsonDocument doc = JsonDocument.Parse("""
{
"name": "abc",
"count": 1,
"updatedOn": "2023-10-19T10:19:10.0190001Z"
}
""");
SimpleStandardModel model = SimpleStandardModel.DeserializeSimpleStandardModel(doc.RootElement, new ModelSerializerOptions("J"));
model.Count = 2;

ValidateSerialize("""
{
"name": "abc",
"count": 2,
"updatedOn": "2023-10-19T10:19:10.0190001Z"
}
""", model);
}

[Test]
public void CanSetStringProperty()
{
JsonDocument doc = JsonDocument.Parse("""
{
"name": "abc",
"count": 1,
"updatedOn": "2023-10-19T10:19:10.0190001Z"
}
""");
SimpleStandardModel model = SimpleStandardModel.DeserializeSimpleStandardModel(doc.RootElement, new ModelSerializerOptions("J"));
model.Name = "xyz";

ValidateSerialize("""
{
"name": "xyz",
"count": 1,
"updatedOn": "2023-10-19T10:19:10.0190001Z"
}
""", model);
}

[Test]
public void CanSetDateTimeProperty()
{
DateTimeOffset updateTime = DateTimeOffset.Parse("2023-10-20T10:20:10.0190001Z");
JsonDocument doc = JsonDocument.Parse("""
{
"name": "abc",
"count": 1,
"updatedOn": "2023-10-19T10:19:10.0190001Z"
}
""");

SimpleStandardModel model = SimpleStandardModel.DeserializeSimpleStandardModel(doc.RootElement, new ModelSerializerOptions("J"));
model.UpdatedOn = updateTime;

ValidateSerialize("""
{
"name": "abc",
"count": 1,
"updatedOn": "2023-10-20T10:20:10.0190001Z"
}
""", model);
}

[Test]
public void CanRoundTripSimpleStandardModel()
{
BinaryData json = BinaryData.FromString("""
{
"name": "abc",
"count": 1
}
""");

SimplePatchModel model = ModelSerializer.Deserialize<SimplePatchModel>(json);

Assert.AreEqual(1, model.Count);
Assert.AreEqual("abc", model.Name);

model.Name = "xyz";
model.Count = 2;

ValidatePatch("""{"count":2, "name":"xyz"}""", model);
}
#endregion standard model

[Test]
public void CanPatchNestedModel()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Azure.Core.Tests.PatchModels
{
public partial class SimplePatchModel : IModelJsonSerializable<SimplePatchModel>
public partial class SimplePatchModel : IModelJsonSerializable<SimplePatchModel>, IUtf8JsonSerializable
{
SimplePatchModel IModelJsonSerializable<SimplePatchModel>.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options)
{
Expand Down Expand Up @@ -62,11 +62,20 @@ BinaryData IModelSerializable<SimplePatchModel>.Serialize(ModelSerializerOptions
return ModelSerializer.SerializeCore(this, options);
}

public static implicit operator RequestContent(SimplePatchModel model)
=> RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions);

public static explicit operator SimplePatchModel(Response response)
{
Argument.AssertNotNull(response, nameof(response));

return Deserialize(response.Content, ModelSerializerOptions.DefaultWireOptions);
}

void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable<SimplePatchModel>)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions);

// TODO: Temp for pef tests
public void Serialize(Utf8JsonWriter writer) => ((IUtf8JsonSerializable)this).Write(writer);
public static SimplePatchModel Deserialize(BinaryData data) => Deserialize(data, ModelSerializerOptions.DefaultWireOptions);
}
}
Loading