public abstract class QueryServiceClient
QueryService client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Monitoring.V3Assembly
Google.Cloud.Monitoring.V3.dll
Remarks
The QueryService API is used to manage time series data in Stackdriver Monitoring. Time series data is a collection of data points that describes the time-varying values of a metric.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the QueryService service, which is a host of "monitoring.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default QueryService scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyList<String> |
The default QueryService scopes are:
GrpcClient
public virtual QueryService.QueryServiceClient GrpcClient { get; }
The underlying gRPC QueryService client
Property Value | |
---|---|
Type | Description |
QueryService.QueryServiceClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Create()
public static QueryServiceClient Create()
Synchronously creates a QueryServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use QueryServiceClientBuilder.
Returns | |
---|---|
Type | Description |
QueryServiceClient | The created QueryServiceClient. |
CreateAsync(CancellationToken)
public static Task<QueryServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a QueryServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use QueryServiceClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
Task<QueryServiceClient> | The task representing the created QueryServiceClient. |
QueryTimeSeries(QueryTimeSeriesRequest, CallSettings)
public virtual PagedEnumerable<QueryTimeSeriesResponse, TimeSeriesData> QueryTimeSeries(QueryTimeSeriesRequest request, CallSettings callSettings = null)
Queries time series using Monitoring Query Language. This method does not require a Workspace.
Parameters | |
---|---|
Name | Description |
request | QueryTimeSeriesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<QueryTimeSeriesResponse, TimeSeriesData> | A pageable sequence of TimeSeriesData resources. |
// Create client
QueryServiceClient queryServiceClient = QueryServiceClient.Create();
// Initialize request argument(s)
QueryTimeSeriesRequest request = new QueryTimeSeriesRequest { Name = "", Query = "", };
// Make the request
PagedEnumerable<QueryTimeSeriesResponse, TimeSeriesData> response = queryServiceClient.QueryTimeSeries(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (TimeSeriesData item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (QueryTimeSeriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (TimeSeriesData item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<TimeSeriesData> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (TimeSeriesData item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
QueryTimeSeriesAsync(QueryTimeSeriesRequest, CallSettings)
public virtual PagedAsyncEnumerable<QueryTimeSeriesResponse, TimeSeriesData> QueryTimeSeriesAsync(QueryTimeSeriesRequest request, CallSettings callSettings = null)
Queries time series using Monitoring Query Language. This method does not require a Workspace.
Parameters | |
---|---|
Name | Description |
request | QueryTimeSeriesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<QueryTimeSeriesResponse, TimeSeriesData> | A pageable asynchronous sequence of TimeSeriesData resources. |
// Create client
QueryServiceClient queryServiceClient = await QueryServiceClient.CreateAsync();
// Initialize request argument(s)
QueryTimeSeriesRequest request = new QueryTimeSeriesRequest { Name = "", Query = "", };
// Make the request
PagedAsyncEnumerable<QueryTimeSeriesResponse, TimeSeriesData> response = queryServiceClient.QueryTimeSeriesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((TimeSeriesData item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((QueryTimeSeriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (TimeSeriesData item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<TimeSeriesData> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (TimeSeriesData item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task | A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.