-
Notifications
You must be signed in to change notification settings - Fork 774
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on building test asset (#4389)
- Loading branch information
1 parent
db8ec73
commit 5a87234
Showing
2 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
sdk/testing/src/main/java/io/opentelemetry/sdk/testing/metrics/TestMetricData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package io.opentelemetry.sdk.testing.metrics; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import io.opentelemetry.sdk.common.InstrumentationScopeInfo; | ||
import io.opentelemetry.sdk.metrics.data.Data; | ||
import io.opentelemetry.sdk.metrics.data.MetricData; | ||
import io.opentelemetry.sdk.metrics.data.MetricDataType; | ||
import io.opentelemetry.sdk.resources.Resource; | ||
import javax.annotation.concurrent.Immutable; | ||
|
||
@Immutable | ||
@AutoValue | ||
public abstract class TestMetricData implements MetricData { | ||
public static Builder builder() { | ||
//TODO: Need to figure out how to set the Data value | ||
return new AutoValue_TestMetricData.Builder() | ||
.setResource(Resource.empty()) | ||
.setInstrumentationScopeInfo(InstrumentationScopeInfo.empty()) | ||
.setDescription("") | ||
.setUnit("1") | ||
.setType(MetricDataType.DOUBLE_GAUGE); | ||
} | ||
|
||
/** A builder for {@link TestMetricData}. */ | ||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
abstract TestMetricData autoBuild(); | ||
|
||
/** | ||
* Builds and returns a new {@link MetricData} instance from the data in {@code this} | ||
* | ||
* @return a new {@link MetricData} instance | ||
*/ | ||
public TestMetricData build() { | ||
return autoBuild(); | ||
} | ||
|
||
/** | ||
* Sets the resource of the metric | ||
* | ||
* @param resource the resource of the metric | ||
* @return this | ||
*/ | ||
public abstract Builder setResource(Resource resource); | ||
|
||
/** | ||
* Sets the name of the metric | ||
* | ||
* @param name the name of the metric | ||
* @return this | ||
*/ | ||
public abstract Builder setName(String name); | ||
|
||
/** | ||
* Sets the description of the metric | ||
* | ||
* @param description the description of the metric | ||
* @return this | ||
*/ | ||
public abstract Builder setDescription(String description); | ||
|
||
/** | ||
* Sets the unit of the metric | ||
* | ||
* @param unit the unit of the metric | ||
* @return this | ||
*/ | ||
public abstract Builder setUnit(String unit); | ||
|
||
/** | ||
* Sets the type of the metric | ||
* | ||
* @param type the type of the metric | ||
* @return this | ||
*/ | ||
public abstract Builder setType(MetricDataType type); | ||
|
||
/** | ||
* Sets the data of the metric | ||
* | ||
* @param data the data of the metric | ||
* @return this | ||
*/ | ||
public abstract Builder setData(Data<?> data); | ||
|
||
/** | ||
* Sets the Instrumentation scope of the metric | ||
* | ||
* @param instrumentationScopeInfo the instrumentation scope of the tracer which created this | ||
* metric. | ||
* @return this | ||
*/ | ||
public abstract Builder setInstrumentationScopeInfo( | ||
InstrumentationScopeInfo instrumentationScopeInfo); | ||
|
||
} | ||
|
||
} |