-
Notifications
You must be signed in to change notification settings - Fork 858
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make MetricData factories internal (#4257)
- v1.46.0
- v1.45.0
- v1.44.1
- v1.44.0
- v1.43.0
- v1.42.1
- v1.42.0
- v1.41.0
- v1.40.0
- v1.39.0
- v1.38.0
- v1.37.0
- v1.36.0
- v1.35.0
- v1.34.1
- v1.34.0
- v1.33.0
- v1.32.0
- v1.31.0
- v1.30.1
- v1.30.0
- v1.29.0
- v1.28.0
- v1.27.0
- v1.26.0
- v1.25.0
- v1.24.0
- v1.23.1
- v1.23.0
- v1.22.0
- v1.21.0
- v1.20.1
- v1.20.0
- v1.19.0
- v1.18.0
- v1.17.0
- v1.16.0
- v1.15.0
- v1.14.0
- v1.13.0
Showing
29 changed files
with
321 additions
and
279 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
30 changes: 0 additions & 30 deletions
30
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/data/MetricDataImpl.java
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
201 changes: 201 additions & 0 deletions
201
...metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/data/ImmutableMetricData.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,201 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.metrics.internal.data; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo; | ||
import io.opentelemetry.sdk.metrics.data.Data; | ||
import io.opentelemetry.sdk.metrics.data.DoublePointData; | ||
import io.opentelemetry.sdk.metrics.data.GaugeData; | ||
import io.opentelemetry.sdk.metrics.data.HistogramData; | ||
import io.opentelemetry.sdk.metrics.data.LongPointData; | ||
import io.opentelemetry.sdk.metrics.data.MetricData; | ||
import io.opentelemetry.sdk.metrics.data.MetricDataType; | ||
import io.opentelemetry.sdk.metrics.data.SumData; | ||
import io.opentelemetry.sdk.metrics.data.SummaryData; | ||
import io.opentelemetry.sdk.metrics.internal.data.exponentialhistogram.ExponentialHistogramData; | ||
import io.opentelemetry.sdk.resources.Resource; | ||
import javax.annotation.concurrent.Immutable; | ||
|
||
/** | ||
* A container of metrics. | ||
* | ||
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change | ||
* at any time. | ||
*/ | ||
@Immutable | ||
@AutoValue | ||
public abstract class ImmutableMetricData implements MetricData { | ||
|
||
/** | ||
* Returns a new MetricData wih a {@link MetricDataType#DOUBLE_GAUGE} type. | ||
* | ||
* @return a new MetricData wih a {@link MetricDataType#DOUBLE_GAUGE} type. | ||
*/ | ||
public static MetricData createDoubleGauge( | ||
Resource resource, | ||
InstrumentationLibraryInfo instrumentationLibraryInfo, | ||
String name, | ||
String description, | ||
String unit, | ||
GaugeData<DoublePointData> data) { | ||
return create( | ||
resource, | ||
instrumentationLibraryInfo, | ||
name, | ||
description, | ||
unit, | ||
MetricDataType.DOUBLE_GAUGE, | ||
data); | ||
} | ||
|
||
/** | ||
* Returns a new MetricData wih a {@link MetricDataType#LONG_GAUGE} type. | ||
* | ||
* @return a new MetricData wih a {@link MetricDataType#LONG_GAUGE} type. | ||
*/ | ||
public static MetricData createLongGauge( | ||
Resource resource, | ||
InstrumentationLibraryInfo instrumentationLibraryInfo, | ||
String name, | ||
String description, | ||
String unit, | ||
GaugeData<LongPointData> data) { | ||
return create( | ||
resource, | ||
instrumentationLibraryInfo, | ||
name, | ||
description, | ||
unit, | ||
MetricDataType.LONG_GAUGE, | ||
data); | ||
} | ||
|
||
/** | ||
* Returns a new MetricData wih a {@link MetricDataType#DOUBLE_SUM} type. | ||
* | ||
* @return a new MetricData wih a {@link MetricDataType#DOUBLE_SUM} type. | ||
*/ | ||
public static MetricData createDoubleSum( | ||
Resource resource, | ||
InstrumentationLibraryInfo instrumentationLibraryInfo, | ||
String name, | ||
String description, | ||
String unit, | ||
SumData<DoublePointData> data) { | ||
return create( | ||
resource, | ||
instrumentationLibraryInfo, | ||
name, | ||
description, | ||
unit, | ||
MetricDataType.DOUBLE_SUM, | ||
data); | ||
} | ||
|
||
/** | ||
* Returns a new MetricData wih a {@link MetricDataType#LONG_SUM} type. | ||
* | ||
* @return a new MetricData wih a {@link MetricDataType#LONG_SUM} type. | ||
*/ | ||
public static MetricData createLongSum( | ||
Resource resource, | ||
InstrumentationLibraryInfo instrumentationLibraryInfo, | ||
String name, | ||
String description, | ||
String unit, | ||
SumData<LongPointData> data) { | ||
return create( | ||
resource, | ||
instrumentationLibraryInfo, | ||
name, | ||
description, | ||
unit, | ||
MetricDataType.LONG_SUM, | ||
data); | ||
} | ||
|
||
/** | ||
* Returns a new MetricData wih a {@link MetricDataType#SUMMARY} type. | ||
* | ||
* @return a new MetricData wih a {@link MetricDataType#SUMMARY} type. | ||
*/ | ||
public static MetricData createDoubleSummary( | ||
Resource resource, | ||
InstrumentationLibraryInfo instrumentationLibraryInfo, | ||
String name, | ||
String description, | ||
String unit, | ||
SummaryData data) { | ||
return create( | ||
resource, | ||
instrumentationLibraryInfo, | ||
name, | ||
description, | ||
unit, | ||
MetricDataType.SUMMARY, | ||
data); | ||
} | ||
|
||
/** | ||
* Returns a new MetricData with a {@link MetricDataType#HISTOGRAM} type. | ||
* | ||
* @return a new MetricData wih a {@link MetricDataType#HISTOGRAM} type. | ||
*/ | ||
public static MetricData createDoubleHistogram( | ||
Resource resource, | ||
InstrumentationLibraryInfo instrumentationLibraryInfo, | ||
String name, | ||
String description, | ||
String unit, | ||
HistogramData data) { | ||
return create( | ||
resource, | ||
instrumentationLibraryInfo, | ||
name, | ||
description, | ||
unit, | ||
MetricDataType.HISTOGRAM, | ||
data); | ||
} | ||
|
||
/** | ||
* Returns a new MetricData with a {@link MetricDataType#EXPONENTIAL_HISTOGRAM} type. | ||
* | ||
* @return a new MetricData wih a {@link MetricDataType#EXPONENTIAL_HISTOGRAM} type. | ||
*/ | ||
public static MetricData createExponentialHistogram( | ||
Resource resource, | ||
InstrumentationLibraryInfo instrumentationLibraryInfo, | ||
String name, | ||
String description, | ||
String unit, | ||
ExponentialHistogramData data) { | ||
return create( | ||
resource, | ||
instrumentationLibraryInfo, | ||
name, | ||
description, | ||
unit, | ||
MetricDataType.EXPONENTIAL_HISTOGRAM, | ||
data); | ||
} | ||
|
||
// Visible for testing | ||
static ImmutableMetricData create( | ||
Resource resource, | ||
InstrumentationLibraryInfo instrumentationLibraryInfo, | ||
String name, | ||
String description, | ||
String unit, | ||
MetricDataType type, | ||
Data<?> data) { | ||
return new AutoValue_ImmutableMetricData( | ||
resource, instrumentationLibraryInfo, name, description, unit, type, data); | ||
} | ||
|
||
ImmutableMetricData() {} | ||
} |
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
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
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