Skip to content

Commit 1d4f79d

Browse files
authored
[Metrics Advisor] Renamed Feedback API's (Azure#17240)
1 parent eff3351 commit 1d4f79d

File tree

14 files changed

+133
-130
lines changed

14 files changed

+133
-130
lines changed

sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
- Renamed property `confidenceScore` to `contributionScore` and its accessors on `IncidentRootCause` model.
1515
- Removed model `ListMetricSeriesData` as top and skip parameters are not valid for this API.
1616
- Moved `startTime` and `endTime` to positional arguments on several methods as they are required.
17+
- Renamed Data feed ingestion granularity type to `"PerMinute"` and `"PerSecond"` instead of `"Minutely"` and `"Secondly"`.
18+
- Renamed Feedback api's from `createMetricFeedback`, `getMetricFeedback` and `listMetricFeedbacks`
19+
to `addFeedback`, `getFeedback` and `listFeedback` respectively.
1720

1821
## 1.0.0-beta.1 (2020-10-07)
1922
Version 1.0.0-beta.1 is a preview of our efforts in creating a Azure Metrics Advisor client library that is developer-friendly

sdk/metricsadvisor/azure-ai-metricsadvisor/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ gracefully by catching the exception and display the additional information abou
301301
<!-- embedme ./src/samples/java/com/azure/ai/metricsadvisor/ReadmeSamples.java#L256-L260 -->
302302
```java
303303
try {
304-
metricsAdvisorClient.getMetricFeedback("non_existing_feedback_id");
304+
metricsAdvisorClient.getFeedback("non_existing_feedback_id");
305305
} catch (HttpResponseException e) {
306306
System.out.println(e.getMessage());
307307
}

sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClient.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ private Mono<PagedResponse<AnomalyIncident>> listIncidentsForAlertNextPageAsync(
12731273
* Create a new metric feedback.
12741274
*
12751275
* <p><strong>Code sample</strong></p>
1276-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.createMetricFeedback#String-MetricFeedback}
1276+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeeddback#String-MetricFeedback}
12771277
*
12781278
* @param metricId the unique id for which the feedback needs to be submitted.
12791279
* @param metricFeedback the actual metric feedback.
@@ -1282,15 +1282,15 @@ private Mono<PagedResponse<AnomalyIncident>> listIncidentsForAlertNextPageAsync(
12821282
* @throws NullPointerException If {@code metricId}, {@code metricFeedback.dimensionFilter} is null.
12831283
*/
12841284
@ServiceMethod(returns = ReturnType.SINGLE)
1285-
public Mono<MetricFeedback> createMetricFeedback(String metricId, MetricFeedback metricFeedback) {
1286-
return createMetricFeedbackWithResponse(metricId, metricFeedback).flatMap(FluxUtil::toMono);
1285+
public Mono<MetricFeedback> addFeeddback(String metricId, MetricFeedback metricFeedback) {
1286+
return addFeedbackWithResponse(metricId, metricFeedback).flatMap(FluxUtil::toMono);
12871287
}
12881288

12891289
/**
12901290
* Create a new metric feedback.
12911291
*
12921292
* <p><strong>Code sample</strong></p>
1293-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.createMetricFeedbackWithResponse#String-MetricFeedback}
1293+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeedbackWithResponse#String-MetricFeedback}
12941294
*
12951295
* @param metricId the unique id for which the feedback needs to be submitted.
12961296
* @param metricFeedback the actual metric feedback.
@@ -1300,16 +1300,16 @@ public Mono<MetricFeedback> createMetricFeedback(String metricId, MetricFeedback
13001300
* {@code metricFeedback.dimensionFilter} is null.
13011301
*/
13021302
@ServiceMethod(returns = ReturnType.SINGLE)
1303-
public Mono<Response<MetricFeedback>> createMetricFeedbackWithResponse(String metricId,
1303+
public Mono<Response<MetricFeedback>> addFeedbackWithResponse(String metricId,
13041304
MetricFeedback metricFeedback) {
13051305
try {
1306-
return withContext(context -> createMetricFeedbackWithResponse(metricId, metricFeedback, context));
1306+
return withContext(context -> addFeedbackWithResponse(metricId, metricFeedback, context));
13071307
} catch (RuntimeException ex) {
13081308
return monoError(logger, ex);
13091309
}
13101310
}
13111311

1312-
Mono<Response<MetricFeedback>> createMetricFeedbackWithResponse(String metricId, MetricFeedback metricFeedback,
1312+
Mono<Response<MetricFeedback>> addFeedbackWithResponse(String metricId, MetricFeedback metricFeedback,
13131313
Context context) {
13141314
Objects.requireNonNull(metricId, "'metricId' is required.");
13151315
Objects.requireNonNull(metricFeedback, "'metricFeedback' is required.");
@@ -1388,15 +1388,15 @@ Mono<Response<MetricFeedback>> createMetricFeedbackWithResponse(String metricId,
13881388
}
13891389
return service.createMetricFeedbackWithResponseAsync(innerMetricFeedback, context)
13901390
.flatMap(createdMetricFeedbackResponse ->
1391-
getMetricFeedbackWithResponse(parseOperationId(createdMetricFeedbackResponse
1391+
getFeedbackWithResponse(parseOperationId(createdMetricFeedbackResponse
13921392
.getDeserializedHeaders().getLocation())));
13931393
}
13941394

13951395
/**
13961396
* Get a metric feedback by its id.
13971397
*
13981398
* <p><strong>Code sample</strong></p>
1399-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.getMetricFeedback#String}
1399+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.getFeedback#String}
14001400
*
14011401
* @param feedbackId The metric feedback unique id.
14021402
*
@@ -1405,15 +1405,15 @@ Mono<Response<MetricFeedback>> createMetricFeedbackWithResponse(String metricId,
14051405
* @throws NullPointerException thrown if the {@code feedbackId} is null.
14061406
*/
14071407
@ServiceMethod(returns = ReturnType.SINGLE)
1408-
public Mono<MetricFeedback> getMetricFeedback(String feedbackId) {
1409-
return getMetricFeedbackWithResponse(feedbackId).flatMap(FluxUtil::toMono);
1408+
public Mono<MetricFeedback> getFeedback(String feedbackId) {
1409+
return getFeedbackWithResponse(feedbackId).flatMap(FluxUtil::toMono);
14101410
}
14111411

14121412
/**
14131413
* Get a metric feedback by its id.
14141414
*
14151415
* <p><strong>Code sample</strong></p>
1416-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.getMetricFeedbackWithResponse#String}
1416+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.getFeedbackWithResponse#String}
14171417
*
14181418
* @param feedbackId The metric feedback unique id.
14191419
*
@@ -1422,15 +1422,15 @@ public Mono<MetricFeedback> getMetricFeedback(String feedbackId) {
14221422
* @throws NullPointerException thrown if the {@code feedbackId} is null.
14231423
*/
14241424
@ServiceMethod(returns = ReturnType.SINGLE)
1425-
public Mono<Response<MetricFeedback>> getMetricFeedbackWithResponse(String feedbackId) {
1425+
public Mono<Response<MetricFeedback>> getFeedbackWithResponse(String feedbackId) {
14261426
try {
1427-
return withContext(context -> getMetricFeedbackWithResponse(feedbackId, context));
1427+
return withContext(context -> getFeedbackWithResponse(feedbackId, context));
14281428
} catch (RuntimeException ex) {
14291429
return monoError(logger, ex);
14301430
}
14311431
}
14321432

1433-
Mono<Response<MetricFeedback>> getMetricFeedbackWithResponse(String feedbackId, Context context) {
1433+
Mono<Response<MetricFeedback>> getFeedbackWithResponse(String feedbackId, Context context) {
14341434
Objects.requireNonNull(feedbackId, "'feedbackId' is required.");
14351435
return service.getMetricFeedbackWithResponseAsync(UUID.fromString(feedbackId), context)
14361436
.map(metricFeedbackResponse -> new SimpleResponse<>(metricFeedbackResponse,
@@ -1441,7 +1441,7 @@ Mono<Response<MetricFeedback>> getMetricFeedbackWithResponse(String feedbackId,
14411441
* List information of metrics feedback on the account for a metric Id.
14421442
*
14431443
* <p><strong>Code sample</strong></p>
1444-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricFeedbacks#String}
1444+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listFeedback#String}
14451445
*
14461446
* @param metricId the unique metric Id.
14471447
*
@@ -1452,15 +1452,15 @@ Mono<Response<MetricFeedback>> getMetricFeedbackWithResponse(String feedbackId,
14521452
* @throws NullPointerException thrown if the {@code metricId} is null.
14531453
*/
14541454
@ServiceMethod(returns = ReturnType.COLLECTION)
1455-
public PagedFlux<MetricFeedback> listMetricFeedbacks(String metricId) {
1456-
return listMetricFeedbacks(metricId, null);
1455+
public PagedFlux<MetricFeedback> listFeedback(String metricId) {
1456+
return listFeedback(metricId, null);
14571457
}
14581458

14591459
/**
14601460
* List information of all metric feedbacks on the metrics advisor account for a metric Id.
14611461
*
14621462
* <p><strong>Code sample</strong></p>
1463-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricFeedbacks#String-ListMetricFeedbackOptions}
1463+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listFeedback#String-ListMetricFeedbackOptions}
14641464
*
14651465
* @param metricId the unique metric Id.
14661466
* @param options The configurable {@link ListMetricFeedbackOptions options} to pass for filtering the output
@@ -1473,7 +1473,7 @@ public PagedFlux<MetricFeedback> listMetricFeedbacks(String metricId) {
14731473
* @throws NullPointerException thrown if the {@code metricId} is null.
14741474
*/
14751475
@ServiceMethod(returns = ReturnType.COLLECTION)
1476-
public PagedFlux<MetricFeedback> listMetricFeedbacks(
1476+
public PagedFlux<MetricFeedback> listFeedback(
14771477
String metricId,
14781478
ListMetricFeedbackOptions options) {
14791479
options = options != null ? options : new ListMetricFeedbackOptions();
@@ -1492,7 +1492,7 @@ public PagedFlux<MetricFeedback> listMetricFeedbacks(
14921492
}
14931493
}
14941494

1495-
PagedFlux<MetricFeedback> listMetricFeedbacks(String metricId, ListMetricFeedbackOptions options, Context context) {
1495+
PagedFlux<MetricFeedback> listFeedback(String metricId, ListMetricFeedbackOptions options, Context context) {
14961496
options = options != null ? options : new ListMetricFeedbackOptions();
14971497
final MetricFeedbackFilter metricFeedbackFilter = MetricFeedbackTransforms.toInnerFilter(metricId, options);
14981498
final ListMetricFeedbackOptions finalOptions = options;

sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClient.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ public PagedIterable<AnomalyIncident> listIncidentsForAlert(
628628
* Create a new metric feedback.
629629
*
630630
* <p><strong>Code sample</strong></p>
631-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.createMetricFeedback#String-MetricFeedback}
631+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeeddback#String-MetricFeedback}
632632
*
633633
* @param metricId the unique id for which the feedback needs to be submitted.
634634
* @param metricFeedback the actual metric feedback.
@@ -637,15 +637,15 @@ public PagedIterable<AnomalyIncident> listIncidentsForAlert(
637637
* @throws NullPointerException If {@code metricId}, {@code metricFeedback.dimensionFilter} is null.
638638
*/
639639
@ServiceMethod(returns = ReturnType.SINGLE)
640-
public MetricFeedback createMetricFeedback(String metricId, MetricFeedback metricFeedback) {
640+
public MetricFeedback addFeedback(String metricId, MetricFeedback metricFeedback) {
641641
return createMetricFeedbackWithResponse(metricId, metricFeedback, Context.NONE).getValue();
642642
}
643643

644644
/**
645645
* Create a new metric feedback.
646646
*
647647
* <p><strong>Code sample</strong></p>
648-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.createMetricFeedbackWithResponse#String-MetricFeedback-Context}
648+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeedbackWithResponse#String-MetricFeedback-Context}
649649
*
650650
* @param metricId the unique id for which the feedback needs to be submitted.
651651
* @param metricFeedback the actual metric feedback.
@@ -657,14 +657,14 @@ public MetricFeedback createMetricFeedback(String metricId, MetricFeedback metri
657657
@ServiceMethod(returns = ReturnType.SINGLE)
658658
public Response<MetricFeedback> createMetricFeedbackWithResponse(String metricId, MetricFeedback metricFeedback,
659659
Context context) {
660-
return client.createMetricFeedbackWithResponse(metricId, metricFeedback, context).block();
660+
return client.addFeedbackWithResponse(metricId, metricFeedback, context).block();
661661
}
662662

663663
/**
664664
* Get a metric feedback by its id.
665665
*
666666
* <p><strong>Code sample</strong></p>
667-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.getMetricFeedback#String}
667+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.getFeedback#String}
668668
*
669669
* @param feedbackId The metric feedback unique id.
670670
*
@@ -673,15 +673,15 @@ public Response<MetricFeedback> createMetricFeedbackWithResponse(String metricId
673673
* @throws NullPointerException thrown if the {@code feedbackId} is null.
674674
*/
675675
@ServiceMethod(returns = ReturnType.SINGLE)
676-
public MetricFeedback getMetricFeedback(String feedbackId) {
677-
return getMetricFeedbackWithResponse(feedbackId, Context.NONE).getValue();
676+
public MetricFeedback getFeedback(String feedbackId) {
677+
return getFeedbackWithResponse(feedbackId, Context.NONE).getValue();
678678
}
679679

680680
/**
681681
* Get a metric feedback by its id.
682682
*
683683
* <p><strong>Code sample</strong></p>
684-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.getMetricFeedbackWithResponse#String-Context}
684+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.getFeedbackWithResponse#String-Context}
685685
*
686686
* @param feedbackId The metric feedback unique id.
687687
* @param context Additional context that is passed through the HTTP pipeline during the service call.
@@ -691,15 +691,15 @@ public MetricFeedback getMetricFeedback(String feedbackId) {
691691
* @throws NullPointerException thrown if the {@code feedbackId} is null.
692692
*/
693693
@ServiceMethod(returns = ReturnType.SINGLE)
694-
public Response<MetricFeedback> getMetricFeedbackWithResponse(String feedbackId, Context context) {
695-
return client.getMetricFeedbackWithResponse(feedbackId, context).block();
694+
public Response<MetricFeedback> getFeedbackWithResponse(String feedbackId, Context context) {
695+
return client.getFeedbackWithResponse(feedbackId, context).block();
696696
}
697697

698698
/**
699699
* List information of all metric feedbacks on the metrics advisor account.
700700
*
701701
* <p><strong>Code sample</strong></p>
702-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricFeedbacks#String}
702+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listFeedback#String}
703703
*
704704
* @param metricId the unique metric Id.
705705
*
@@ -710,16 +710,16 @@ public Response<MetricFeedback> getMetricFeedbackWithResponse(String feedbackId,
710710
* @throws NullPointerException thrown if the {@code metricId} is null.
711711
*/
712712
@ServiceMethod(returns = ReturnType.COLLECTION)
713-
public PagedIterable<MetricFeedback> listMetricFeedbacks(
713+
public PagedIterable<MetricFeedback> listFeedback(
714714
String metricId) {
715-
return listMetricFeedbacks(metricId, null, Context.NONE);
715+
return listFeedback(metricId, null, Context.NONE);
716716
}
717717

718718
/**
719719
* List information of all metric feedbacks on the metrics advisor account.
720720
*
721721
* <p><strong>Code sample</strong></p>
722-
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricFeedbacks#String-ListMetricFeedbackOptions-Context}
722+
* {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listFeedback#String-ListMetricFeedbackOptions-Context}
723723
*
724724
* @param metricId the unique metric Id.
725725
* @param options The configurable {@link ListMetricFeedbackOptions options} to pass for filtering the output
@@ -733,10 +733,10 @@ public PagedIterable<MetricFeedback> listMetricFeedbacks(
733733
* @throws NullPointerException thrown if the {@code metricId} is null.
734734
*/
735735
@ServiceMethod(returns = ReturnType.COLLECTION)
736-
public PagedIterable<MetricFeedback> listMetricFeedbacks(
736+
public PagedIterable<MetricFeedback> listFeedback(
737737
String metricId,
738738
ListMetricFeedbackOptions options, Context context) {
739-
return new PagedIterable<>(client.listMetricFeedbacks(metricId, options,
739+
return new PagedIterable<>(client.listFeedback(metricId, options,
740740
context == null ? Context.NONE : context));
741741
}
742742

sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/CreateMetricFeedbackResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import com.azure.core.http.HttpRequest;
99
import com.azure.core.http.rest.ResponseBase;
1010

11-
/** Contains all response data for the createMetricFeedback operation. */
11+
/** Contains all response data for the addFeeddback operation. */
1212
public final class CreateMetricFeedbackResponse extends ResponseBase<CreateMetricFeedbackHeaders, Void> {
1313
/**
1414
* Creates an instance of CreateMetricFeedbackResponse.

sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularityType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ public final class DataFeedGranularityType extends ExpandableStringEnum<DataFeed
3939
/**
4040
* Static value Minutely for DataFeedGranularityType.
4141
*/
42-
public static final DataFeedGranularityType MINUTELY = fromString("Minutely");
42+
public static final DataFeedGranularityType PER_MINUTE = fromString("Minutely");
4343

4444
/**
4545
* Static value Secondly for DataFeedGranularityType.
4646
*/
47-
public static final DataFeedGranularityType SECONDLY = fromString("Secondly");
47+
public static final DataFeedGranularityType PER_SECOND = fromString("Secondly");
4848

4949
/**
5050
* Static value Custom for DataFeedGranularityType.

sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricFeedback.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public FeedbackType getFeedbackType() {
9393
}
9494

9595
/**
96-
* Get the dimensionFilter.
96+
* Get the series keys value for the feedback.
9797
*
9898
* @return the dimensionFilter value.
9999
*/
@@ -104,7 +104,7 @@ public DimensionKey getDimensionFilter() {
104104
/**
105105
* Set the series keys value for the feedback.
106106
*
107-
* @param dimensionFilter the dimensionFilter value.
107+
* @param dimensionFilter the dimensionFilter value to set.
108108
*
109109
* @return the MetricFeedback object itself.
110110
*/

sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricFeedbackAsyncSample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static void main(String[] args) {
3939

4040
System.out.printf("Creating Metric Feedback%n");
4141
final Mono<MetricFeedback> createdFeedbackMono
42-
= advisorAsyncClient.createMetricFeedback(metricId, metricChangePointFeedback);
42+
= advisorAsyncClient.addFeeddback(metricId, metricChangePointFeedback);
4343

4444
createdFeedbackMono
4545
.doOnSubscribe(__ ->
@@ -50,7 +50,7 @@ public static void main(String[] args) {
5050
// Retrieve the metric feedback that just created.
5151
Mono<MetricFeedback> fetchFeedbackMono =
5252
createdFeedbackMono.flatMap(createdFeedback -> {
53-
return advisorAsyncClient.getMetricFeedback(createdFeedback.getId())
53+
return advisorAsyncClient.getFeedback(createdFeedback.getId())
5454
.doOnSubscribe(__ ->
5555
System.out.printf("Fetching Metric Feedback: %s%n", createdFeedback.getId()))
5656
.doOnSuccess(config ->
@@ -85,7 +85,7 @@ public static void main(String[] args) {
8585

8686
// List metric feedbacks.
8787
System.out.printf("Listing metric feedbacks%n");
88-
advisorAsyncClient.listMetricFeedbacks(metricId)
88+
advisorAsyncClient.listFeedback(metricId)
8989
.doOnNext(feedbackItem -> {
9090
System.out.printf("Metric Feedback Id : %s%n", feedbackItem.getId());
9191
System.out.printf("Metric Feedback created time : %s%n", feedbackItem.getCreatedTime());

0 commit comments

Comments
 (0)