Skip to content

Commit 6c7f823

Browse files
[Monitor Ingestion] Api changes and abort test fixes (#24885)
1 parent 8e69866 commit 6c7f823

33 files changed

+1211
-128
lines changed

sdk/monitor/monitor-ingestion/CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
### Features Added
66

7-
- Added an error callback functionality for inspecting individual log uploads via `UploadLogsOptions`.
7+
- Added an error callback functionality for inspecting individual log uploads via `LogsUploadOptions`.
88

99
### Breaking Changes
1010

11-
- The `upload` API throws an `AggregateUploadLogsError` in case of an error and returns `void` when operation succeeds.
12-
- Renamed `UploadLogsError` to `UploadLogsFailure`.
11+
- The `upload` API throws an `AggregateLogsUploadError` in case of an error and returns `void` when operation succeeds.
12+
- Renamed `LogsUploadError` to `LogsUploadFailure`.
1313

1414
### Other Changes
1515

16-
- `UploadLogsOptions` supports the `OperationOptions` from @azure/core-client, allowing users to abort operations when needed.
16+
- `LogsUploadOptions` supports the `OperationOptions` from @azure/core-client, allowing users to abort operations when needed.
1717
- Added samples for all error handling scenarios.
1818
## 1.0.0-beta.3 (2022-10-13)
1919

sdk/monitor/monitor-ingestion/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ You can familiarize yourself with different APIs using [Samples](https://github.
8989
You can create a client and call the client's `Upload` method. Take note of the data ingestion [limits](https://learn.microsoft.com/azure/azure-monitor/service-limits#custom-logs).
9090

9191
```js
92-
const { isAggregateUploadLogsError, DefaultAzureCredential } = require("@azure/identity");
92+
const { isAggregateLogsUploadError, DefaultAzureCredential } = require("@azure/identity");
9393
const { LogsIngestionClient } = require("@azure/monitor-ingestion");
9494

9595
require("dotenv").config();
@@ -116,7 +116,7 @@ async function main() {
116116
await client.upload(ruleId, streamName, logs);
117117
}
118118
catch(e){
119-
let aggregateErrors = isAggregateUploadLogsError(e) ? e.errors : [];
119+
let aggregateErrors = isAggregateLogsUploadError(e) ? e.errors : [];
120120
if (aggregateErrors.length > 0) {
121121
console.log("Some logs have failed to complete ingestion");
122122
for (const error of aggregateErrors) {
@@ -192,7 +192,7 @@ When uploading more than 1MB of logs in a single call to the `upload` method on
192192

193193
```js
194194
const { DefaultAzureCredential } = require("@azure/identity");
195-
const { isAggregateUploadLogsError, LogsIngestionClient } = require("@azure/monitor-ingestion");
195+
const { isAggregateLogsUploadError, LogsIngestionClient } = require("@azure/monitor-ingestion");
196196

197197
require("dotenv").config();
198198

@@ -218,7 +218,7 @@ async function main() {
218218
await client.upload(ruleId, streamName, logs, { maxConcurrency: 1 });
219219
}
220220
catch(e){
221-
let aggregateErrors = isAggregateUploadLogsError(e) ? e.errors : [];
221+
let aggregateErrors = isAggregateLogsUploadError(e) ? e.errors : [];
222222
if (aggregateErrors.length > 0) {
223223
console.log("Some logs have failed to complete ingestion");
224224
for (const error of aggregateErrors) {

sdk/monitor/monitor-ingestion/recordings/browsers/logsingestionclient_live_tests/recording_user_abort_additional_processing_early_if_they_handle_the_error.json

Lines changed: 131 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/monitor/monitor-ingestion/recordings/node/logsingestionclient_live_tests/recording_user_abort_additional_processing_early_if_they_handle_the_error.json

Lines changed: 14 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/monitor/monitor-ingestion/review/monitor-ingestion.api.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ import { OperationOptions } from '@azure/core-client';
99
import { TokenCredential } from '@azure/core-auth';
1010

1111
// @public
12-
export class AggregateUploadLogsError extends Error {
13-
constructor(errors: UploadLogsFailure[], errorMessage?: string);
14-
errors: UploadLogsFailure[];
12+
export class AggregateLogsUploadError extends Error {
13+
constructor(errors: LogsUploadFailure[], errorMessage?: string);
14+
errors: LogsUploadFailure[];
1515
}
1616

1717
// @public
18-
export const AggregateUploadLogsErrorName = "AggregateUploadLogsError";
18+
export const AggregateLogsUploadErrorName = "AggregateLogsUploadError";
1919

2020
// @public
21-
export function isAggregateUploadLogsError(e: unknown): e is AggregateUploadLogsError;
21+
export function isAggregateLogsUploadError(e: unknown): e is AggregateLogsUploadError;
2222

2323
// @public
2424
export class LogsIngestionClient {
2525
constructor(endpoint: string, tokenCredential: TokenCredential, options?: LogsIngestionClientOptions);
26-
upload(ruleId: string, streamName: string, logs: Record<string, unknown>[], options?: UploadLogsOptions): Promise<void>;
26+
upload(ruleId: string, streamName: string, logs: Record<string, unknown>[], options?: LogsUploadOptions): Promise<void>;
2727
}
2828

2929
// @public
@@ -32,15 +32,15 @@ export interface LogsIngestionClientOptions extends CommonClientOptions {
3232
}
3333

3434
// @public
35-
export interface UploadLogsFailure {
35+
export interface LogsUploadFailure {
3636
cause: Error;
3737
failedLogs: Record<string, unknown>[];
3838
}
3939

4040
// @public
41-
export interface UploadLogsOptions extends OperationOptions {
41+
export interface LogsUploadOptions extends OperationOptions {
4242
maxConcurrency?: number;
43-
onError?: (uploadLogsError: UploadLogsFailure) => void;
43+
onError?: (uploadLogsError: LogsUploadFailure) => void;
4444
}
4545

4646
```

sdk/monitor/monitor-ingestion/samples-dev/defaultConcurrency.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import { DefaultAzureCredential } from "@azure/identity";
10-
import { isAggregateUploadLogsError, LogsIngestionClient } from "@azure/monitor-ingestion";
10+
import { isAggregateLogsUploadError, LogsIngestionClient } from "@azure/monitor-ingestion";
1111

1212
require("dotenv").config();
1313

@@ -33,7 +33,7 @@ async function main() {
3333
try {
3434
await client.upload(ruleId, streamName, logs);
3535
} catch (e) {
36-
if (isAggregateUploadLogsError(e)) {
36+
if (isAggregateLogsUploadError(e)) {
3737
let aggregateErrors = e.errors;
3838
if (aggregateErrors.length > 0) {
3939
console.log(

sdk/monitor/monitor-ingestion/samples-dev/earlyAborting.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
import { DefaultAzureCredential } from "@azure/identity";
1010
import {
11-
isAggregateUploadLogsError,
11+
isAggregateLogsUploadError,
1212
LogsIngestionClient,
13-
UploadLogsFailure,
13+
LogsUploadFailure,
1414
} from "@azure/monitor-ingestion";
1515

1616
require("dotenv").config();
@@ -22,7 +22,7 @@ async function main() {
2222
const client = new LogsIngestionClient(logsIngestionEndpoint, credential);
2323
let abortController = new AbortController();
2424

25-
function errorCallback(uploadLogsError: UploadLogsFailure) {
25+
function errorCallback(uploadLogsError: LogsUploadFailure) {
2626
if (
2727
(uploadLogsError.cause as Error).message ===
2828
"Data collection rule with immutable Id 'immutable-id-123' not found."
@@ -48,7 +48,7 @@ async function main() {
4848
abortSignal: abortController.signal,
4949
});
5050
} catch (e) {
51-
if (isAggregateUploadLogsError(e)) {
51+
if (isAggregateLogsUploadError(e)) {
5252
let aggregateErrors = e.errors;
5353
if (aggregateErrors.length > 0) {
5454
console.log(

sdk/monitor/monitor-ingestion/samples-dev/logsIngestionClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* The user can track failed log entries and the associated error message via the AggregateUploadLogsError Object
77
*/
88

9-
import { isAggregateUploadLogsError, LogsIngestionClient } from "@azure/monitor-ingestion";
9+
import { isAggregateLogsUploadError, LogsIngestionClient } from "@azure/monitor-ingestion";
1010
import { DefaultAzureCredential } from "@azure/identity";
1111

1212
import * as dotenv from "dotenv";
@@ -24,7 +24,7 @@ export async function main() {
2424
});
2525
console.log("All the logs provided are successfully ingested");
2626
} catch (e) {
27-
let aggregateErrors = isAggregateUploadLogsError(e) ? e.errors : [];
27+
let aggregateErrors = isAggregateLogsUploadError(e) ? e.errors : [];
2828
if (aggregateErrors.length > 0) {
2929
console.log("Some logs have failed to complete ingestion");
3030
for (const error of aggregateErrors) {

sdk/monitor/monitor-ingestion/samples-dev/uploadCustomLogs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* The user can track failed log entries and the associated error message via the AggregateUploadLogsError Object.
77
*/
88
import { DefaultAzureCredential } from "@azure/identity";
9-
import { isAggregateUploadLogsError, LogsIngestionClient } from "@azure/monitor-ingestion";
9+
import { isAggregateLogsUploadError, LogsIngestionClient } from "@azure/monitor-ingestion";
1010

1111
import * as dotenv from "dotenv";
1212
dotenv.config();
@@ -32,7 +32,7 @@ export async function main() {
3232
try {
3333
await client.upload(ruleId, streamName, logs);
3434
} catch (e) {
35-
let aggregateErrors = isAggregateUploadLogsError(e) ? e.errors : [];
35+
let aggregateErrors = isAggregateLogsUploadError(e) ? e.errors : [];
3636
console.log(
3737
"Some logs have failed to complete ingestion. Length of errors =",
3838
aggregateErrors.length

sdk/monitor/monitor-ingestion/samples-dev/userDefinedConcurrency.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { DefaultAzureCredential } from "@azure/identity";
9-
import { isAggregateUploadLogsError, LogsIngestionClient } from "@azure/monitor-ingestion";
9+
import { isAggregateLogsUploadError, LogsIngestionClient } from "@azure/monitor-ingestion";
1010

1111
require("dotenv").config();
1212

@@ -31,7 +31,7 @@ async function main() {
3131
try {
3232
await client.upload(ruleId, streamName, logs, { maxConcurrency: 1 });
3333
} catch (e) {
34-
if (isAggregateUploadLogsError(e)) {
34+
if (isAggregateLogsUploadError(e)) {
3535
let aggregateErrors = e.errors;
3636
console.log(
3737
"Some logs have failed to complete ingestion. Length of errors =",

0 commit comments

Comments
 (0)