# Google Cloud Logging v2 API - Class MetricsServiceV2Client (4.5.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [4.5.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client)
- [4.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/4.4.0/Google.Cloud.Logging.V2.MetricsServiceV2Client)
- [4.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/4.3.0/Google.Cloud.Logging.V2.MetricsServiceV2Client)
- [4.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/4.2.0/Google.Cloud.Logging.V2.MetricsServiceV2Client)
- [4.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/4.1.0/Google.Cloud.Logging.V2.MetricsServiceV2Client)
- [4.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/4.0.0/Google.Cloud.Logging.V2.MetricsServiceV2Client)
- [3.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/3.6.0/Google.Cloud.Logging.V2.MetricsServiceV2Client)
- [3.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/3.5.0/Google.Cloud.Logging.V2.MetricsServiceV2Client)
- [3.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/3.4.0/Google.Cloud.Logging.V2.MetricsServiceV2Client)
- [3.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/3.3.0/Google.Cloud.Logging.V2.MetricsServiceV2Client)

    public abstract class MetricsServiceV2Client

Reference documentation and code samples for the Google Cloud Logging v2 API class MetricsServiceV2Client.

MetricsServiceV2 client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> MetricsServiceV2Client

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[MetricsServiceV2ClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2ClientImpl)

## Namespace

[Google.Cloud.Logging.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2)

## Assembly

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** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default MetricsServiceV2 scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** The default MetricsServiceV2 scopes are:

- <https://www.googleapis.com/auth/cloud-platform>
- <https://www.googleapis.com/auth/cloud-platform.read-only>
- <https://www.googleapis.com/auth/logging.admin>
- <https://www.googleapis.com/auth/logging.read>
- <https://www.googleapis.com/auth/logging.write>

<br />

### GrpcClient

    public virtual MetricsServiceV2.MetricsServiceV2Client GrpcClient { get; }

The underlying gRPC MetricsServiceV2 client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2.MetricsServiceV2Client` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceMetadata.html` |   |

## Methods

### Create()

    public static MetricsServiceV2Client Create()

Synchronously creates a [MetricsServiceV2Client](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [MetricsServiceV2ClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2ClientBuilder).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client` | The created [MetricsServiceV2Client](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client). |

### CreateAsync(CancellationToken)

    public static Task<MetricsServiceV2Client> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a [MetricsServiceV2Client](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [MetricsServiceV2ClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2ClientBuilder).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client` | The task representing the created [MetricsServiceV2Client](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.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` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.ProjectName.html` 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The new logs-based metric, which must not have an identifier that already exists. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | The RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.CreateLogMetricRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | The RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The new logs-based metric, which must not have an identifier that already exists. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | The RPC response. |

**Example**

    // 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` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.ProjectName.html` 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The new logs-based metric, which must not have an identifier that already exists. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.ProjectName.html` 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The new logs-based metric, which must not have an identifier that already exists. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.CreateLogMetricRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.CreateLogMetricRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The new logs-based metric, which must not have an identifier that already exists. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The new logs-based metric, which must not have an identifier that already exists. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.DeleteLogMetricRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetricName` Required. The resource name of the metric to delete: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the metric to delete: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.DeleteLogMetricRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.DeleteLogMetricRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetricName` Required. The resource name of the metric to delete: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetricName` Required. The resource name of the metric to delete: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the metric to delete: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the metric to delete: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.GetLogMetricRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | The RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetricName` Required. The resource name of the desired metric: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | The RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the desired metric: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | The RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.GetLogMetricRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.GetLogMetricRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetricName` Required. The resource name of the desired metric: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetricName` Required. The resource name of the desired metric: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the desired metric: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the desired metric: "projects/\[PROJECT_ID\]/metrics/\[METRIC_ID\]" |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.ProjectName.html` Required. The name of the project containing the metrics: "projects/\[PROJECT_ID\]" |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.ListLogMetricsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A pageable sequence of [LogMetric](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric) resources. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.ListLogMetricsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.ListLogMetricsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A pageable sequence of [LogMetric](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric) resources. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the project containing the metrics: "projects/\[PROJECT_ID\]" |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.ListLogMetricsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A pageable sequence of [LogMetric](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric) resources. |

**Example**

    // 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` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.ProjectName.html` Required. The name of the project containing the metrics: "projects/\[PROJECT_ID\]" |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.ListLogMetricsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A pageable asynchronous sequence of [LogMetric](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric) resources. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.ListLogMetricsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.ListLogMetricsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A pageable asynchronous sequence of [LogMetric](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric) resources. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the project containing the metrics: "projects/\[PROJECT_ID\]" |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.ListLogMetricsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A pageable asynchronous sequence of [LogMetric](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric) resources. |

**Example**

    // 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()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client#Google_Cloud_Logging_V2_MetricsServiceV2Client_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client#Google_Cloud_Logging_V2_MetricsServiceV2Client_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not
affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client#Google_Cloud_Logging_V2_MetricsServiceV2Client_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client#Google_Cloud_Logging_V2_MetricsServiceV2Client_CreateAsync_System_Threading_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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.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 `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. |
| `metric` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The updated metric. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | The RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.UpdateLogMetricRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | The RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.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 `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. |
| `metric` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The updated metric. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | The RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.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 `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. |
| `metric` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The updated metric. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.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 `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. |
| `metric` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The updated metric. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.UpdateLogMetricRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.UpdateLogMetricRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.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 `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. |
| `metric` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The updated metric. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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` | `https://learn.microsoft.com/dotnet/api/system.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 `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. |
| `metric` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` Required. The updated metric. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LogMetric` | A Task containing the RPC response. |

**Example**

    // 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);