public abstract class MetricsServiceV2Client
Reference documentation and code samples for the Google Cloud Logging v2 API class MetricsServiceV2Client.
MetricsServiceV2 client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Logging.V2Assembly
Google.Cloud.Logging.V2.dll
Remarks
Service for configuring logs-based metrics.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the MetricsServiceV2 service, which is a host of "logging.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
string |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default MetricsServiceV2 scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyListstring |
The default MetricsServiceV2 scopes are:
GrpcClient
public virtual MetricsServiceV2.MetricsServiceV2Client GrpcClient { get; }
The underlying gRPC MetricsServiceV2 client
Property Value | |
---|---|
Type | Description |
MetricsServiceV2MetricsServiceV2Client |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Create()
public static MetricsServiceV2Client Create()
Synchronously creates a MetricsServiceV2Client using the default credentials, endpoint and settings. To specify custom credentials or other settings, use MetricsServiceV2ClientBuilder.
Returns | |
---|---|
Type | Description |
MetricsServiceV2Client |
The created MetricsServiceV2Client. |
CreateAsync(CancellationToken)
public static Task<MetricsServiceV2Client> CreateAsync(CancellationToken cancellationToken = default)
Asynchronously creates a MetricsServiceV2Client using the default credentials, endpoint and settings. To specify custom credentials or other settings, use MetricsServiceV2ClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken |
CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
TaskMetricsServiceV2Client |
The task representing the created MetricsServiceV2Client. |
CreateLogMetric(ProjectName, LogMetric, CallSettings)
public virtual LogMetric CreateLogMetric(ProjectName parent, LogMetric metric, CallSettings callSettings = null)
Creates a logs-based metric.
Parameters | |
---|---|
Name | Description |
parent |
ProjectName Required. The resource name of the project in which to create the metric: "projects/[PROJECT_ID]" The new metric must be provided in the request. |
metric |
LogMetric Required. The new logs-based metric, which must not have an identifier that already exists. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
LogMetric |
The RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = metricsServiceV2Client.CreateLogMetric(parent, metric);
CreateLogMetric(CreateLogMetricRequest, CallSettings)
public virtual LogMetric CreateLogMetric(CreateLogMetricRequest request, CallSettings callSettings = null)
Creates a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
CreateLogMetricRequest 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 |
LogMetric |
The RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
CreateLogMetricRequest request = new CreateLogMetricRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
Metric = new LogMetric(),
};
// Make the request
LogMetric response = metricsServiceV2Client.CreateLogMetric(request);
CreateLogMetric(string, LogMetric, CallSettings)
public virtual LogMetric CreateLogMetric(string parent, LogMetric metric, CallSettings callSettings = null)
Creates a logs-based metric.
Parameters | |
---|---|
Name | Description |
parent |
string Required. The resource name of the project in which to create the metric: "projects/[PROJECT_ID]" The new metric must be provided in the request. |
metric |
LogMetric Required. The new logs-based metric, which must not have an identifier that already exists. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
LogMetric |
The RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = metricsServiceV2Client.CreateLogMetric(parent, metric);
CreateLogMetricAsync(ProjectName, LogMetric, CallSettings)
public virtual Task<LogMetric> CreateLogMetricAsync(ProjectName parent, LogMetric metric, CallSettings callSettings = null)
Creates a logs-based metric.
Parameters | |
---|---|
Name | Description |
parent |
ProjectName Required. The resource name of the project in which to create the metric: "projects/[PROJECT_ID]" The new metric must be provided in the request. |
metric |
LogMetric Required. The new logs-based metric, which must not have an identifier that already exists. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric);
CreateLogMetricAsync(ProjectName, LogMetric, CancellationToken)
public virtual Task<LogMetric> CreateLogMetricAsync(ProjectName parent, LogMetric metric, CancellationToken cancellationToken)
Creates a logs-based metric.
Parameters | |
---|---|
Name | Description |
parent |
ProjectName Required. The resource name of the project in which to create the metric: "projects/[PROJECT_ID]" The new metric must be provided in the request. |
metric |
LogMetric Required. The new logs-based metric, which must not have an identifier that already exists. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric);
CreateLogMetricAsync(CreateLogMetricRequest, CallSettings)
public virtual Task<LogMetric> CreateLogMetricAsync(CreateLogMetricRequest request, CallSettings callSettings = null)
Creates a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
CreateLogMetricRequest 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 |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
CreateLogMetricRequest request = new CreateLogMetricRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
Metric = new LogMetric(),
};
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(request);
CreateLogMetricAsync(CreateLogMetricRequest, CancellationToken)
public virtual Task<LogMetric> CreateLogMetricAsync(CreateLogMetricRequest request, CancellationToken cancellationToken)
Creates a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
CreateLogMetricRequest The request object containing all of the parameters for the API call. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
CreateLogMetricRequest request = new CreateLogMetricRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
Metric = new LogMetric(),
};
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(request);
CreateLogMetricAsync(string, LogMetric, CallSettings)
public virtual Task<LogMetric> CreateLogMetricAsync(string parent, LogMetric metric, CallSettings callSettings = null)
Creates a logs-based metric.
Parameters | |
---|---|
Name | Description |
parent |
string Required. The resource name of the project in which to create the metric: "projects/[PROJECT_ID]" The new metric must be provided in the request. |
metric |
LogMetric Required. The new logs-based metric, which must not have an identifier that already exists. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric);
CreateLogMetricAsync(string, LogMetric, CancellationToken)
public virtual Task<LogMetric> CreateLogMetricAsync(string parent, LogMetric metric, CancellationToken cancellationToken)
Creates a logs-based metric.
Parameters | |
---|---|
Name | Description |
parent |
string Required. The resource name of the project in which to create the metric: "projects/[PROJECT_ID]" The new metric must be provided in the request. |
metric |
LogMetric Required. The new logs-based metric, which must not have an identifier that already exists. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric);
DeleteLogMetric(DeleteLogMetricRequest, CallSettings)
public virtual void DeleteLogMetric(DeleteLogMetricRequest request, CallSettings callSettings = null)
Deletes a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
DeleteLogMetricRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
DeleteLogMetricRequest request = new DeleteLogMetricRequest
{
MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
metricsServiceV2Client.DeleteLogMetric(request);
DeleteLogMetric(LogMetricName, CallSettings)
public virtual void DeleteLogMetric(LogMetricName metricName, CallSettings callSettings = null)
Deletes a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
LogMetricName Required. The resource name of the metric to delete: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
metricsServiceV2Client.DeleteLogMetric(metricName);
DeleteLogMetric(string, CallSettings)
public virtual void DeleteLogMetric(string metricName, CallSettings callSettings = null)
Deletes a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
string Required. The resource name of the metric to delete: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
metricsServiceV2Client.DeleteLogMetric(metricName);
DeleteLogMetricAsync(DeleteLogMetricRequest, CallSettings)
public virtual Task DeleteLogMetricAsync(DeleteLogMetricRequest request, CallSettings callSettings = null)
Deletes a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
DeleteLogMetricRequest 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 |
Task |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
DeleteLogMetricRequest request = new DeleteLogMetricRequest
{
MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(request);
DeleteLogMetricAsync(DeleteLogMetricRequest, CancellationToken)
public virtual Task DeleteLogMetricAsync(DeleteLogMetricRequest request, CancellationToken cancellationToken)
Deletes a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
DeleteLogMetricRequest The request object containing all of the parameters for the API call. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
DeleteLogMetricRequest request = new DeleteLogMetricRequest
{
MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(request);
DeleteLogMetricAsync(LogMetricName, CallSettings)
public virtual Task DeleteLogMetricAsync(LogMetricName metricName, CallSettings callSettings = null)
Deletes a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
LogMetricName Required. The resource name of the metric to delete: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(metricName);
DeleteLogMetricAsync(LogMetricName, CancellationToken)
public virtual Task DeleteLogMetricAsync(LogMetricName metricName, CancellationToken cancellationToken)
Deletes a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
LogMetricName Required. The resource name of the metric to delete: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(metricName);
DeleteLogMetricAsync(string, CallSettings)
public virtual Task DeleteLogMetricAsync(string metricName, CallSettings callSettings = null)
Deletes a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
string Required. The resource name of the metric to delete: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(metricName);
DeleteLogMetricAsync(string, CancellationToken)
public virtual Task DeleteLogMetricAsync(string metricName, CancellationToken cancellationToken)
Deletes a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
string Required. The resource name of the metric to delete: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(metricName);
GetLogMetric(GetLogMetricRequest, CallSettings)
public virtual LogMetric GetLogMetric(GetLogMetricRequest request, CallSettings callSettings = null)
Gets a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
GetLogMetricRequest 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 |
LogMetric |
The RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
GetLogMetricRequest request = new GetLogMetricRequest
{
MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
LogMetric response = metricsServiceV2Client.GetLogMetric(request);
GetLogMetric(LogMetricName, CallSettings)
public virtual LogMetric GetLogMetric(LogMetricName metricName, CallSettings callSettings = null)
Gets a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
LogMetricName Required. The resource name of the desired metric: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
LogMetric |
The RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
LogMetric response = metricsServiceV2Client.GetLogMetric(metricName);
GetLogMetric(string, CallSettings)
public virtual LogMetric GetLogMetric(string metricName, CallSettings callSettings = null)
Gets a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
string Required. The resource name of the desired metric: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
LogMetric |
The RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
LogMetric response = metricsServiceV2Client.GetLogMetric(metricName);
GetLogMetricAsync(GetLogMetricRequest, CallSettings)
public virtual Task<LogMetric> GetLogMetricAsync(GetLogMetricRequest request, CallSettings callSettings = null)
Gets a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
GetLogMetricRequest 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 |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
GetLogMetricRequest request = new GetLogMetricRequest
{
MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(request);
GetLogMetricAsync(GetLogMetricRequest, CancellationToken)
public virtual Task<LogMetric> GetLogMetricAsync(GetLogMetricRequest request, CancellationToken cancellationToken)
Gets a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
GetLogMetricRequest The request object containing all of the parameters for the API call. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
GetLogMetricRequest request = new GetLogMetricRequest
{
MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(request);
GetLogMetricAsync(LogMetricName, CallSettings)
public virtual Task<LogMetric> GetLogMetricAsync(LogMetricName metricName, CallSettings callSettings = null)
Gets a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
LogMetricName Required. The resource name of the desired metric: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(metricName);
GetLogMetricAsync(LogMetricName, CancellationToken)
public virtual Task<LogMetric> GetLogMetricAsync(LogMetricName metricName, CancellationToken cancellationToken)
Gets a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
LogMetricName Required. The resource name of the desired metric: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(metricName);
GetLogMetricAsync(string, CallSettings)
public virtual Task<LogMetric> GetLogMetricAsync(string metricName, CallSettings callSettings = null)
Gets a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
string Required. The resource name of the desired metric: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(metricName);
GetLogMetricAsync(string, CancellationToken)
public virtual Task<LogMetric> GetLogMetricAsync(string metricName, CancellationToken cancellationToken)
Gets a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
string Required. The resource name of the desired metric: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(metricName);
ListLogMetrics(ProjectName, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetrics(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists logs-based metrics.
Parameters | |
---|---|
Name | Description |
parent |
ProjectName Required. The name of the project containing the metrics: "projects/[PROJECT_ID]" |
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogMetricsResponseLogMetric |
A pageable sequence of LogMetric resources. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetrics(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (LogMetric 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 (ListLogMetricsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogMetric 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<LogMetric> 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 (LogMetric 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;
ListLogMetrics(ListLogMetricsRequest, CallSettings)
public virtual PagedEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetrics(ListLogMetricsRequest request, CallSettings callSettings = null)
Lists logs-based metrics.
Parameters | |
---|---|
Name | Description |
request |
ListLogMetricsRequest 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 |
PagedEnumerableListLogMetricsResponseLogMetric |
A pageable sequence of LogMetric resources. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
ListLogMetricsRequest request = new ListLogMetricsRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetrics(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (LogMetric 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 (ListLogMetricsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogMetric 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<LogMetric> 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 (LogMetric 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;
ListLogMetrics(string, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetrics(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists logs-based metrics.
Parameters | |
---|---|
Name | Description |
parent |
string Required. The name of the project containing the metrics: "projects/[PROJECT_ID]" |
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogMetricsResponseLogMetric |
A pageable sequence of LogMetric resources. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetrics(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (LogMetric 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 (ListLogMetricsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogMetric 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<LogMetric> 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 (LogMetric 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;
ListLogMetricsAsync(ProjectName, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetricsAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists logs-based metrics.
Parameters | |
---|---|
Name | Description |
parent |
ProjectName Required. The name of the project containing the metrics: "projects/[PROJECT_ID]" |
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogMetricsResponseLogMetric |
A pageable asynchronous sequence of LogMetric resources. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetricsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogMetric 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((ListLogMetricsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogMetric 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<LogMetric> 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 (LogMetric 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;
ListLogMetricsAsync(ListLogMetricsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetricsAsync(ListLogMetricsRequest request, CallSettings callSettings = null)
Lists logs-based metrics.
Parameters | |
---|---|
Name | Description |
request |
ListLogMetricsRequest 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 |
PagedAsyncEnumerableListLogMetricsResponseLogMetric |
A pageable asynchronous sequence of LogMetric resources. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
ListLogMetricsRequest request = new ListLogMetricsRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetricsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogMetric 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((ListLogMetricsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogMetric 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<LogMetric> 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 (LogMetric 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;
ListLogMetricsAsync(string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetricsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists logs-based metrics.
Parameters | |
---|---|
Name | Description |
parent |
string Required. The name of the project containing the metrics: "projects/[PROJECT_ID]" |
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogMetricsResponseLogMetric |
A pageable asynchronous sequence of LogMetric resources. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetricsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogMetric 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((ListLogMetricsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogMetric 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<LogMetric> 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 (LogMetric 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.
UpdateLogMetric(LogMetricName, LogMetric, CallSettings)
public virtual LogMetric UpdateLogMetric(LogMetricName metricName, LogMetric metric, CallSettings callSettings = null)
Creates or updates a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
LogMetricName Required. The resource name of the metric to update: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" The updated metric must be provided in the request and it's
|
metric |
LogMetric Required. The updated metric. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
LogMetric |
The RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = metricsServiceV2Client.UpdateLogMetric(metricName, metric);
UpdateLogMetric(UpdateLogMetricRequest, CallSettings)
public virtual LogMetric UpdateLogMetric(UpdateLogMetricRequest request, CallSettings callSettings = null)
Creates or updates a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
UpdateLogMetricRequest 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 |
LogMetric |
The RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
UpdateLogMetricRequest request = new UpdateLogMetricRequest
{
MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
Metric = new LogMetric(),
};
// Make the request
LogMetric response = metricsServiceV2Client.UpdateLogMetric(request);
UpdateLogMetric(string, LogMetric, CallSettings)
public virtual LogMetric UpdateLogMetric(string metricName, LogMetric metric, CallSettings callSettings = null)
Creates or updates a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
string Required. The resource name of the metric to update: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" The updated metric must be provided in the request and it's
|
metric |
LogMetric Required. The updated metric. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
LogMetric |
The RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = metricsServiceV2Client.UpdateLogMetric(metricName, metric);
UpdateLogMetricAsync(LogMetricName, LogMetric, CallSettings)
public virtual Task<LogMetric> UpdateLogMetricAsync(LogMetricName metricName, LogMetric metric, CallSettings callSettings = null)
Creates or updates a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
LogMetricName Required. The resource name of the metric to update: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" The updated metric must be provided in the request and it's
|
metric |
LogMetric Required. The updated metric. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric);
UpdateLogMetricAsync(LogMetricName, LogMetric, CancellationToken)
public virtual Task<LogMetric> UpdateLogMetricAsync(LogMetricName metricName, LogMetric metric, CancellationToken cancellationToken)
Creates or updates a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
LogMetricName Required. The resource name of the metric to update: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" The updated metric must be provided in the request and it's
|
metric |
LogMetric Required. The updated metric. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric);
UpdateLogMetricAsync(UpdateLogMetricRequest, CallSettings)
public virtual Task<LogMetric> UpdateLogMetricAsync(UpdateLogMetricRequest request, CallSettings callSettings = null)
Creates or updates a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
UpdateLogMetricRequest 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 |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
UpdateLogMetricRequest request = new UpdateLogMetricRequest
{
MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
Metric = new LogMetric(),
};
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(request);
UpdateLogMetricAsync(UpdateLogMetricRequest, CancellationToken)
public virtual Task<LogMetric> UpdateLogMetricAsync(UpdateLogMetricRequest request, CancellationToken cancellationToken)
Creates or updates a logs-based metric.
Parameters | |
---|---|
Name | Description |
request |
UpdateLogMetricRequest The request object containing all of the parameters for the API call. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
UpdateLogMetricRequest request = new UpdateLogMetricRequest
{
MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
Metric = new LogMetric(),
};
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(request);
UpdateLogMetricAsync(string, LogMetric, CallSettings)
public virtual Task<LogMetric> UpdateLogMetricAsync(string metricName, LogMetric metric, CallSettings callSettings = null)
Creates or updates a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
string Required. The resource name of the metric to update: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" The updated metric must be provided in the request and it's
|
metric |
LogMetric Required. The updated metric. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric);
UpdateLogMetricAsync(string, LogMetric, CancellationToken)
public virtual Task<LogMetric> UpdateLogMetricAsync(string metricName, LogMetric metric, CancellationToken cancellationToken)
Creates or updates a logs-based metric.
Parameters | |
---|---|
Name | Description |
metricName |
string Required. The resource name of the metric to update: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" The updated metric must be provided in the request and it's
|
metric |
LogMetric Required. The updated metric. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLogMetric |
A Task containing the RPC response. |
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric);