Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Sampling Result names #1655

Closed
wants to merge 9 commits into from
10 changes: 1 addition & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,7 @@ It does not support all required rules, so you still have to run `googleJavaForm
Javadoc, though the style of documentation is up to the author.
* Try to do the least amount of change when modifying existing documentation.
Don't change the style unless you have a good reason.

``` sh
$ git checkout -b docs
$ ./gradlew javadoc
$ rm -fr docs/*
$ cp -R api/build/docs/javadoc/* docs
$ git add -A .
$ git commit -m "Update javadoc for API."
```
* Our javadoc is available via [javadoc.io}(https://javadoc.io/doc/io.opentelemetry/opentelemetry-api)

### AutoValue

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This project contains the following top level components:
* [sdk](sdk/): The reference implementation complying to the OpenTelemetry API.
* [sdk_extensions](sdk_extensions/): Additional extensions to SDK.
* [OpenTracing shim](opentracing_shim/): A bridge layer from OpenTelemetry to the OpenTracing API.
* [Examples](examples/): Various examples on how to use the APIs, SDK, and standard exporters.

We would love to hear from the larger community: please provide feedback proactively.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public SamplingResult shouldSample(
List<Link> parentLinks) {
// We sample only if the Span name contains "SAMPLE"
return Samplers.emptySamplingResult(
name.contains("SAMPLE") ? Decision.RECORD_AND_SAMPLED : Decision.NOT_RECORD);
name.contains("SAMPLE") ? Decision.RECORD_AND_SAMPLE : Decision.DROP);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public final class OpenTelemetrySdk {
* Returns a {@link TracerSdkProvider}.
*
* @return TracerProvider returned by {@link OpenTelemetry#getTracerProvider()}.
* @since 0.1.0
*/
public static TracerSdkProvider getTracerProvider() {
return (TracerSdkProvider) ((Obfuscated<?>) OpenTelemetry.getTracerProvider()).unobfuscate();
Expand All @@ -48,7 +47,6 @@ public static TracerSdkProvider getTracerProvider() {
* Returns a {@link MeterSdkProvider}.
*
* @return MeterProvider returned by {@link OpenTelemetry#getMeterProvider()}.
* @since 0.1.0
*/
public static MeterSdkProvider getMeterProvider() {
return (MeterSdkProvider) OpenTelemetry.getMeterProvider();
Expand All @@ -58,7 +56,6 @@ public static MeterSdkProvider getMeterProvider() {
* Returns a {@link CorrelationContextManagerSdk}.
*
* @return context manager returned by {@link OpenTelemetry#getCorrelationContextManager()}.
* @since 0.1.0
*/
public static CorrelationContextManagerSdk getCorrelationContextManager() {
return (CorrelationContextManagerSdk) OpenTelemetry.getCorrelationContextManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@

package io.opentelemetry.sdk.common;

/**
* Interface for getting the current time.
*
* @since 0.1.0
*/
/** Interface for getting the current time. */
public interface Clock {
/**
* Obtains the current epoch timestamp in nanos from this clock.
*
* @return the current epoch timestamp in nanos.
* @since 0.1.0
*/
long now();

Expand All @@ -36,7 +31,6 @@ public interface Clock {
*
* @return a time measurement with nanosecond precision that can only be used to calculate elapsed
* time.
* @since 0.1.0
*/
long nanoTime();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;

/**
* A mutable {@link Clock} that allows the time to be set for testing.
*
* @since 0.1.0
*/
/** A mutable {@link Clock} that allows the time to be set for testing. */
@ThreadSafe
public class TestClock implements Clock {

Expand All @@ -40,7 +36,6 @@ private TestClock(long epochNanos) {
* Creates a clock initialized to a constant non-zero time.
*
* @return a clock initialized to a constant non-zero time.
* @since 0.1.0
*/
public static TestClock create() {
// Set Time to Tuesday, May 7, 2019 12:00:00 AM GMT-07:00 DST
Expand All @@ -52,7 +47,6 @@ public static TestClock create() {
*
* @param epochNanos the initial time in nanos since epoch.
* @return a new {@code TestClock} with the given time.
* @since 0.1.0
*/
public static TestClock create(long epochNanos) {
return new TestClock(epochNanos);
Expand All @@ -62,7 +56,6 @@ public static TestClock create(long epochNanos) {
* Sets the time.
*
* @param epochNanos the new time.
* @since 0.1.0
*/
public synchronized void setTime(long epochNanos) {
currentEpochNanos = epochNanos;
Expand All @@ -72,7 +65,6 @@ public synchronized void setTime(long epochNanos) {
* Advances the time by millis and mutates this instance.
*
* @param millis the increase in time.
* @since 0.1.0
*/
public synchronized void advanceMillis(long millis) {
long nanos = TimeUnit.MILLISECONDS.toNanos(millis);
Expand All @@ -83,7 +75,6 @@ public synchronized void advanceMillis(long millis) {
* Advances the time by nanos and mutates this instance.
*
* @param nanos the increase in time.
* @since 0.1.0
*/
public synchronized void advanceNanos(long nanos) {
currentEpochNanos += nanos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
/**
* Provides a framework for detection of resource information from the environment variable
* "OTEL_RESOURCE_ATTRIBUTES" and system properties "otel.resource.attributes".
*
* @since 0.1.0
*/
@ThreadSafe
final class EnvAutodetectResource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
/**
* {@link Resource} represents a resource, which capture identifying information about the entities
* for which signals (stats or traces) are reported.
*
* @since 0.1.0
*/
@Immutable
@AutoValue
Expand Down Expand Up @@ -96,7 +94,6 @@ private static Resource readResourceFromProviders() {
* Returns an empty {@link Resource}.
*
* @return an empty {@code Resource}.
* @since 0.1.0
*/
public static Resource getEmpty() {
return EMPTY;
Expand All @@ -106,7 +103,6 @@ public static Resource getEmpty() {
* Returns the telemetry sdk {@link Resource}.
*
* @return a {@code Resource} with telemetry sdk attributes.
* @since 0.6.0
*/
public static Resource getTelemetrySdk() {
return TELEMETRY_SDK;
Expand All @@ -116,7 +112,6 @@ public static Resource getTelemetrySdk() {
* Returns a map of attributes that describe the resource.
*
* @return a map of attributes.
* @since 0.1.0
*/
public abstract ReadableAttributes getAttributes();

Expand All @@ -132,7 +127,6 @@ public static Resource getTelemetrySdk() {
* @throws NullPointerException if {@code attributes} is null.
* @throws IllegalArgumentException if attribute key or attribute value is not a valid printable
* ASCII string or exceed {@link #MAX_LENGTH} characters.
* @since 0.1.0
*/
public static Resource create(Attributes attributes) {
checkAttributes(Objects.requireNonNull(attributes, "attributes"));
Expand All @@ -155,7 +149,6 @@ public static Resource getDefault() {
*
* @param other the {@code Resource} that will be merged with {@code this}.
* @return the newly merged {@code Resource}.
* @since 0.1.0
*/
public Resource merge(@Nullable Resource other) {
if (other == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

// Basic registry class for metrics instruments. The current implementation allows instruments to be
// registered only once for a given name.
//
// TODO: Discuss what is the right behavior when an already registered Instrument with the same name
// is present.
// TODO: Decide what is the identifier for an Instrument? Only name?
/**
* Basic registry class for metrics instruments. The current implementation allows instruments to be
* registered only once for a given name.
*
* <p>TODO: Discuss what is the right behavior when an already registered Instrument with the same
* name is present. TODO: Decide what is the identifier for an Instrument? Only name?
*/
final class InstrumentRegistry {
private final ConcurrentMap<String, AbstractInstrument> registry = new ConcurrentHashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ public static Builder builder() {
/**
* Builder class for the {@link MeterSdkProvider}. Has fully functional default implementations of
* all three required interfaces.
*
* @since 0.4.0
*/
public static final class Builder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

/**
* A {@link MetricData} represents the data exported as part of aggregating one {@code Instrument}.
*
* @since 0.1.0
*/
@Immutable
@AutoValue
Expand All @@ -38,15 +36,13 @@ public abstract class MetricData {
* Returns the {@link Descriptor} of this metric.
*
* @return the {@code Descriptor} of this metric.
* @since 0.1.0
*/
public abstract Descriptor getDescriptor();

/**
* Returns the resource of this {@code MetricData}.
*
* @return the resource of this {@code MetricData}.
* @since 0.1.0
*/
public abstract Resource getResource();

Expand All @@ -65,7 +61,6 @@ public abstract class MetricData {
* is determined by the {@link Descriptor.Type}.
*
* @return the data {@link Point}s for this metric, or empty {@code Collection} if no points.
* @since 0.3.0
*/
public abstract Collection<Point> getPoints();

Expand All @@ -86,7 +81,6 @@ public abstract static class Point {
* the metric was created or an aggregation was enabled.
*
* @return the start epoch timestamp in nanos.
* @since 0.3.0
*/
public abstract long getStartEpochNanos();

Expand All @@ -95,7 +89,6 @@ public abstract static class Point {
* moment when {@code Instrument.getData()} was called.
*
* @return the epoch timestamp in nanos.
* @since 0.3.0
*/
public abstract long getEpochNanos();

Expand Down Expand Up @@ -221,50 +214,26 @@ public static ValueAtPercentile create(double percentile, double value) {
}
}

/**
* {@link Descriptor} defines metadata about the {@code MetricData} type and its schema.
*
* @since 0.1.0
*/
/** {@link Descriptor} defines metadata about the {@code MetricData} type and its schema. */
@Immutable
@AutoValue
public abstract static class Descriptor {

Descriptor() {}

/**
* The kind of metric. It describes how the data is reported.
*
* @since 0.1.0
*/
/** The kind of metric. It describes how the data is reported. */
public enum Type {

/**
* An instantaneous measurement of a long (int64) value. Reports {@link LongPoint} points.
*
* @since 0.1.0
*/
/** An instantaneous measurement of a long (int64) value. Reports {@link LongPoint} points. */
NON_MONOTONIC_LONG,

/**
* An instantaneous measurement of a double value. Reports {@link DoublePoint} points.
*
* @since 0.1.0
*/
/** An instantaneous measurement of a double value. Reports {@link DoublePoint} points. */
NON_MONOTONIC_DOUBLE,

/**
* An cumulative measurement of an long (int64) value. Reports {@link LongPoint} points.
*
* @since 0.1.0
*/
/** An cumulative measurement of an long (int64) value. Reports {@link LongPoint} points. */
MONOTONIC_LONG,

/**
* An cumulative measurement of a double value. Reports {@link DoublePoint} points.
*
* @since 0.1.0
*/
/** An cumulative measurement of a double value. Reports {@link DoublePoint} points. */
MONOTONIC_DOUBLE,

/**
Expand All @@ -279,39 +248,34 @@ public enum Type {
* Returns the metric descriptor name.
*
* @return the metric descriptor name.
* @since 0.1.0
*/
public abstract String getName();

/**
* Returns the description of this metric descriptor.
*
* @return the description of this metric descriptor.
* @since 0.1.0
*/
public abstract String getDescription();

/**
* Returns the unit of this metric descriptor.
*
* @return the unit of this metric descriptor.
* @since 0.1.0
*/
public abstract String getUnit();

/**
* Returns the type of this metric descriptor.
*
* @return the type of this metric descriptor.
* @since 0.1.0
*/
public abstract Type getType();

/**
* Returns the constant labels associated with this metric descriptor.
*
* @return the constant labels associated with this metric descriptor.
* @since 0.1.0
*/
public abstract Labels getConstantLabels();

Expand Down
Loading