-
Notifications
You must be signed in to change notification settings - Fork 5k
[Monitor Ingestion] AOT Support #51563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
4d55884
to
02463bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds ModelReaderWriterContext support to the Azure Monitor Ingestion SDK by enabling the use-model-reader-writer
option in AutoRest configuration and introducing the AzureMonitorIngestionContext
class.
- Enables ModelReaderWriterContext functionality in AutoRest configuration
- Adds a new
AzureMonitorIngestionContext
class that extendsModelReaderWriterContext
- Updates API surface across all target frameworks
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
sdk/monitor/Azure.Monitor.Ingestion/src/autorest.md | Enables ModelReaderWriterContext generation by adding use-model-reader-writer: true |
sdk/monitor/Azure.Monitor.Ingestion/api/Azure.Monitor.Ingestion.netstandard2.0.cs | Adds AzureMonitorIngestionContext class for .NET Standard 2.0 |
sdk/monitor/Azure.Monitor.Ingestion/api/Azure.Monitor.Ingestion.net8.0.cs | Adds AzureMonitorIngestionContext class for .NET 8.0 |
sdk/monitor/Azure.Monitor.Ingestion/api/Azure.Monitor.Ingestion.net462.cs | Adds AzureMonitorIngestionContext class for .NET Framework 4.6.2 |
sdk/monitor/Azure.Monitor.Ingestion/api/Azure.Monitor.Ingestion.netstandard2.0.cs
Show resolved
Hide resolved
//cc: @sbomer |
/azp run net - Azure.Monitor.Ingestion - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
@sbomer: I'd appreciate your thoughts with respect to the AOT path here. We've got two warnings, for:
This traces back to an incoming type that we do not own, and therefore cannot provide a context for. It falls back to internal static IEnumerable<BatchedLogs> Batch<T>(IEnumerable<T> logEntries, LogsUploadOptions options = null)
{
// ... SNIP
foreach (var log in logEntries)
{
BinaryData entry;
// If log is already BinaryData, no need to serialize it
if (log is BinaryData d)
entry = d;
// If log is not BinaryData, serialize it. Default Serializer is System.Text.Json
else if (options == null || options.Serializer == null)
entry = BinaryData.FromObjectAsJson(log);
// ... SNIP Seeing as how |
Typically we mark the existing api with requires unreferenced / dynamic code and add an overload which will take in a context. Either a ModelReaderWriterContext if we are using MRW here (most common for azure sdks) or a JsonSerializerContext if you are using STJ |
02463bb
to
6c85a86
Compare
/azp run net - Azure.Monitor.Ingestion - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
The focus of these changes is to regenerate the Ingestion client using the new AOT-friendly serialization paths and to ensure that the client is compatible with Ahead-of-Time (AOT) compilation. This is critical for inclusion in the Azure.MCP product. Compliance required new overloads for log uploads, as the existing form allowed for runtime serialization in different forms, which were not compatible with AOT. For AOT scenarios, log uploads will accept `BinaryData` directly, allowing callers to prepare their data in a way that is compatible with AOT compilation.
6534000
to
3b87685
Compare
sdk/monitor/Azure.Monitor.Ingestion/samples/Sample1_LogDataAsync.md
Outdated
Show resolved
Hide resolved
…nc.md Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
Contributing to the Azure SDK
Please see our CONTRIBUTING.md if you are not familiar with contributing to this repository or have questions.
For specific information about pull request etiquette and best practices, see this section.