/** * <pre> * A detailed description of the metric, which can be used in documentation. * </pre> * * <code>string description = 6;</code> */ public Builder clearDescription() { description_ = getDefaultInstance().getDescription(); onChanged(); return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + getType().hashCode(); if (getLabelsCount() > 0) { hash = (37 * hash) + LABELS_FIELD_NUMBER; hash = (53 * hash) + getLabelsList().hashCode(); } hash = (37 * hash) + METRIC_KIND_FIELD_NUMBER; hash = (53 * hash) + metricKind_; hash = (37 * hash) + VALUE_TYPE_FIELD_NUMBER; hash = (53 * hash) + valueType_; hash = (37 * hash) + UNIT_FIELD_NUMBER; hash = (53 * hash) + getUnit().hashCode(); hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getDescription().hashCode(); hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; hash = (53 * hash) + getDisplayName().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.api.MetricDescriptor)) { return super.equals(obj); } com.google.api.MetricDescriptor other = (com.google.api.MetricDescriptor) obj; boolean result = true; result = result && getName() .equals(other.getName()); result = result && getType() .equals(other.getType()); result = result && getLabelsList() .equals(other.getLabelsList()); result = result && metricKind_ == other.metricKind_; result = result && valueType_ == other.valueType_; result = result && getUnit() .equals(other.getUnit()); result = result && getDescription() .equals(other.getDescription()); result = result && getDisplayName() .equals(other.getDisplayName()); return result; }
onChanged(); if (!other.getDescription().isEmpty()) { description_ = other.description_; onChanged();
@Test public void createMetricDescriptor_cumulative() { MetricDescriptor metricDescriptor = StackdriverExportUtils.createMetricDescriptor( METRIC_DESCRIPTOR_2, PROJECT_ID, CUSTOM_OPENCENSUS_DOMAIN, DEFAULT_DISPLAY_NAME_PREFIX); assertThat(metricDescriptor.getName()) .isEqualTo( "projects/" + PROJECT_ID + "/metricDescriptors/custom.googleapis.com/opencensus/" + METRIC_NAME); assertThat(metricDescriptor.getDescription()).isEqualTo(METRIC_DESCRIPTION); assertThat(metricDescriptor.getDisplayName()).isEqualTo("OpenCensus/" + METRIC_NAME); assertThat(metricDescriptor.getType()) .isEqualTo("custom.googleapis.com/opencensus/" + METRIC_NAME); assertThat(metricDescriptor.getUnit()).isEqualTo("1"); assertThat(metricDescriptor.getMetricKind()).isEqualTo(MetricKind.CUMULATIVE); assertThat(metricDescriptor.getValueType()).isEqualTo(MetricDescriptor.ValueType.INT64); assertThat(metricDescriptor.getLabelsList()) .containsExactly( LabelDescriptor.newBuilder() .setKey(StackdriverExportUtils.OPENCENSUS_TASK) .setDescription(StackdriverExportUtils.OPENCENSUS_TASK_DESCRIPTION) .setValueType(ValueType.STRING) .build()); }
@Test public void createMetricDescriptor() { MetricDescriptor metricDescriptor = StackdriverExportUtils.createMetricDescriptor( METRIC_DESCRIPTOR, PROJECT_ID, "custom.googleapis.com/myorg/", "myorg/"); assertThat(metricDescriptor.getName()) .isEqualTo( "projects/" + PROJECT_ID + "/metricDescriptors/custom.googleapis.com/myorg/" + METRIC_NAME); assertThat(metricDescriptor.getDescription()).isEqualTo(METRIC_DESCRIPTION); assertThat(metricDescriptor.getDisplayName()).isEqualTo("myorg/" + METRIC_NAME); assertThat(metricDescriptor.getType()).isEqualTo("custom.googleapis.com/myorg/" + METRIC_NAME); assertThat(metricDescriptor.getUnit()).isEqualTo(METRIC_UNIT); assertThat(metricDescriptor.getMetricKind()).isEqualTo(MetricKind.CUMULATIVE); assertThat(metricDescriptor.getValueType()).isEqualTo(MetricDescriptor.ValueType.DOUBLE); assertThat(metricDescriptor.getLabelsList()) .containsExactly( LabelDescriptor.newBuilder() .setKey(LABEL_KEY.get(0).getKey()) .setDescription(LABEL_KEY.get(0).getDescription()) .setValueType(ValueType.STRING) .build(), LabelDescriptor.newBuilder() .setKey(StackdriverExportUtils.OPENCENSUS_TASK) .setDescription(StackdriverExportUtils.OPENCENSUS_TASK_DESCRIPTION) .setValueType(ValueType.STRING) .build()); }
MessageLocationContext.create(metric, MetricDescriptor.DESCRIPTION_FIELD_NUMBER), "metric description", metric.getDescription());
MessageLocationContext.create(metric, MetricDescriptor.DESCRIPTION_FIELD_NUMBER), "metric description", metric.getDescription());