Skip to content

Commit

Permalink
[Azure.Monitor.Ingestion] Add Concurrency Upload method (#31074)
Browse files Browse the repository at this point in the history
  • Loading branch information
nisha-bhatia authored Sep 23, 2022
1 parent 8c184c6 commit 45eb45c
Show file tree
Hide file tree
Showing 23 changed files with 2,047 additions and 228 deletions.
13 changes: 4 additions & 9 deletions sdk/monitor/Azure.Monitor.Ingestion/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# Release History

## 1.0.0-beta.3 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
## 1.0.0-beta.3 (2022-09-23)
## Features Added
- Added Concurrency with Multi-Threading to Upload methods
- Added Model `UploadLogsResult` representing the request to upload logs to Azure Monitor

## 1.0.0-beta.2 (2022-08-26)
## Features Added
Expand Down
4 changes: 2 additions & 2 deletions sdk/monitor/Azure.Monitor.Ingestion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ TokenCredential credential = new DefaultAzureCredential();

LogsQueryClient logsQueryClient = new(credential);
LogsBatchQuery batch = new();
string query = tableName + " | count;";
string query = tableName + " | Count;";
string countQueryId = batch.AddWorkspaceQuery(
workspaceId,
query,
new QueryTimeRange(TimeSpan.FromDays(1)));

Response<LogsBatchQueryResultCollection> queryResponse = logsQueryClient.QueryBatch(batch);

Console.WriteLine("Table entry count: " + queryResponse.Value.GetResult<int>(countQueryId).Single());
Console.WriteLine("Table entry Count: " + queryResponse.Value.GetResult<int>(countQueryId).Single());
```

## Troubleshooting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ protected LogsIngestionClient() { }
public LogsIngestionClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { }
public LogsIngestionClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Monitor.Ingestion.LogsIngestionClientOptions options) { }
public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
public virtual Azure.Response Upload(string ruleId, string streamName, Azure.Core.RequestContent content, string contentEncoding = "gzip", Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> UploadAsync(string ruleId, string streamName, Azure.Core.RequestContent content, string contentEncoding = "gzip", Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult>> UploadAsync<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logEntries, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult> Upload<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logEntries, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult>> UploadAsync<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logs, Azure.Monitor.Ingestion.UploadLogsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult> Upload<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logs, Azure.Monitor.Ingestion.UploadLogsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class LogsIngestionClientOptions : Azure.Core.ClientOptions
{
Expand All @@ -23,7 +21,13 @@ public partial class UploadLogsError
{
internal UploadLogsError() { }
public Azure.ResponseError Error { get { throw null; } }
public System.Collections.Generic.IEnumerable<object> FailedLogs { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<System.BinaryData> FailedLogs { get { throw null; } }
}
public partial class UploadLogsOptions
{
public UploadLogsOptions() { }
public int MaxConcurrency { get { throw null; } set { } }
public Azure.Core.Serialization.ObjectSerializer Serializer { get { throw null; } set { } }
}
public partial class UploadLogsResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ protected LogsIngestionClient() { }
public LogsIngestionClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { }
public LogsIngestionClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Monitor.Ingestion.LogsIngestionClientOptions options) { }
public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
public virtual Azure.Response Upload(string ruleId, string streamName, Azure.Core.RequestContent content, string contentEncoding = "gzip", Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> UploadAsync(string ruleId, string streamName, Azure.Core.RequestContent content, string contentEncoding = "gzip", Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult>> UploadAsync<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logEntries, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult> Upload<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logEntries, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult>> UploadAsync<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logs, Azure.Monitor.Ingestion.UploadLogsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult> Upload<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logs, Azure.Monitor.Ingestion.UploadLogsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class LogsIngestionClientOptions : Azure.Core.ClientOptions
{
Expand All @@ -23,7 +21,13 @@ public partial class UploadLogsError
{
internal UploadLogsError() { }
public Azure.ResponseError Error { get { throw null; } }
public System.Collections.Generic.IEnumerable<object> FailedLogs { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<System.BinaryData> FailedLogs { get { throw null; } }
}
public partial class UploadLogsOptions
{
public UploadLogsOptions() { }
public int MaxConcurrency { get { throw null; } set { } }
public Azure.Core.Serialization.ObjectSerializer Serializer { get { throw null; } set { } }
}
public partial class UploadLogsResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ protected LogsIngestionClient() { }
public LogsIngestionClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { }
public LogsIngestionClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Monitor.Ingestion.LogsIngestionClientOptions options) { }
public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
public virtual Azure.Response Upload(string ruleId, string streamName, Azure.Core.RequestContent content, string contentEncoding = "gzip", Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> UploadAsync(string ruleId, string streamName, Azure.Core.RequestContent content, string contentEncoding = "gzip", Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult>> UploadAsync<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logEntries, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult> Upload<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logEntries, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult>> UploadAsync<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logs, Azure.Monitor.Ingestion.UploadLogsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Monitor.Ingestion.UploadLogsResult> Upload<T>(string ruleId, string streamName, System.Collections.Generic.IEnumerable<T> logs, Azure.Monitor.Ingestion.UploadLogsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class LogsIngestionClientOptions : Azure.Core.ClientOptions
{
Expand All @@ -23,7 +21,13 @@ public partial class UploadLogsError
{
internal UploadLogsError() { }
public Azure.ResponseError Error { get { throw null; } }
public System.Collections.Generic.IEnumerable<object> FailedLogs { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<System.BinaryData> FailedLogs { get { throw null; } }
}
public partial class UploadLogsOptions
{
public UploadLogsOptions() { }
public int MaxConcurrency { get { throw null; } set { } }
public Azure.Core.Serialization.ObjectSerializer Serializer { get { throw null; } set { } }
}
public partial class UploadLogsResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ TokenCredential credential = new DefaultAzureCredential();

LogsQueryClient logsQueryClient = new(credential);
LogsBatchQuery batch = new();
string query = tableName + " | count;";
string query = tableName + " | Count;";
string countQueryId = batch.AddWorkspaceQuery(
workspaceId,
query,
new QueryTimeRange(TimeSpan.FromDays(1)));

Response<LogsBatchQueryResultCollection> queryResponse = logsQueryClient.QueryBatch(batch);

Console.WriteLine("Table entry count: " + queryResponse.Value.GetResult<int>(countQueryId).Single());
Console.WriteLine("Table entry Count: " + queryResponse.Value.GetResult<int>(countQueryId).Single());
```

To see the full example source files, see [Query](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.Ingestion/tests/Samples/LogDataAndQuery.cs).
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ TokenCredential credential = new DefaultAzureCredential();

LogsQueryClient logsQueryClient = new(credential);
LogsBatchQuery batch = new();
string query = tableName + " | count;";
string query = tableName + " | Count;";
string countQueryId = batch.AddWorkspaceQuery(
workspaceId,
query,
new QueryTimeRange(TimeSpan.FromDays(1)));

Response<LogsBatchQueryResultCollection> queryResponse = await logsQueryClient.QueryBatchAsync(batch).ConfigureAwait(false);

Console.WriteLine("Table entry count: " + queryResponse.Value.GetResult<int>(countQueryId).Single());
Console.WriteLine("Table entry Count: " + queryResponse.Value.GetResult<int>(countQueryId).Single());
```

To see the full example source files, see [QueryAsync](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.Ingestion/tests/Samples/LogDataAndQueryAsync.cs).

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 45eb45c

Please sign in to comment.