Skip to content

Commit

Permalink
[monitor-query] Regenerate client with stable swaggers and add in inc…
Browse files Browse the repository at this point in the history
…ludeVisualization option. (#16058)

* Big update to use the latest stable swagger files for all of the Log Analytics services. Each reference is by git commit ID this time to prevent any accidental drift.

Also, added in the includeRender header (via the `includeVisualization` option).

Fixes #15771

* Fixing codeowners to reflect the proper owners for the package:
@KarishmaGhiya - main owner
@maorleger - backup owner

* Formatting!
  • Loading branch information
richardpark-msft authored Jun 29, 2021
1 parent 36b468c commit d4d5002
Show file tree
Hide file tree
Showing 34 changed files with 424 additions and 244 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

# PRLabel: %Monitor
/sdk/monitor/ @hectorhdzg @applicationinsights-js-owners @richardpark-msft
/sdk/monitor/monitor-query @richardpark-msft @maorleger
/sdk/monitor/monitor-query @KarishmaGhiya @maorleger @richardpark-msft

###########
# Tools
Expand Down
38 changes: 30 additions & 8 deletions sdk/monitor/monitor-query/review/monitor-query.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ export interface GetMetricNamespacesResult {
namespaces: MetricNamespace[];
}

// @public
export interface LogsColumn {
name?: string;
type?: ColumnDataType;
}

// @public
export class LogsQueryClient {
constructor(tokenCredential: TokenCredential, options?: LogsQueryClientOptions);
Expand All @@ -101,7 +95,7 @@ export interface LogsQueryClientOptions extends PipelineOptions {

// @public
export interface LogsTable {
columns: LogsColumn[];
columns: MetricColumn[];
name: string;
rows: (Date | string | number | Record<string, unknown> | boolean)[][];
}
Expand All @@ -114,7 +108,7 @@ export interface MetadataValue {

// @public
export interface Metric {
displayDescription: string;
displayDescription?: string;
errorCode?: string;
id: string;
name: string;
Expand All @@ -129,6 +123,29 @@ export interface MetricAvailability {
timeGrain?: string;
}

// @public
export type MetricClass = string;

// @public
export interface MetricColumn {
name?: string;
type?: ColumnDataType;
}

// @public
export interface MetricDefinition {
category?: string;
dimensions?: string[];
displayDescription?: string;
id?: string;
isDimensionRequired?: boolean;
metricAvailabilities?: MetricAvailability[];
name?: string;
primaryAggregationType?: AggregationType;
resourceId?: string;
unit?: MetricUnit;
}

// @public
export interface MetricDefinition {
category?: string;
Expand All @@ -137,9 +154,12 @@ export interface MetricDefinition {
id?: string;
isDimensionRequired?: boolean;
metricAvailabilities?: MetricAvailability[];
metricClass?: MetricClass;
name?: string;
namespace?: string;
primaryAggregationType?: AggregationType;
resourceId?: string;
supportedAggregationTypes?: AggregationType[];
unit?: MetricUnit;
}

Expand Down Expand Up @@ -207,13 +227,15 @@ export interface QueryLogsBatchResult {
// @public
export interface QueryLogsOptions extends OperationOptions {
includeQueryStatistics?: boolean;
includeVisualization?: boolean;
serverTimeoutInSeconds?: number;
}

// @public
export interface QueryLogsResult {
statistics?: any;
tables: LogsTable[];
visualization?: any;
}

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as coreHttp from "@azure/core-http";
import { AzureLogAnalyticsOptionalParams } from "./models";

const packageName = "monitor-log-query";
const packageVersion = "1.0.0-beta.3";
const packageVersion = "1.0.0";

/** @hidden */
export class AzureLogAnalyticsContext extends coreHttp.ServiceClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export interface QueryResults {
tables: Table[];
/** Statistics represented in JSON format. */
statistics?: any;
/** Visualization data in JSON format. */
render?: any;
/** The code and message for an error. */
error?: ErrorInfo;
}

/** Contains the columns and rows for one table in a query response. */
Expand All @@ -23,21 +27,15 @@ export interface Table {
/** The list of columns in this table. */
columns: Column[];
/** The resulting rows from this query. */
rows: string[][];
rows: any[][];
}

/** A column in a table. */
export interface Column {
/** The name of this column. */
name?: string;
/** The data type of this column. */
type?: ColumnDataType;
}

/** Contains details when the response code indicates an error. */
export interface ErrorResponse {
/** The error details. */
error: ErrorInfo;
type?: LogsColumnType;
}

/** The code and message for an error. */
Expand Down Expand Up @@ -70,6 +68,12 @@ export interface ErrorDetail {
additionalProperties?: any;
}

/** Contains details when the response code indicates an error. */
export interface ErrorResponse {
/** The error details. */
error: ErrorInfo;
}

/** The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) */
export interface QueryBody {
/** The query to execute. */
Expand All @@ -78,12 +82,6 @@ export interface QueryBody {
timespan?: string;
/** A list of workspaces that are included in the query. */
workspaces?: string[];
/** A list of qualified workspace names that are included in the query. */
qualifiedNames?: string[];
/** A list of workspace IDs that are included in the query. */
workspaceIds?: string[];
/** A list of Azure resource IDs that are included in the query. */
azureResourceIds?: string[];
}

/** The metadata response for the app, including available tables, etc. */
Expand Down Expand Up @@ -405,60 +403,67 @@ export interface MetadataPermissionsApplicationsItem {
/** An array of requests. */
export interface BatchRequest {
/** An single request in a batch. */
requests?: LogQueryRequest[];
requests: BatchQueryRequest[];
}

/** An single request in a batch. */
export interface LogQueryRequest {
export interface BatchQueryRequest {
/** The error details. */
id?: string;
id: string;
/** Dictionary of <string> */
headers?: { [propertyName: string]: string };
/** The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) */
body?: QueryBody;
body: QueryBody;
path?: "/query";
method?: "POST";
/** Workspace Id to be included in the query */
workspace?: string;
workspace: string;
}

/** Response to a batch. */
/** Response to a batch query. */
export interface BatchResponse {
/** An array of responses corresponding to each individual request in a batch. */
responses?: LogQueryResponse[];
responses?: BatchQueryResponse[];
}

export interface LogQueryResponse {
export interface BatchQueryResponse {
id?: string;
status?: number;
/** Contains the tables, columns & rows resulting from the query or the error details if the query failed. */
body?: LogQueryResult;
/** Contains the tables, columns & rows resulting from a query. */
body?: BatchQueryResults;
/** Dictionary of <string> */
headers?: { [propertyName: string]: string };
}

/** Contains the tables, columns & rows resulting from the query or the error details if the query failed. */
export interface LogQueryResult {
/** Contains the tables, columns & rows resulting from a query. */
export interface BatchQueryResults {
/** The list of tables, columns and rows. */
tables?: Table[];
/** Statistics represented in JSON format. */
statistics?: any;
/** Visualization data in JSON format. */
render?: any;
/** The code and message for an error. */
error?: ErrorInfo;
}

/** Known values of {@link ColumnDataType} that the service accepts. */
export const enum KnownColumnDataType {
/** Known values of {@link LogsColumnType} that the service accepts. */
export const enum KnownLogsColumnType {
Bool = "bool",
Datetime = "datetime",
Dynamic = "dynamic",
Int = "int",
Long = "long",
Real = "real",
String = "string"
String = "string",
Guid = "guid",
Decimal = "decimal",
Timespan = "timespan"
}

/**
* Defines values for ColumnDataType. \
* {@link KnownColumnDataType} can be used interchangeably with ColumnDataType,
* Defines values for LogsColumnType. \
* {@link KnownLogsColumnType} can be used interchangeably with LogsColumnType,
* this enum contains the known values that the service supports.
* ### Know values supported by the service
* **bool** \
Expand All @@ -467,9 +472,12 @@ export const enum KnownColumnDataType {
* **int** \
* **long** \
* **real** \
* **string**
* **string** \
* **guid** \
* **decimal** \
* **timespan**
*/
export type ColumnDataType = string;
export type LogsColumnType = string;

/** Known values of {@link MetadataColumnDataType} that the service accepts. */
export const enum KnownMetadataColumnDataType {
Expand All @@ -479,7 +487,10 @@ export const enum KnownMetadataColumnDataType {
Int = "int",
Long = "long",
Real = "real",
String = "string"
String = "string",
Guid = "guid",
Decimal = "decimal",
Timespan = "timespan"
}

/**
Expand All @@ -493,7 +504,10 @@ export const enum KnownMetadataColumnDataType {
* **int** \
* **long** \
* **real** \
* **string**
* **string** \
* **guid** \
* **decimal** \
* **timespan**
*/
export type MetadataColumnDataType = string;

Expand All @@ -517,7 +531,7 @@ export type QueryGetResponse = QueryResults & {

/** Optional parameters. */
export interface QueryExecuteOptionalParams extends coreHttp.OperationOptions {
/** Optional. The prefer header to set server timeout, */
/** Optional. The prefer header to set server timeout, query statistics and visualization information. */
prefer?: string;
}

Expand Down
Loading

0 comments on commit d4d5002

Please sign in to comment.