// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/logging/v2/logging_metrics.proto

package com.google.logging.v2;

/**
 * <pre>
 * Describes a logs-based metric. The value of the metric is the number of log
 * entries that match a logs filter in a given time interval.
 * Logs-based metrics can also be used to extract values from logs and create a
 * distribution of the values. The distribution records the statistics of the
 * extracted values along with an optional histogram of the values as specified
 * by the bucket options.
 * </pre>
 *
 * Protobuf type {@code google.logging.v2.LogMetric}
 */
public  final class LogMetric extends
    com.google.protobuf.GeneratedMessageLite<
        LogMetric, LogMetric.Builder> implements
    // @@protoc_insertion_point(message_implements:google.logging.v2.LogMetric)
    LogMetricOrBuilder {
  private LogMetric() {
    name_ = "";
    description_ = "";
    filter_ = "";
    valueExtractor_ = "";
  }
  /**
   * <pre>
   * Logging API version.
   * </pre>
   *
   * Protobuf enum {@code google.logging.v2.LogMetric.ApiVersion}
   */
  public enum ApiVersion
      implements com.google.protobuf.Internal.EnumLite {
    /**
     * <pre>
     * Logging API v2.
     * </pre>
     *
     * <code>V2 = 0;</code>
     */
    V2(0),
    /**
     * <pre>
     * Logging API v1.
     * </pre>
     *
     * <code>V1 = 1;</code>
     */
    V1(1),
    UNRECOGNIZED(-1),
    ;

    /**
     * <pre>
     * Logging API v2.
     * </pre>
     *
     * <code>V2 = 0;</code>
     */
    public static final int V2_VALUE = 0;
    /**
     * <pre>
     * Logging API v1.
     * </pre>
     *
     * <code>V1 = 1;</code>
     */
    public static final int V1_VALUE = 1;


    @java.lang.Override
    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @param value The number of the enum to look for.
     * @return The enum associated with the given number.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static ApiVersion valueOf(int value) {
      return forNumber(value);
    }

    public static ApiVersion forNumber(int value) {
      switch (value) {
        case 0: return V2;
        case 1: return V1;
        default: return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<ApiVersion>
        internalGetValueMap() {
      return internalValueMap;
    }
    private static final com.google.protobuf.Internal.EnumLiteMap<
        ApiVersion> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap<ApiVersion>() {
            @java.lang.Override
            public ApiVersion findValueByNumber(int number) {
              return ApiVersion.forNumber(number);
            }
          };

    public static com.google.protobuf.Internal.EnumVerifier 
        internalGetVerifier() {
      return ApiVersionVerifier.INSTANCE;
    }

    private static final class ApiVersionVerifier implements 
         com.google.protobuf.Internal.EnumVerifier { 
            static final com.google.protobuf.Internal.EnumVerifier           INSTANCE = new ApiVersionVerifier();
            @java.lang.Override
            public boolean isInRange(int number) {
              return ApiVersion.forNumber(number) != null;
            }
          };

    private final int value;

    private ApiVersion(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.logging.v2.LogMetric.ApiVersion)
  }

  public static final int NAME_FIELD_NUMBER = 1;
  private java.lang.String name_;
  /**
   * <pre>
   * Required. The client-assigned metric identifier.
   * Examples: `"error_count"`, `"nginx/requests"`.
   * Metric identifiers are limited to 100 characters and can include only the
   * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
   * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
   * name pieces, and it cannot be the first character of the name.
   * The metric identifier in this field must not be
   * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
   * However, when the metric identifier appears as the `[METRIC_ID]` part of a
   * `metric_name` API parameter, then the metric identifier must be
   * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
   * </pre>
   *
   * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
   * @return The name.
   */
  @java.lang.Override
  public java.lang.String getName() {
    return name_;
  }
  /**
   * <pre>
   * Required. The client-assigned metric identifier.
   * Examples: `"error_count"`, `"nginx/requests"`.
   * Metric identifiers are limited to 100 characters and can include only the
   * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
   * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
   * name pieces, and it cannot be the first character of the name.
   * The metric identifier in this field must not be
   * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
   * However, when the metric identifier appears as the `[METRIC_ID]` part of a
   * `metric_name` API parameter, then the metric identifier must be
   * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
   * </pre>
   *
   * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
   * @return The bytes for name.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getNameBytes() {
    return com.google.protobuf.ByteString.copyFromUtf8(name_);
  }
  /**
   * <pre>
   * Required. The client-assigned metric identifier.
   * Examples: `"error_count"`, `"nginx/requests"`.
   * Metric identifiers are limited to 100 characters and can include only the
   * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
   * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
   * name pieces, and it cannot be the first character of the name.
   * The metric identifier in this field must not be
   * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
   * However, when the metric identifier appears as the `[METRIC_ID]` part of a
   * `metric_name` API parameter, then the metric identifier must be
   * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
   * </pre>
   *
   * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
   * @param value The name to set.
   */
  private void setName(
      java.lang.String value) {
    value.getClass();
  
    name_ = value;
  }
  /**
   * <pre>
   * Required. The client-assigned metric identifier.
   * Examples: `"error_count"`, `"nginx/requests"`.
   * Metric identifiers are limited to 100 characters and can include only the
   * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
   * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
   * name pieces, and it cannot be the first character of the name.
   * The metric identifier in this field must not be
   * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
   * However, when the metric identifier appears as the `[METRIC_ID]` part of a
   * `metric_name` API parameter, then the metric identifier must be
   * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
   * </pre>
   *
   * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
   */
  private void clearName() {
    
    name_ = getDefaultInstance().getName();
  }
  /**
   * <pre>
   * Required. The client-assigned metric identifier.
   * Examples: `"error_count"`, `"nginx/requests"`.
   * Metric identifiers are limited to 100 characters and can include only the
   * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
   * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
   * name pieces, and it cannot be the first character of the name.
   * The metric identifier in this field must not be
   * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
   * However, when the metric identifier appears as the `[METRIC_ID]` part of a
   * `metric_name` API parameter, then the metric identifier must be
   * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
   * </pre>
   *
   * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
   * @param value The bytes for name to set.
   */
  private void setNameBytes(
      com.google.protobuf.ByteString value) {
    checkByteStringIsUtf8(value);
    name_ = value.toStringUtf8();
    
  }

  public static final int DESCRIPTION_FIELD_NUMBER = 2;
  private java.lang.String description_;
  /**
   * <pre>
   * Optional. A description of this metric, which is used in documentation.
   * The maximum length of the description is 8000 characters.
   * </pre>
   *
   * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
   * @return The description.
   */
  @java.lang.Override
  public java.lang.String getDescription() {
    return description_;
  }
  /**
   * <pre>
   * Optional. A description of this metric, which is used in documentation.
   * The maximum length of the description is 8000 characters.
   * </pre>
   *
   * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
   * @return The bytes for description.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getDescriptionBytes() {
    return com.google.protobuf.ByteString.copyFromUtf8(description_);
  }
  /**
   * <pre>
   * Optional. A description of this metric, which is used in documentation.
   * The maximum length of the description is 8000 characters.
   * </pre>
   *
   * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
   * @param value The description to set.
   */
  private void setDescription(
      java.lang.String value) {
    value.getClass();
  
    description_ = value;
  }
  /**
   * <pre>
   * Optional. A description of this metric, which is used in documentation.
   * The maximum length of the description is 8000 characters.
   * </pre>
   *
   * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  private void clearDescription() {
    
    description_ = getDefaultInstance().getDescription();
  }
  /**
   * <pre>
   * Optional. A description of this metric, which is used in documentation.
   * The maximum length of the description is 8000 characters.
   * </pre>
   *
   * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
   * @param value The bytes for description to set.
   */
  private void setDescriptionBytes(
      com.google.protobuf.ByteString value) {
    checkByteStringIsUtf8(value);
    description_ = value.toStringUtf8();
    
  }

  public static final int FILTER_FIELD_NUMBER = 3;
  private java.lang.String filter_;
  /**
   * <pre>
   * Required. An [advanced logs
   * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
   * is used to match log entries. Example:
   *     "resource.type=gae_app AND severity&gt;=ERROR"
   * The maximum length of the filter is 20000 characters.
   * </pre>
   *
   * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
   * @return The filter.
   */
  @java.lang.Override
  public java.lang.String getFilter() {
    return filter_;
  }
  /**
   * <pre>
   * Required. An [advanced logs
   * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
   * is used to match log entries. Example:
   *     "resource.type=gae_app AND severity&gt;=ERROR"
   * The maximum length of the filter is 20000 characters.
   * </pre>
   *
   * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
   * @return The bytes for filter.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getFilterBytes() {
    return com.google.protobuf.ByteString.copyFromUtf8(filter_);
  }
  /**
   * <pre>
   * Required. An [advanced logs
   * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
   * is used to match log entries. Example:
   *     "resource.type=gae_app AND severity&gt;=ERROR"
   * The maximum length of the filter is 20000 characters.
   * </pre>
   *
   * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
   * @param value The filter to set.
   */
  private void setFilter(
      java.lang.String value) {
    value.getClass();
  
    filter_ = value;
  }
  /**
   * <pre>
   * Required. An [advanced logs
   * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
   * is used to match log entries. Example:
   *     "resource.type=gae_app AND severity&gt;=ERROR"
   * The maximum length of the filter is 20000 characters.
   * </pre>
   *
   * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
   */
  private void clearFilter() {
    
    filter_ = getDefaultInstance().getFilter();
  }
  /**
   * <pre>
   * Required. An [advanced logs
   * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
   * is used to match log entries. Example:
   *     "resource.type=gae_app AND severity&gt;=ERROR"
   * The maximum length of the filter is 20000 characters.
   * </pre>
   *
   * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
   * @param value The bytes for filter to set.
   */
  private void setFilterBytes(
      com.google.protobuf.ByteString value) {
    checkByteStringIsUtf8(value);
    filter_ = value.toStringUtf8();
    
  }

  public static final int METRIC_DESCRIPTOR_FIELD_NUMBER = 5;
  private com.google.api.MetricDescriptor metricDescriptor_;
  /**
   * <pre>
   * Optional. The metric descriptor associated with the logs-based metric.
   * If unspecified, it uses a default metric descriptor with a DELTA metric
   * kind, INT64 value type, with no labels and a unit of "1". Such a metric
   * counts the number of log entries matching the `filter` expression.
   * The `name`, `type`, and `description` fields in the `metric_descriptor`
   * are output only, and is constructed using the `name` and `description`
   * field in the LogMetric.
   * To create a logs-based metric that records a distribution of log values, a
   * DELTA metric kind with a DISTRIBUTION value type must be used along with
   * a `value_extractor` expression in the LogMetric.
   * Each label in the metric descriptor must have a matching label
   * name as the key and an extractor expression as the value in the
   * `label_extractors` map.
   * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
   * be updated once initially configured. New labels can be added in the
   * `metric_descriptor`, but existing labels cannot be modified except for
   * their description.
   * </pre>
   *
   * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override
  public boolean hasMetricDescriptor() {
    return metricDescriptor_ != null;
  }
  /**
   * <pre>
   * Optional. The metric descriptor associated with the logs-based metric.
   * If unspecified, it uses a default metric descriptor with a DELTA metric
   * kind, INT64 value type, with no labels and a unit of "1". Such a metric
   * counts the number of log entries matching the `filter` expression.
   * The `name`, `type`, and `description` fields in the `metric_descriptor`
   * are output only, and is constructed using the `name` and `description`
   * field in the LogMetric.
   * To create a logs-based metric that records a distribution of log values, a
   * DELTA metric kind with a DISTRIBUTION value type must be used along with
   * a `value_extractor` expression in the LogMetric.
   * Each label in the metric descriptor must have a matching label
   * name as the key and an extractor expression as the value in the
   * `label_extractors` map.
   * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
   * be updated once initially configured. New labels can be added in the
   * `metric_descriptor`, but existing labels cannot be modified except for
   * their description.
   * </pre>
   *
   * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override
  public com.google.api.MetricDescriptor getMetricDescriptor() {
    return metricDescriptor_ == null ? com.google.api.MetricDescriptor.getDefaultInstance() : metricDescriptor_;
  }
  /**
   * <pre>
   * Optional. The metric descriptor associated with the logs-based metric.
   * If unspecified, it uses a default metric descriptor with a DELTA metric
   * kind, INT64 value type, with no labels and a unit of "1". Such a metric
   * counts the number of log entries matching the `filter` expression.
   * The `name`, `type`, and `description` fields in the `metric_descriptor`
   * are output only, and is constructed using the `name` and `description`
   * field in the LogMetric.
   * To create a logs-based metric that records a distribution of log values, a
   * DELTA metric kind with a DISTRIBUTION value type must be used along with
   * a `value_extractor` expression in the LogMetric.
   * Each label in the metric descriptor must have a matching label
   * name as the key and an extractor expression as the value in the
   * `label_extractors` map.
   * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
   * be updated once initially configured. New labels can be added in the
   * `metric_descriptor`, but existing labels cannot be modified except for
   * their description.
   * </pre>
   *
   * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  private void setMetricDescriptor(com.google.api.MetricDescriptor value) {
    value.getClass();
  metricDescriptor_ = value;
    
    }
  /**
   * <pre>
   * Optional. The metric descriptor associated with the logs-based metric.
   * If unspecified, it uses a default metric descriptor with a DELTA metric
   * kind, INT64 value type, with no labels and a unit of "1". Such a metric
   * counts the number of log entries matching the `filter` expression.
   * The `name`, `type`, and `description` fields in the `metric_descriptor`
   * are output only, and is constructed using the `name` and `description`
   * field in the LogMetric.
   * To create a logs-based metric that records a distribution of log values, a
   * DELTA metric kind with a DISTRIBUTION value type must be used along with
   * a `value_extractor` expression in the LogMetric.
   * Each label in the metric descriptor must have a matching label
   * name as the key and an extractor expression as the value in the
   * `label_extractors` map.
   * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
   * be updated once initially configured. New labels can be added in the
   * `metric_descriptor`, but existing labels cannot be modified except for
   * their description.
   * </pre>
   *
   * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.SuppressWarnings({"ReferenceEquality"})
  private void mergeMetricDescriptor(com.google.api.MetricDescriptor value) {
    value.getClass();
  if (metricDescriptor_ != null &&
        metricDescriptor_ != com.google.api.MetricDescriptor.getDefaultInstance()) {
      metricDescriptor_ =
        com.google.api.MetricDescriptor.newBuilder(metricDescriptor_).mergeFrom(value).buildPartial();
    } else {
      metricDescriptor_ = value;
    }
    
  }
  /**
   * <pre>
   * Optional. The metric descriptor associated with the logs-based metric.
   * If unspecified, it uses a default metric descriptor with a DELTA metric
   * kind, INT64 value type, with no labels and a unit of "1". Such a metric
   * counts the number of log entries matching the `filter` expression.
   * The `name`, `type`, and `description` fields in the `metric_descriptor`
   * are output only, and is constructed using the `name` and `description`
   * field in the LogMetric.
   * To create a logs-based metric that records a distribution of log values, a
   * DELTA metric kind with a DISTRIBUTION value type must be used along with
   * a `value_extractor` expression in the LogMetric.
   * Each label in the metric descriptor must have a matching label
   * name as the key and an extractor expression as the value in the
   * `label_extractors` map.
   * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
   * be updated once initially configured. New labels can be added in the
   * `metric_descriptor`, but existing labels cannot be modified except for
   * their description.
   * </pre>
   *
   * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  private void clearMetricDescriptor() {  metricDescriptor_ = null;
    
  }

  public static final int VALUE_EXTRACTOR_FIELD_NUMBER = 6;
  private java.lang.String valueExtractor_;
  /**
   * <pre>
   * Optional. A `value_extractor` is required when using a distribution
   * logs-based metric to extract the values to record from a log entry.
   * Two functions are supported for value extraction: `EXTRACT(field)` or
   * `REGEXP_EXTRACT(field, regex)`. The argument are:
   *   1. field: The name of the log entry field from which the value is to be
   *      extracted.
   *   2. regex: A regular expression using the Google RE2 syntax
   *      (https://github.com/google/re2/wiki/Syntax) with a single capture
   *      group to extract data from the specified log entry field. The value
   *      of the field is converted to a string before applying the regex.
   *      It is an error to specify a regex that does not include exactly one
   *      capture group.
   * The result of the extraction must be convertible to a double type, as the
   * distribution always records double values. If either the extraction or
   * the conversion to double fails, then those values are not recorded in the
   * distribution.
   * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
   * </pre>
   *
   * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
   * @return The valueExtractor.
   */
  @java.lang.Override
  public java.lang.String getValueExtractor() {
    return valueExtractor_;
  }
  /**
   * <pre>
   * Optional. A `value_extractor` is required when using a distribution
   * logs-based metric to extract the values to record from a log entry.
   * Two functions are supported for value extraction: `EXTRACT(field)` or
   * `REGEXP_EXTRACT(field, regex)`. The argument are:
   *   1. field: The name of the log entry field from which the value is to be
   *      extracted.
   *   2. regex: A regular expression using the Google RE2 syntax
   *      (https://github.com/google/re2/wiki/Syntax) with a single capture
   *      group to extract data from the specified log entry field. The value
   *      of the field is converted to a string before applying the regex.
   *      It is an error to specify a regex that does not include exactly one
   *      capture group.
   * The result of the extraction must be convertible to a double type, as the
   * distribution always records double values. If either the extraction or
   * the conversion to double fails, then those values are not recorded in the
   * distribution.
   * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
   * </pre>
   *
   * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
   * @return The bytes for valueExtractor.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getValueExtractorBytes() {
    return com.google.protobuf.ByteString.copyFromUtf8(valueExtractor_);
  }
  /**
   * <pre>
   * Optional. A `value_extractor` is required when using a distribution
   * logs-based metric to extract the values to record from a log entry.
   * Two functions are supported for value extraction: `EXTRACT(field)` or
   * `REGEXP_EXTRACT(field, regex)`. The argument are:
   *   1. field: The name of the log entry field from which the value is to be
   *      extracted.
   *   2. regex: A regular expression using the Google RE2 syntax
   *      (https://github.com/google/re2/wiki/Syntax) with a single capture
   *      group to extract data from the specified log entry field. The value
   *      of the field is converted to a string before applying the regex.
   *      It is an error to specify a regex that does not include exactly one
   *      capture group.
   * The result of the extraction must be convertible to a double type, as the
   * distribution always records double values. If either the extraction or
   * the conversion to double fails, then those values are not recorded in the
   * distribution.
   * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
   * </pre>
   *
   * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
   * @param value The valueExtractor to set.
   */
  private void setValueExtractor(
      java.lang.String value) {
    value.getClass();
  
    valueExtractor_ = value;
  }
  /**
   * <pre>
   * Optional. A `value_extractor` is required when using a distribution
   * logs-based metric to extract the values to record from a log entry.
   * Two functions are supported for value extraction: `EXTRACT(field)` or
   * `REGEXP_EXTRACT(field, regex)`. The argument are:
   *   1. field: The name of the log entry field from which the value is to be
   *      extracted.
   *   2. regex: A regular expression using the Google RE2 syntax
   *      (https://github.com/google/re2/wiki/Syntax) with a single capture
   *      group to extract data from the specified log entry field. The value
   *      of the field is converted to a string before applying the regex.
   *      It is an error to specify a regex that does not include exactly one
   *      capture group.
   * The result of the extraction must be convertible to a double type, as the
   * distribution always records double values. If either the extraction or
   * the conversion to double fails, then those values are not recorded in the
   * distribution.
   * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
   * </pre>
   *
   * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  private void clearValueExtractor() {
    
    valueExtractor_ = getDefaultInstance().getValueExtractor();
  }
  /**
   * <pre>
   * Optional. A `value_extractor` is required when using a distribution
   * logs-based metric to extract the values to record from a log entry.
   * Two functions are supported for value extraction: `EXTRACT(field)` or
   * `REGEXP_EXTRACT(field, regex)`. The argument are:
   *   1. field: The name of the log entry field from which the value is to be
   *      extracted.
   *   2. regex: A regular expression using the Google RE2 syntax
   *      (https://github.com/google/re2/wiki/Syntax) with a single capture
   *      group to extract data from the specified log entry field. The value
   *      of the field is converted to a string before applying the regex.
   *      It is an error to specify a regex that does not include exactly one
   *      capture group.
   * The result of the extraction must be convertible to a double type, as the
   * distribution always records double values. If either the extraction or
   * the conversion to double fails, then those values are not recorded in the
   * distribution.
   * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
   * </pre>
   *
   * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
   * @param value The bytes for valueExtractor to set.
   */
  private void setValueExtractorBytes(
      com.google.protobuf.ByteString value) {
    checkByteStringIsUtf8(value);
    valueExtractor_ = value.toStringUtf8();
    
  }

  public static final int LABEL_EXTRACTORS_FIELD_NUMBER = 7;
  private static final class LabelExtractorsDefaultEntryHolder {
    static final com.google.protobuf.MapEntryLite<
        java.lang.String, java.lang.String> defaultEntry =
            com.google.protobuf.MapEntryLite
            .<java.lang.String, java.lang.String>newDefaultInstance(
                com.google.protobuf.WireFormat.FieldType.STRING,
                "",
                com.google.protobuf.WireFormat.FieldType.STRING,
                "");
  }
  private com.google.protobuf.MapFieldLite<
      java.lang.String, java.lang.String> labelExtractors_ =
          com.google.protobuf.MapFieldLite.emptyMapField();
  private com.google.protobuf.MapFieldLite<java.lang.String, java.lang.String>
  internalGetLabelExtractors() {
    return labelExtractors_;
  }
  private com.google.protobuf.MapFieldLite<java.lang.String, java.lang.String>
  internalGetMutableLabelExtractors() {
    if (!labelExtractors_.isMutable()) {
      labelExtractors_ = labelExtractors_.mutableCopy();
    }
    return labelExtractors_;
  }
  @java.lang.Override

  public int getLabelExtractorsCount() {
    return internalGetLabelExtractors().size();
  }
  /**
   * <pre>
   * Optional. A map from a label key string to an extractor expression which is
   * used to extract data from a log entry field and assign as the label value.
   * Each label key specified in the LabelDescriptor must have an associated
   * extractor expression in this map. The syntax of the extractor expression
   * is the same as for the `value_extractor` field.
   * The extracted value is converted to the type defined in the label
   * descriptor. If the either the extraction or the type conversion fails,
   * the label will have a default value. The default value for a string
   * label is an empty string, for an integer label its 0, and for a boolean
   * label its `false`.
   * Note that there are upper bounds on the maximum number of labels and the
   * number of active time series that are allowed in a project.
   * </pre>
   *
   * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override

  public boolean containsLabelExtractors(
      java.lang.String key) {
    key.getClass();
    return internalGetLabelExtractors().containsKey(key);
  }
  /**
   * Use {@link #getLabelExtractorsMap()} instead.
   */
  @java.lang.Override
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getLabelExtractors() {
    return getLabelExtractorsMap();
  }
  /**
   * <pre>
   * Optional. A map from a label key string to an extractor expression which is
   * used to extract data from a log entry field and assign as the label value.
   * Each label key specified in the LabelDescriptor must have an associated
   * extractor expression in this map. The syntax of the extractor expression
   * is the same as for the `value_extractor` field.
   * The extracted value is converted to the type defined in the label
   * descriptor. If the either the extraction or the type conversion fails,
   * the label will have a default value. The default value for a string
   * label is an empty string, for an integer label its 0, and for a boolean
   * label its `false`.
   * Note that there are upper bounds on the maximum number of labels and the
   * number of active time series that are allowed in a project.
   * </pre>
   *
   * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override

  public java.util.Map<java.lang.String, java.lang.String> getLabelExtractorsMap() {
    return java.util.Collections.unmodifiableMap(
        internalGetLabelExtractors());
  }
  /**
   * <pre>
   * Optional. A map from a label key string to an extractor expression which is
   * used to extract data from a log entry field and assign as the label value.
   * Each label key specified in the LabelDescriptor must have an associated
   * extractor expression in this map. The syntax of the extractor expression
   * is the same as for the `value_extractor` field.
   * The extracted value is converted to the type defined in the label
   * descriptor. If the either the extraction or the type conversion fails,
   * the label will have a default value. The default value for a string
   * label is an empty string, for an integer label its 0, and for a boolean
   * label its `false`.
   * Note that there are upper bounds on the maximum number of labels and the
   * number of active time series that are allowed in a project.
   * </pre>
   *
   * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override

  public java.lang.String getLabelExtractorsOrDefault(
      java.lang.String key,
      java.lang.String defaultValue) {
    key.getClass();
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetLabelExtractors();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   * <pre>
   * Optional. A map from a label key string to an extractor expression which is
   * used to extract data from a log entry field and assign as the label value.
   * Each label key specified in the LabelDescriptor must have an associated
   * extractor expression in this map. The syntax of the extractor expression
   * is the same as for the `value_extractor` field.
   * The extracted value is converted to the type defined in the label
   * descriptor. If the either the extraction or the type conversion fails,
   * the label will have a default value. The default value for a string
   * label is an empty string, for an integer label its 0, and for a boolean
   * label its `false`.
   * Note that there are upper bounds on the maximum number of labels and the
   * number of active time series that are allowed in a project.
   * </pre>
   *
   * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override

  public java.lang.String getLabelExtractorsOrThrow(
      java.lang.String key) {
    key.getClass();
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetLabelExtractors();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }
  /**
   * <pre>
   * Optional. A map from a label key string to an extractor expression which is
   * used to extract data from a log entry field and assign as the label value.
   * Each label key specified in the LabelDescriptor must have an associated
   * extractor expression in this map. The syntax of the extractor expression
   * is the same as for the `value_extractor` field.
   * The extracted value is converted to the type defined in the label
   * descriptor. If the either the extraction or the type conversion fails,
   * the label will have a default value. The default value for a string
   * label is an empty string, for an integer label its 0, and for a boolean
   * label its `false`.
   * Note that there are upper bounds on the maximum number of labels and the
   * number of active time series that are allowed in a project.
   * </pre>
   *
   * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  private java.util.Map<java.lang.String, java.lang.String>
  getMutableLabelExtractorsMap() {
    return internalGetMutableLabelExtractors();
  }

  public static final int BUCKET_OPTIONS_FIELD_NUMBER = 8;
  private com.google.api.Distribution.BucketOptions bucketOptions_;
  /**
   * <pre>
   * Optional. The `bucket_options` are required when the logs-based metric is
   * using a DISTRIBUTION value type and it describes the bucket boundaries
   * used to create a histogram of the extracted values.
   * </pre>
   *
   * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override
  public boolean hasBucketOptions() {
    return bucketOptions_ != null;
  }
  /**
   * <pre>
   * Optional. The `bucket_options` are required when the logs-based metric is
   * using a DISTRIBUTION value type and it describes the bucket boundaries
   * used to create a histogram of the extracted values.
   * </pre>
   *
   * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override
  public com.google.api.Distribution.BucketOptions getBucketOptions() {
    return bucketOptions_ == null ? com.google.api.Distribution.BucketOptions.getDefaultInstance() : bucketOptions_;
  }
  /**
   * <pre>
   * Optional. The `bucket_options` are required when the logs-based metric is
   * using a DISTRIBUTION value type and it describes the bucket boundaries
   * used to create a histogram of the extracted values.
   * </pre>
   *
   * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  private void setBucketOptions(com.google.api.Distribution.BucketOptions value) {
    value.getClass();
  bucketOptions_ = value;
    
    }
  /**
   * <pre>
   * Optional. The `bucket_options` are required when the logs-based metric is
   * using a DISTRIBUTION value type and it describes the bucket boundaries
   * used to create a histogram of the extracted values.
   * </pre>
   *
   * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.SuppressWarnings({"ReferenceEquality"})
  private void mergeBucketOptions(com.google.api.Distribution.BucketOptions value) {
    value.getClass();
  if (bucketOptions_ != null &&
        bucketOptions_ != com.google.api.Distribution.BucketOptions.getDefaultInstance()) {
      bucketOptions_ =
        com.google.api.Distribution.BucketOptions.newBuilder(bucketOptions_).mergeFrom(value).buildPartial();
    } else {
      bucketOptions_ = value;
    }
    
  }
  /**
   * <pre>
   * Optional. The `bucket_options` are required when the logs-based metric is
   * using a DISTRIBUTION value type and it describes the bucket boundaries
   * used to create a histogram of the extracted values.
   * </pre>
   *
   * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  private void clearBucketOptions() {  bucketOptions_ = null;
    
  }

  public static final int CREATE_TIME_FIELD_NUMBER = 9;
  private com.google.protobuf.Timestamp createTime_;
  /**
   * <pre>
   * Output only. The creation timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  @java.lang.Override
  public boolean hasCreateTime() {
    return createTime_ != null;
  }
  /**
   * <pre>
   * Output only. The creation timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  @java.lang.Override
  public com.google.protobuf.Timestamp getCreateTime() {
    return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_;
  }
  /**
   * <pre>
   * Output only. The creation timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  private void setCreateTime(com.google.protobuf.Timestamp value) {
    value.getClass();
  createTime_ = value;
    
    }
  /**
   * <pre>
   * Output only. The creation timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  @java.lang.SuppressWarnings({"ReferenceEquality"})
  private void mergeCreateTime(com.google.protobuf.Timestamp value) {
    value.getClass();
  if (createTime_ != null &&
        createTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) {
      createTime_ =
        com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial();
    } else {
      createTime_ = value;
    }
    
  }
  /**
   * <pre>
   * Output only. The creation timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  private void clearCreateTime() {  createTime_ = null;
    
  }

  public static final int UPDATE_TIME_FIELD_NUMBER = 10;
  private com.google.protobuf.Timestamp updateTime_;
  /**
   * <pre>
   * Output only. The last update timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  @java.lang.Override
  public boolean hasUpdateTime() {
    return updateTime_ != null;
  }
  /**
   * <pre>
   * Output only. The last update timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  @java.lang.Override
  public com.google.protobuf.Timestamp getUpdateTime() {
    return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_;
  }
  /**
   * <pre>
   * Output only. The last update timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  private void setUpdateTime(com.google.protobuf.Timestamp value) {
    value.getClass();
  updateTime_ = value;
    
    }
  /**
   * <pre>
   * Output only. The last update timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  @java.lang.SuppressWarnings({"ReferenceEquality"})
  private void mergeUpdateTime(com.google.protobuf.Timestamp value) {
    value.getClass();
  if (updateTime_ != null &&
        updateTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) {
      updateTime_ =
        com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial();
    } else {
      updateTime_ = value;
    }
    
  }
  /**
   * <pre>
   * Output only. The last update timestamp of the metric.
   * This field may not be present for older metrics.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
   */
  private void clearUpdateTime() {  updateTime_ = null;
    
  }

  public static final int VERSION_FIELD_NUMBER = 4;
  private int version_;
  /**
   * <pre>
   * Deprecated. The API version that created or updated this metric.
   * The v2 format is used by default and cannot be changed.
   * </pre>
   *
   * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
   * @return The enum numeric value on the wire for version.
   */
  @java.lang.Override
  @java.lang.Deprecated public int getVersionValue() {
    return version_;
  }
  /**
   * <pre>
   * Deprecated. The API version that created or updated this metric.
   * The v2 format is used by default and cannot be changed.
   * </pre>
   *
   * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
   * @return The version.
   */
  @java.lang.Override
  @java.lang.Deprecated public com.google.logging.v2.LogMetric.ApiVersion getVersion() {
    com.google.logging.v2.LogMetric.ApiVersion result = com.google.logging.v2.LogMetric.ApiVersion.forNumber(version_);
    return result == null ? com.google.logging.v2.LogMetric.ApiVersion.UNRECOGNIZED : result;
  }
  /**
   * <pre>
   * Deprecated. The API version that created or updated this metric.
   * The v2 format is used by default and cannot be changed.
   * </pre>
   *
   * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
   * @param value The enum numeric value on the wire for version to set.
   */
  private void setVersionValue(int value) {
      version_ = value;
  }
  /**
   * <pre>
   * Deprecated. The API version that created or updated this metric.
   * The v2 format is used by default and cannot be changed.
   * </pre>
   *
   * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
   * @param value The version to set.
   */
  private void setVersion(com.google.logging.v2.LogMetric.ApiVersion value) {
    version_ = value.getNumber();
    
  }
  /**
   * <pre>
   * Deprecated. The API version that created or updated this metric.
   * The v2 format is used by default and cannot be changed.
   * </pre>
   *
   * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
   */
  private void clearVersion() {
    
    version_ = 0;
  }

  public static com.google.logging.v2.LogMetric parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data);
  }
  public static com.google.logging.v2.LogMetric parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data, extensionRegistry);
  }
  public static com.google.logging.v2.LogMetric parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data);
  }
  public static com.google.logging.v2.LogMetric parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data, extensionRegistry);
  }
  public static com.google.logging.v2.LogMetric parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data);
  }
  public static com.google.logging.v2.LogMetric parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, data, extensionRegistry);
  }
  public static com.google.logging.v2.LogMetric parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, input);
  }
  public static com.google.logging.v2.LogMetric parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, input, extensionRegistry);
  }
  public static com.google.logging.v2.LogMetric parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return parseDelimitedFrom(DEFAULT_INSTANCE, input);
  }
  public static com.google.logging.v2.LogMetric parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry);
  }
  public static com.google.logging.v2.LogMetric parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, input);
  }
  public static com.google.logging.v2.LogMetric parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageLite.parseFrom(
        DEFAULT_INSTANCE, input, extensionRegistry);
  }

  public static Builder newBuilder() {
    return (Builder) DEFAULT_INSTANCE.createBuilder();
  }
  public static Builder newBuilder(com.google.logging.v2.LogMetric prototype) {
    return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
  }

  /**
   * <pre>
   * Describes a logs-based metric. The value of the metric is the number of log
   * entries that match a logs filter in a given time interval.
   * Logs-based metrics can also be used to extract values from logs and create a
   * distribution of the values. The distribution records the statistics of the
   * extracted values along with an optional histogram of the values as specified
   * by the bucket options.
   * </pre>
   *
   * Protobuf type {@code google.logging.v2.LogMetric}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageLite.Builder<
        com.google.logging.v2.LogMetric, Builder> implements
      // @@protoc_insertion_point(builder_implements:google.logging.v2.LogMetric)
      com.google.logging.v2.LogMetricOrBuilder {
    // Construct using com.google.logging.v2.LogMetric.newBuilder()
    private Builder() {
      super(DEFAULT_INSTANCE);
    }


    /**
     * <pre>
     * Required. The client-assigned metric identifier.
     * Examples: `"error_count"`, `"nginx/requests"`.
     * Metric identifiers are limited to 100 characters and can include only the
     * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
     * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
     * name pieces, and it cannot be the first character of the name.
     * The metric identifier in this field must not be
     * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
     * However, when the metric identifier appears as the `[METRIC_ID]` part of a
     * `metric_name` API parameter, then the metric identifier must be
     * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return The name.
     */
    @java.lang.Override
    public java.lang.String getName() {
      return instance.getName();
    }
    /**
     * <pre>
     * Required. The client-assigned metric identifier.
     * Examples: `"error_count"`, `"nginx/requests"`.
     * Metric identifiers are limited to 100 characters and can include only the
     * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
     * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
     * name pieces, and it cannot be the first character of the name.
     * The metric identifier in this field must not be
     * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
     * However, when the metric identifier appears as the `[METRIC_ID]` part of a
     * `metric_name` API parameter, then the metric identifier must be
     * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return The bytes for name.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString
        getNameBytes() {
      return instance.getNameBytes();
    }
    /**
     * <pre>
     * Required. The client-assigned metric identifier.
     * Examples: `"error_count"`, `"nginx/requests"`.
     * Metric identifiers are limited to 100 characters and can include only the
     * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
     * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
     * name pieces, and it cannot be the first character of the name.
     * The metric identifier in this field must not be
     * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
     * However, when the metric identifier appears as the `[METRIC_ID]` part of a
     * `metric_name` API parameter, then the metric identifier must be
     * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param value The name to set.
     * @return This builder for chaining.
     */
    public Builder setName(
        java.lang.String value) {
      copyOnWrite();
      instance.setName(value);
      return this;
    }
    /**
     * <pre>
     * Required. The client-assigned metric identifier.
     * Examples: `"error_count"`, `"nginx/requests"`.
     * Metric identifiers are limited to 100 characters and can include only the
     * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
     * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
     * name pieces, and it cannot be the first character of the name.
     * The metric identifier in this field must not be
     * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
     * However, when the metric identifier appears as the `[METRIC_ID]` part of a
     * `metric_name` API parameter, then the metric identifier must be
     * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return This builder for chaining.
     */
    public Builder clearName() {
      copyOnWrite();
      instance.clearName();
      return this;
    }
    /**
     * <pre>
     * Required. The client-assigned metric identifier.
     * Examples: `"error_count"`, `"nginx/requests"`.
     * Metric identifiers are limited to 100 characters and can include only the
     * following characters: `A-Z`, `a-z`, `0-9`, and the special characters
     * `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
     * name pieces, and it cannot be the first character of the name.
     * The metric identifier in this field must not be
     * [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
     * However, when the metric identifier appears as the `[METRIC_ID]` part of a
     * `metric_name` API parameter, then the metric identifier must be
     * URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param value The bytes for name to set.
     * @return This builder for chaining.
     */
    public Builder setNameBytes(
        com.google.protobuf.ByteString value) {
      copyOnWrite();
      instance.setNameBytes(value);
      return this;
    }

    /**
     * <pre>
     * Optional. A description of this metric, which is used in documentation.
     * The maximum length of the description is 8000 characters.
     * </pre>
     *
     * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return The description.
     */
    @java.lang.Override
    public java.lang.String getDescription() {
      return instance.getDescription();
    }
    /**
     * <pre>
     * Optional. A description of this metric, which is used in documentation.
     * The maximum length of the description is 8000 characters.
     * </pre>
     *
     * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return The bytes for description.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString
        getDescriptionBytes() {
      return instance.getDescriptionBytes();
    }
    /**
     * <pre>
     * Optional. A description of this metric, which is used in documentation.
     * The maximum length of the description is 8000 characters.
     * </pre>
     *
     * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param value The description to set.
     * @return This builder for chaining.
     */
    public Builder setDescription(
        java.lang.String value) {
      copyOnWrite();
      instance.setDescription(value);
      return this;
    }
    /**
     * <pre>
     * Optional. A description of this metric, which is used in documentation.
     * The maximum length of the description is 8000 characters.
     * </pre>
     *
     * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return This builder for chaining.
     */
    public Builder clearDescription() {
      copyOnWrite();
      instance.clearDescription();
      return this;
    }
    /**
     * <pre>
     * Optional. A description of this metric, which is used in documentation.
     * The maximum length of the description is 8000 characters.
     * </pre>
     *
     * <code>string description = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param value The bytes for description to set.
     * @return This builder for chaining.
     */
    public Builder setDescriptionBytes(
        com.google.protobuf.ByteString value) {
      copyOnWrite();
      instance.setDescriptionBytes(value);
      return this;
    }

    /**
     * <pre>
     * Required. An [advanced logs
     * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
     * is used to match log entries. Example:
     *     "resource.type=gae_app AND severity&gt;=ERROR"
     * The maximum length of the filter is 20000 characters.
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return The filter.
     */
    @java.lang.Override
    public java.lang.String getFilter() {
      return instance.getFilter();
    }
    /**
     * <pre>
     * Required. An [advanced logs
     * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
     * is used to match log entries. Example:
     *     "resource.type=gae_app AND severity&gt;=ERROR"
     * The maximum length of the filter is 20000 characters.
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return The bytes for filter.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString
        getFilterBytes() {
      return instance.getFilterBytes();
    }
    /**
     * <pre>
     * Required. An [advanced logs
     * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
     * is used to match log entries. Example:
     *     "resource.type=gae_app AND severity&gt;=ERROR"
     * The maximum length of the filter is 20000 characters.
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param value The filter to set.
     * @return This builder for chaining.
     */
    public Builder setFilter(
        java.lang.String value) {
      copyOnWrite();
      instance.setFilter(value);
      return this;
    }
    /**
     * <pre>
     * Required. An [advanced logs
     * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
     * is used to match log entries. Example:
     *     "resource.type=gae_app AND severity&gt;=ERROR"
     * The maximum length of the filter is 20000 characters.
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return This builder for chaining.
     */
    public Builder clearFilter() {
      copyOnWrite();
      instance.clearFilter();
      return this;
    }
    /**
     * <pre>
     * Required. An [advanced logs
     * filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
     * is used to match log entries. Example:
     *     "resource.type=gae_app AND severity&gt;=ERROR"
     * The maximum length of the filter is 20000 characters.
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param value The bytes for filter to set.
     * @return This builder for chaining.
     */
    public Builder setFilterBytes(
        com.google.protobuf.ByteString value) {
      copyOnWrite();
      instance.setFilterBytes(value);
      return this;
    }

    /**
     * <pre>
     * Optional. The metric descriptor associated with the logs-based metric.
     * If unspecified, it uses a default metric descriptor with a DELTA metric
     * kind, INT64 value type, with no labels and a unit of "1". Such a metric
     * counts the number of log entries matching the `filter` expression.
     * The `name`, `type`, and `description` fields in the `metric_descriptor`
     * are output only, and is constructed using the `name` and `description`
     * field in the LogMetric.
     * To create a logs-based metric that records a distribution of log values, a
     * DELTA metric kind with a DISTRIBUTION value type must be used along with
     * a `value_extractor` expression in the LogMetric.
     * Each label in the metric descriptor must have a matching label
     * name as the key and an extractor expression as the value in the
     * `label_extractors` map.
     * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
     * be updated once initially configured. New labels can be added in the
     * `metric_descriptor`, but existing labels cannot be modified except for
     * their description.
     * </pre>
     *
     * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override
    public boolean hasMetricDescriptor() {
      return instance.hasMetricDescriptor();
    }
    /**
     * <pre>
     * Optional. The metric descriptor associated with the logs-based metric.
     * If unspecified, it uses a default metric descriptor with a DELTA metric
     * kind, INT64 value type, with no labels and a unit of "1". Such a metric
     * counts the number of log entries matching the `filter` expression.
     * The `name`, `type`, and `description` fields in the `metric_descriptor`
     * are output only, and is constructed using the `name` and `description`
     * field in the LogMetric.
     * To create a logs-based metric that records a distribution of log values, a
     * DELTA metric kind with a DISTRIBUTION value type must be used along with
     * a `value_extractor` expression in the LogMetric.
     * Each label in the metric descriptor must have a matching label
     * name as the key and an extractor expression as the value in the
     * `label_extractors` map.
     * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
     * be updated once initially configured. New labels can be added in the
     * `metric_descriptor`, but existing labels cannot be modified except for
     * their description.
     * </pre>
     *
     * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override
    public com.google.api.MetricDescriptor getMetricDescriptor() {
      return instance.getMetricDescriptor();
    }
    /**
     * <pre>
     * Optional. The metric descriptor associated with the logs-based metric.
     * If unspecified, it uses a default metric descriptor with a DELTA metric
     * kind, INT64 value type, with no labels and a unit of "1". Such a metric
     * counts the number of log entries matching the `filter` expression.
     * The `name`, `type`, and `description` fields in the `metric_descriptor`
     * are output only, and is constructed using the `name` and `description`
     * field in the LogMetric.
     * To create a logs-based metric that records a distribution of log values, a
     * DELTA metric kind with a DISTRIBUTION value type must be used along with
     * a `value_extractor` expression in the LogMetric.
     * Each label in the metric descriptor must have a matching label
     * name as the key and an extractor expression as the value in the
     * `label_extractors` map.
     * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
     * be updated once initially configured. New labels can be added in the
     * `metric_descriptor`, but existing labels cannot be modified except for
     * their description.
     * </pre>
     *
     * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder setMetricDescriptor(com.google.api.MetricDescriptor value) {
      copyOnWrite();
      instance.setMetricDescriptor(value);
      return this;
      }
    /**
     * <pre>
     * Optional. The metric descriptor associated with the logs-based metric.
     * If unspecified, it uses a default metric descriptor with a DELTA metric
     * kind, INT64 value type, with no labels and a unit of "1". Such a metric
     * counts the number of log entries matching the `filter` expression.
     * The `name`, `type`, and `description` fields in the `metric_descriptor`
     * are output only, and is constructed using the `name` and `description`
     * field in the LogMetric.
     * To create a logs-based metric that records a distribution of log values, a
     * DELTA metric kind with a DISTRIBUTION value type must be used along with
     * a `value_extractor` expression in the LogMetric.
     * Each label in the metric descriptor must have a matching label
     * name as the key and an extractor expression as the value in the
     * `label_extractors` map.
     * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
     * be updated once initially configured. New labels can be added in the
     * `metric_descriptor`, but existing labels cannot be modified except for
     * their description.
     * </pre>
     *
     * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder setMetricDescriptor(
        com.google.api.MetricDescriptor.Builder builderForValue) {
      copyOnWrite();
      instance.setMetricDescriptor(builderForValue.build());
      return this;
    }
    /**
     * <pre>
     * Optional. The metric descriptor associated with the logs-based metric.
     * If unspecified, it uses a default metric descriptor with a DELTA metric
     * kind, INT64 value type, with no labels and a unit of "1". Such a metric
     * counts the number of log entries matching the `filter` expression.
     * The `name`, `type`, and `description` fields in the `metric_descriptor`
     * are output only, and is constructed using the `name` and `description`
     * field in the LogMetric.
     * To create a logs-based metric that records a distribution of log values, a
     * DELTA metric kind with a DISTRIBUTION value type must be used along with
     * a `value_extractor` expression in the LogMetric.
     * Each label in the metric descriptor must have a matching label
     * name as the key and an extractor expression as the value in the
     * `label_extractors` map.
     * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
     * be updated once initially configured. New labels can be added in the
     * `metric_descriptor`, but existing labels cannot be modified except for
     * their description.
     * </pre>
     *
     * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder mergeMetricDescriptor(com.google.api.MetricDescriptor value) {
      copyOnWrite();
      instance.mergeMetricDescriptor(value);
      return this;
    }
    /**
     * <pre>
     * Optional. The metric descriptor associated with the logs-based metric.
     * If unspecified, it uses a default metric descriptor with a DELTA metric
     * kind, INT64 value type, with no labels and a unit of "1". Such a metric
     * counts the number of log entries matching the `filter` expression.
     * The `name`, `type`, and `description` fields in the `metric_descriptor`
     * are output only, and is constructed using the `name` and `description`
     * field in the LogMetric.
     * To create a logs-based metric that records a distribution of log values, a
     * DELTA metric kind with a DISTRIBUTION value type must be used along with
     * a `value_extractor` expression in the LogMetric.
     * Each label in the metric descriptor must have a matching label
     * name as the key and an extractor expression as the value in the
     * `label_extractors` map.
     * The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
     * be updated once initially configured. New labels can be added in the
     * `metric_descriptor`, but existing labels cannot be modified except for
     * their description.
     * </pre>
     *
     * <code>.google.api.MetricDescriptor metric_descriptor = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder clearMetricDescriptor() {  copyOnWrite();
      instance.clearMetricDescriptor();
      return this;
    }

    /**
     * <pre>
     * Optional. A `value_extractor` is required when using a distribution
     * logs-based metric to extract the values to record from a log entry.
     * Two functions are supported for value extraction: `EXTRACT(field)` or
     * `REGEXP_EXTRACT(field, regex)`. The argument are:
     *   1. field: The name of the log entry field from which the value is to be
     *      extracted.
     *   2. regex: A regular expression using the Google RE2 syntax
     *      (https://github.com/google/re2/wiki/Syntax) with a single capture
     *      group to extract data from the specified log entry field. The value
     *      of the field is converted to a string before applying the regex.
     *      It is an error to specify a regex that does not include exactly one
     *      capture group.
     * The result of the extraction must be convertible to a double type, as the
     * distribution always records double values. If either the extraction or
     * the conversion to double fails, then those values are not recorded in the
     * distribution.
     * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
     * </pre>
     *
     * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return The valueExtractor.
     */
    @java.lang.Override
    public java.lang.String getValueExtractor() {
      return instance.getValueExtractor();
    }
    /**
     * <pre>
     * Optional. A `value_extractor` is required when using a distribution
     * logs-based metric to extract the values to record from a log entry.
     * Two functions are supported for value extraction: `EXTRACT(field)` or
     * `REGEXP_EXTRACT(field, regex)`. The argument are:
     *   1. field: The name of the log entry field from which the value is to be
     *      extracted.
     *   2. regex: A regular expression using the Google RE2 syntax
     *      (https://github.com/google/re2/wiki/Syntax) with a single capture
     *      group to extract data from the specified log entry field. The value
     *      of the field is converted to a string before applying the regex.
     *      It is an error to specify a regex that does not include exactly one
     *      capture group.
     * The result of the extraction must be convertible to a double type, as the
     * distribution always records double values. If either the extraction or
     * the conversion to double fails, then those values are not recorded in the
     * distribution.
     * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
     * </pre>
     *
     * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return The bytes for valueExtractor.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString
        getValueExtractorBytes() {
      return instance.getValueExtractorBytes();
    }
    /**
     * <pre>
     * Optional. A `value_extractor` is required when using a distribution
     * logs-based metric to extract the values to record from a log entry.
     * Two functions are supported for value extraction: `EXTRACT(field)` or
     * `REGEXP_EXTRACT(field, regex)`. The argument are:
     *   1. field: The name of the log entry field from which the value is to be
     *      extracted.
     *   2. regex: A regular expression using the Google RE2 syntax
     *      (https://github.com/google/re2/wiki/Syntax) with a single capture
     *      group to extract data from the specified log entry field. The value
     *      of the field is converted to a string before applying the regex.
     *      It is an error to specify a regex that does not include exactly one
     *      capture group.
     * The result of the extraction must be convertible to a double type, as the
     * distribution always records double values. If either the extraction or
     * the conversion to double fails, then those values are not recorded in the
     * distribution.
     * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
     * </pre>
     *
     * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param value The valueExtractor to set.
     * @return This builder for chaining.
     */
    public Builder setValueExtractor(
        java.lang.String value) {
      copyOnWrite();
      instance.setValueExtractor(value);
      return this;
    }
    /**
     * <pre>
     * Optional. A `value_extractor` is required when using a distribution
     * logs-based metric to extract the values to record from a log entry.
     * Two functions are supported for value extraction: `EXTRACT(field)` or
     * `REGEXP_EXTRACT(field, regex)`. The argument are:
     *   1. field: The name of the log entry field from which the value is to be
     *      extracted.
     *   2. regex: A regular expression using the Google RE2 syntax
     *      (https://github.com/google/re2/wiki/Syntax) with a single capture
     *      group to extract data from the specified log entry field. The value
     *      of the field is converted to a string before applying the regex.
     *      It is an error to specify a regex that does not include exactly one
     *      capture group.
     * The result of the extraction must be convertible to a double type, as the
     * distribution always records double values. If either the extraction or
     * the conversion to double fails, then those values are not recorded in the
     * distribution.
     * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
     * </pre>
     *
     * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return This builder for chaining.
     */
    public Builder clearValueExtractor() {
      copyOnWrite();
      instance.clearValueExtractor();
      return this;
    }
    /**
     * <pre>
     * Optional. A `value_extractor` is required when using a distribution
     * logs-based metric to extract the values to record from a log entry.
     * Two functions are supported for value extraction: `EXTRACT(field)` or
     * `REGEXP_EXTRACT(field, regex)`. The argument are:
     *   1. field: The name of the log entry field from which the value is to be
     *      extracted.
     *   2. regex: A regular expression using the Google RE2 syntax
     *      (https://github.com/google/re2/wiki/Syntax) with a single capture
     *      group to extract data from the specified log entry field. The value
     *      of the field is converted to a string before applying the regex.
     *      It is an error to specify a regex that does not include exactly one
     *      capture group.
     * The result of the extraction must be convertible to a double type, as the
     * distribution always records double values. If either the extraction or
     * the conversion to double fails, then those values are not recorded in the
     * distribution.
     * Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(&#92;d+).*")`
     * </pre>
     *
     * <code>string value_extractor = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param value The bytes for valueExtractor to set.
     * @return This builder for chaining.
     */
    public Builder setValueExtractorBytes(
        com.google.protobuf.ByteString value) {
      copyOnWrite();
      instance.setValueExtractorBytes(value);
      return this;
    }

    @java.lang.Override

    public int getLabelExtractorsCount() {
      return instance.getLabelExtractorsMap().size();
    }
    /**
     * <pre>
     * Optional. A map from a label key string to an extractor expression which is
     * used to extract data from a log entry field and assign as the label value.
     * Each label key specified in the LabelDescriptor must have an associated
     * extractor expression in this map. The syntax of the extractor expression
     * is the same as for the `value_extractor` field.
     * The extracted value is converted to the type defined in the label
     * descriptor. If the either the extraction or the type conversion fails,
     * the label will have a default value. The default value for a string
     * label is an empty string, for an integer label its 0, and for a boolean
     * label its `false`.
     * Note that there are upper bounds on the maximum number of labels and the
     * number of active time series that are allowed in a project.
     * </pre>
     *
     * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override

    public boolean containsLabelExtractors(
        java.lang.String key) {
      key.getClass();
      return instance.getLabelExtractorsMap().containsKey(key);
    }

    public Builder clearLabelExtractors() {
      copyOnWrite();
      instance.getMutableLabelExtractorsMap().clear();
      return this;
    }
    /**
     * <pre>
     * Optional. A map from a label key string to an extractor expression which is
     * used to extract data from a log entry field and assign as the label value.
     * Each label key specified in the LabelDescriptor must have an associated
     * extractor expression in this map. The syntax of the extractor expression
     * is the same as for the `value_extractor` field.
     * The extracted value is converted to the type defined in the label
     * descriptor. If the either the extraction or the type conversion fails,
     * the label will have a default value. The default value for a string
     * label is an empty string, for an integer label its 0, and for a boolean
     * label its `false`.
     * Note that there are upper bounds on the maximum number of labels and the
     * number of active time series that are allowed in a project.
     * </pre>
     *
     * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     */

    public Builder removeLabelExtractors(
        java.lang.String key) {
      key.getClass();
      copyOnWrite();
      instance.getMutableLabelExtractorsMap().remove(key);
      return this;
    }
    /**
     * Use {@link #getLabelExtractorsMap()} instead.
     */
    @java.lang.Override
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getLabelExtractors() {
      return getLabelExtractorsMap();
    }
    /**
     * <pre>
     * Optional. A map from a label key string to an extractor expression which is
     * used to extract data from a log entry field and assign as the label value.
     * Each label key specified in the LabelDescriptor must have an associated
     * extractor expression in this map. The syntax of the extractor expression
     * is the same as for the `value_extractor` field.
     * The extracted value is converted to the type defined in the label
     * descriptor. If the either the extraction or the type conversion fails,
     * the label will have a default value. The default value for a string
     * label is an empty string, for an integer label its 0, and for a boolean
     * label its `false`.
     * Note that there are upper bounds on the maximum number of labels and the
     * number of active time series that are allowed in a project.
     * </pre>
     *
     * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override
    public java.util.Map<java.lang.String, java.lang.String> getLabelExtractorsMap() {
      return java.util.Collections.unmodifiableMap(
          instance.getLabelExtractorsMap());
    }
    /**
     * <pre>
     * Optional. A map from a label key string to an extractor expression which is
     * used to extract data from a log entry field and assign as the label value.
     * Each label key specified in the LabelDescriptor must have an associated
     * extractor expression in this map. The syntax of the extractor expression
     * is the same as for the `value_extractor` field.
     * The extracted value is converted to the type defined in the label
     * descriptor. If the either the extraction or the type conversion fails,
     * the label will have a default value. The default value for a string
     * label is an empty string, for an integer label its 0, and for a boolean
     * label its `false`.
     * Note that there are upper bounds on the maximum number of labels and the
     * number of active time series that are allowed in a project.
     * </pre>
     *
     * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override

    public java.lang.String getLabelExtractorsOrDefault(
        java.lang.String key,
        java.lang.String defaultValue) {
      key.getClass();
      java.util.Map<java.lang.String, java.lang.String> map =
          instance.getLabelExtractorsMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     * <pre>
     * Optional. A map from a label key string to an extractor expression which is
     * used to extract data from a log entry field and assign as the label value.
     * Each label key specified in the LabelDescriptor must have an associated
     * extractor expression in this map. The syntax of the extractor expression
     * is the same as for the `value_extractor` field.
     * The extracted value is converted to the type defined in the label
     * descriptor. If the either the extraction or the type conversion fails,
     * the label will have a default value. The default value for a string
     * label is an empty string, for an integer label its 0, and for a boolean
     * label its `false`.
     * Note that there are upper bounds on the maximum number of labels and the
     * number of active time series that are allowed in a project.
     * </pre>
     *
     * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override

    public java.lang.String getLabelExtractorsOrThrow(
        java.lang.String key) {
      key.getClass();
      java.util.Map<java.lang.String, java.lang.String> map =
          instance.getLabelExtractorsMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }
    /**
     * <pre>
     * Optional. A map from a label key string to an extractor expression which is
     * used to extract data from a log entry field and assign as the label value.
     * Each label key specified in the LabelDescriptor must have an associated
     * extractor expression in this map. The syntax of the extractor expression
     * is the same as for the `value_extractor` field.
     * The extracted value is converted to the type defined in the label
     * descriptor. If the either the extraction or the type conversion fails,
     * the label will have a default value. The default value for a string
     * label is an empty string, for an integer label its 0, and for a boolean
     * label its `false`.
     * Note that there are upper bounds on the maximum number of labels and the
     * number of active time series that are allowed in a project.
     * </pre>
     *
     * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder putLabelExtractors(
        java.lang.String key,
        java.lang.String value) {
      key.getClass();
      value.getClass();
      copyOnWrite();
      instance.getMutableLabelExtractorsMap().put(key, value);
      return this;
    }
    /**
     * <pre>
     * Optional. A map from a label key string to an extractor expression which is
     * used to extract data from a log entry field and assign as the label value.
     * Each label key specified in the LabelDescriptor must have an associated
     * extractor expression in this map. The syntax of the extractor expression
     * is the same as for the `value_extractor` field.
     * The extracted value is converted to the type defined in the label
     * descriptor. If the either the extraction or the type conversion fails,
     * the label will have a default value. The default value for a string
     * label is an empty string, for an integer label its 0, and for a boolean
     * label its `false`.
     * Note that there are upper bounds on the maximum number of labels and the
     * number of active time series that are allowed in a project.
     * </pre>
     *
     * <code>map&lt;string, string&gt; label_extractors = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder putAllLabelExtractors(
        java.util.Map<java.lang.String, java.lang.String> values) {
      copyOnWrite();
      instance.getMutableLabelExtractorsMap().putAll(values);
      return this;
    }

    /**
     * <pre>
     * Optional. The `bucket_options` are required when the logs-based metric is
     * using a DISTRIBUTION value type and it describes the bucket boundaries
     * used to create a histogram of the extracted values.
     * </pre>
     *
     * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override
    public boolean hasBucketOptions() {
      return instance.hasBucketOptions();
    }
    /**
     * <pre>
     * Optional. The `bucket_options` are required when the logs-based metric is
     * using a DISTRIBUTION value type and it describes the bucket boundaries
     * used to create a histogram of the extracted values.
     * </pre>
     *
     * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override
    public com.google.api.Distribution.BucketOptions getBucketOptions() {
      return instance.getBucketOptions();
    }
    /**
     * <pre>
     * Optional. The `bucket_options` are required when the logs-based metric is
     * using a DISTRIBUTION value type and it describes the bucket boundaries
     * used to create a histogram of the extracted values.
     * </pre>
     *
     * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder setBucketOptions(com.google.api.Distribution.BucketOptions value) {
      copyOnWrite();
      instance.setBucketOptions(value);
      return this;
      }
    /**
     * <pre>
     * Optional. The `bucket_options` are required when the logs-based metric is
     * using a DISTRIBUTION value type and it describes the bucket boundaries
     * used to create a histogram of the extracted values.
     * </pre>
     *
     * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder setBucketOptions(
        com.google.api.Distribution.BucketOptions.Builder builderForValue) {
      copyOnWrite();
      instance.setBucketOptions(builderForValue.build());
      return this;
    }
    /**
     * <pre>
     * Optional. The `bucket_options` are required when the logs-based metric is
     * using a DISTRIBUTION value type and it describes the bucket boundaries
     * used to create a histogram of the extracted values.
     * </pre>
     *
     * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder mergeBucketOptions(com.google.api.Distribution.BucketOptions value) {
      copyOnWrite();
      instance.mergeBucketOptions(value);
      return this;
    }
    /**
     * <pre>
     * Optional. The `bucket_options` are required when the logs-based metric is
     * using a DISTRIBUTION value type and it describes the bucket boundaries
     * used to create a histogram of the extracted values.
     * </pre>
     *
     * <code>.google.api.Distribution.BucketOptions bucket_options = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder clearBucketOptions() {  copyOnWrite();
      instance.clearBucketOptions();
      return this;
    }

    /**
     * <pre>
     * Output only. The creation timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    @java.lang.Override
    public boolean hasCreateTime() {
      return instance.hasCreateTime();
    }
    /**
     * <pre>
     * Output only. The creation timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    @java.lang.Override
    public com.google.protobuf.Timestamp getCreateTime() {
      return instance.getCreateTime();
    }
    /**
     * <pre>
     * Output only. The creation timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    public Builder setCreateTime(com.google.protobuf.Timestamp value) {
      copyOnWrite();
      instance.setCreateTime(value);
      return this;
      }
    /**
     * <pre>
     * Output only. The creation timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    public Builder setCreateTime(
        com.google.protobuf.Timestamp.Builder builderForValue) {
      copyOnWrite();
      instance.setCreateTime(builderForValue.build());
      return this;
    }
    /**
     * <pre>
     * Output only. The creation timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    public Builder mergeCreateTime(com.google.protobuf.Timestamp value) {
      copyOnWrite();
      instance.mergeCreateTime(value);
      return this;
    }
    /**
     * <pre>
     * Output only. The creation timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    public Builder clearCreateTime() {  copyOnWrite();
      instance.clearCreateTime();
      return this;
    }

    /**
     * <pre>
     * Output only. The last update timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    @java.lang.Override
    public boolean hasUpdateTime() {
      return instance.hasUpdateTime();
    }
    /**
     * <pre>
     * Output only. The last update timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    @java.lang.Override
    public com.google.protobuf.Timestamp getUpdateTime() {
      return instance.getUpdateTime();
    }
    /**
     * <pre>
     * Output only. The last update timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    public Builder setUpdateTime(com.google.protobuf.Timestamp value) {
      copyOnWrite();
      instance.setUpdateTime(value);
      return this;
      }
    /**
     * <pre>
     * Output only. The last update timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    public Builder setUpdateTime(
        com.google.protobuf.Timestamp.Builder builderForValue) {
      copyOnWrite();
      instance.setUpdateTime(builderForValue.build());
      return this;
    }
    /**
     * <pre>
     * Output only. The last update timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) {
      copyOnWrite();
      instance.mergeUpdateTime(value);
      return this;
    }
    /**
     * <pre>
     * Output only. The last update timestamp of the metric.
     * This field may not be present for older metrics.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    public Builder clearUpdateTime() {  copyOnWrite();
      instance.clearUpdateTime();
      return this;
    }

    /**
     * <pre>
     * Deprecated. The API version that created or updated this metric.
     * The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
     * @return The enum numeric value on the wire for version.
     */
    @java.lang.Override
    @java.lang.Deprecated public int getVersionValue() {
      return instance.getVersionValue();
    }
    /**
     * <pre>
     * Deprecated. The API version that created or updated this metric.
     * The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
     * @param value The version to set.
     * @return This builder for chaining.
     */
    @java.lang.Deprecated public Builder setVersionValue(int value) {
      copyOnWrite();
      instance.setVersionValue(value);
      return this;
    }
    /**
     * <pre>
     * Deprecated. The API version that created or updated this metric.
     * The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
     * @return The version.
     */
    @java.lang.Override
    @java.lang.Deprecated public com.google.logging.v2.LogMetric.ApiVersion getVersion() {
      return instance.getVersion();
    }
    /**
     * <pre>
     * Deprecated. The API version that created or updated this metric.
     * The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
     * @param value The enum numeric value on the wire for version to set.
     * @return This builder for chaining.
     */
    @java.lang.Deprecated public Builder setVersion(com.google.logging.v2.LogMetric.ApiVersion value) {
      copyOnWrite();
      instance.setVersion(value);
      return this;
    }
    /**
     * <pre>
     * Deprecated. The API version that created or updated this metric.
     * The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code>
     * @return This builder for chaining.
     */
    @java.lang.Deprecated public Builder clearVersion() {
      copyOnWrite();
      instance.clearVersion();
      return this;
    }

    // @@protoc_insertion_point(builder_scope:google.logging.v2.LogMetric)
  }
  @java.lang.Override
  @java.lang.SuppressWarnings({"unchecked", "fallthrough"})
  protected final java.lang.Object dynamicMethod(
      com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
      java.lang.Object arg0, java.lang.Object arg1) {
    switch (method) {
      case NEW_MUTABLE_INSTANCE: {
        return new com.google.logging.v2.LogMetric();
      }
      case NEW_BUILDER: {
        return new Builder();
      }
      case BUILD_MESSAGE_INFO: {
          java.lang.Object[] objects = new java.lang.Object[] {
            "name_",
            "description_",
            "filter_",
            "version_",
            "metricDescriptor_",
            "valueExtractor_",
            "labelExtractors_",
            LabelExtractorsDefaultEntryHolder.defaultEntry,
            "bucketOptions_",
            "createTime_",
            "updateTime_",
          };
          java.lang.String info =
              "\u0000\n\u0000\u0000\u0001\n\n\u0001\u0000\u0000\u0001\u0208\u0002\u0208\u0003\u0208" +
              "\u0004\f\u0005\t\u0006\u0208\u00072\b\t\t\t\n\t";
          return newMessageInfo(DEFAULT_INSTANCE, info, objects);
      }
      // fall through
      case GET_DEFAULT_INSTANCE: {
        return DEFAULT_INSTANCE;
      }
      case GET_PARSER: {
        com.google.protobuf.Parser<com.google.logging.v2.LogMetric> parser = PARSER;
        if (parser == null) {
          synchronized (com.google.logging.v2.LogMetric.class) {
            parser = PARSER;
            if (parser == null) {
              parser =
                  new DefaultInstanceBasedParser<com.google.logging.v2.LogMetric>(
                      DEFAULT_INSTANCE);
              PARSER = parser;
            }
          }
        }
        return parser;
    }
    case GET_MEMOIZED_IS_INITIALIZED: {
      return (byte) 1;
    }
    case SET_MEMOIZED_IS_INITIALIZED: {
      return null;
    }
    }
    throw new UnsupportedOperationException();
  }


  // @@protoc_insertion_point(class_scope:google.logging.v2.LogMetric)
  private static final com.google.logging.v2.LogMetric DEFAULT_INSTANCE;
  static {
    LogMetric defaultInstance = new LogMetric();
    // New instances are implicitly immutable so no need to make
    // immutable.
    DEFAULT_INSTANCE = defaultInstance;
    com.google.protobuf.GeneratedMessageLite.registerDefaultInstance(
      LogMetric.class, defaultInstance);
  }

  public static com.google.logging.v2.LogMetric getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static volatile com.google.protobuf.Parser<LogMetric> PARSER;

  public static com.google.protobuf.Parser<LogMetric> parser() {
    return DEFAULT_INSTANCE.getParserForType();
  }
}

