/** * * * <pre> * The value of the data point. * </pre> * * <code>.google.monitoring.v3.TypedValue value = 2;</code> */ public Builder setValue(com.google.monitoring.v3.TypedValue.Builder builderForValue) { if (valueBuilder_ == null) { value_ = builderForValue.build(); onChanged(); } else { valueBuilder_.setMessage(builderForValue.build()); } return this; } /**
com.google.monitoring.v3.TypedValue.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(value_); value_ = subBuilder.buildPartial();
/** * * * <pre> * A distribution value. * </pre> * * <code>.google.api.Distribution distribution_value = 5;</code> */ public com.google.api.Distribution.Builder getDistributionValueBuilder() { return getDistributionValueFieldBuilder().getBuilder(); } /**
subBuilder.mergeFrom(value_); value_ = subBuilder.buildPartial();
switch (other.getValueCase()) { case BOOL_VALUE: { setBoolValue(other.getBoolValue()); break; setInt64Value(other.getInt64Value()); break; setDoubleValue(other.getDoubleValue()); break; valueCase_ = 4; value_ = other.value_; onChanged(); break; mergeDistributionValue(other.getDistributionValue()); break; onChanged(); return this;
/** * <pre> * A distribution value. * </pre> * * <code>optional .google.api.Distribution distribution_value = 5;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.api.Distribution, com.google.api.Distribution.Builder, com.google.api.DistributionOrBuilder> getDistributionValueFieldBuilder() { if (distributionValueBuilder_ == null) { if (!(valueCase_ == 5)) { value_ = com.google.api.Distribution.getDefaultInstance(); } distributionValueBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.api.Distribution, com.google.api.Distribution.Builder, com.google.api.DistributionOrBuilder>( (com.google.api.Distribution) value_, getParentForChildren(), isClean()); value_ = null; } valueCase_ = 5; onChanged();; return distributionValueBuilder_; } public final Builder setUnknownFields(
/** * <pre> * The value of the data point. * </pre> * * <code>optional .google.monitoring.v3.TypedValue value = 2;</code> */ public Builder mergeValue(com.google.monitoring.v3.TypedValue value) { if (valueBuilder_ == null) { if (value_ != null) { value_ = com.google.monitoring.v3.TypedValue.newBuilder(value_).mergeFrom(value).buildPartial(); } else { value_ = value; } onChanged(); } else { valueBuilder_.mergeFrom(value); } return this; } /**
/** * <pre> * The value of the data point. * </pre> * * <code>optional .google.monitoring.v3.TypedValue value = 2;</code> */ public Builder setValue( com.google.monitoring.v3.TypedValue.Builder builderForValue) { if (valueBuilder_ == null) { value_ = builderForValue.build(); onChanged(); } else { valueBuilder_.setMessage(builderForValue.build()); } return this; } /**
TimeSeries createTimeSeries(Meter meter, double value, @Nullable String statistic) { return createTimeSeries(meter.getId(), TypedValue.newBuilder().setDoubleValue(value).build(), MetricDescriptor.ValueType.DOUBLE, statistic); }
public com.google.monitoring.v3.TypedValue build() { com.google.monitoring.v3.TypedValue result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
TimeSeries createTimeSeries(Meter meter, Distribution distribution) { return createTimeSeries(meter.getId(), TypedValue.newBuilder().setDistributionValue(distribution).build(), MetricDescriptor.ValueType.DISTRIBUTION, null); }
/** * <pre> * A distribution value. * </pre> * * <code>optional .google.api.Distribution distribution_value = 5;</code> */ public com.google.api.Distribution.Builder getDistributionValueBuilder() { return getDistributionValueFieldBuilder().getBuilder(); } /**
@java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /**
@Override public TypedValue apply(io.opencensus.metrics.export.Distribution arg) { TypedValue.Builder builder = TypedValue.newBuilder(); return builder.setDistributionValue(createDistribution(arg)).build(); } };
@Override public TypedValue apply(Long arg) { TypedValue.Builder builder = TypedValue.newBuilder(); builder.setInt64Value(arg); return builder.build(); } };
@Test public void createTypedValue_UnknownType() { assertThat(StackdriverExportUtils.createTypedValue(SUMMARY_VALUE)) .isEqualTo(TypedValue.newBuilder().build()); }
@Override public TypedValue apply(Summary arg) { TypedValue.Builder builder = TypedValue.newBuilder(); return builder.build(); } };
@Test public void createTypedValue() { assertThat(StackdriverExportUtils.createTypedValue(DOUBLE_VALUE)) .isEqualTo(TypedValue.newBuilder().setDoubleValue(1.1).build()); assertThat(StackdriverExportUtils.createTypedValue(LONG_VALUE)) .isEqualTo(TypedValue.newBuilder().setInt64Value(10000).build()); assertThat(StackdriverExportUtils.createTypedValue(DISTRIBUTION_VALUE)) .isEqualTo( TypedValue.newBuilder() .setDistributionValue(StackdriverExportUtils.createDistribution(DISTRIBUTION)) .build()); }
@Override public TypedValue apply(Double arg) { TypedValue.Builder builder = TypedValue.newBuilder(); builder.setDoubleValue(arg); return builder.build(); } };