Skip to content

Commit 601b4f0

Browse files
committed
add javadoc to public classes
1 parent 8ab8080 commit 601b4f0

File tree

5 files changed

+35
-4
lines changed

5 files changed

+35
-4
lines changed

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/AttributeKeys.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
*/
1616
package com.google.cloud.opentelemetry.detectors;
1717

18+
/**
19+
* Contains constants that act as keys for the known attributes for {@link
20+
* com.google.cloud.opentelemetry.detectors.GCPPlatformDetector.SupportedPlatform}s.
21+
*/
1822
public final class AttributeKeys {
1923
// GCE Attributes
2024
public static final String GCE_PROJECT_ID = AttributeKeys.PROJECT_ID;

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/DetectedPlatform.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,21 @@
1717

1818
import java.util.Map;
1919

20+
/** Represents a GCP specific platform on which a cloud application can run. */
2021
public interface DetectedPlatform {
22+
/**
23+
* Method to retrieve the underlying compute platform on which application is running.
24+
*
25+
* @return the {@link GCPPlatformDetector.SupportedPlatform} representing the Google Cloud
26+
* platform on which application is running.
27+
*/
2128
GCPPlatformDetector.SupportedPlatform getSupportedPlatform();
2229

30+
/**
31+
* Method to retrieve the attributes associated with the compute platform on which the application
32+
* is running as key-value pairs.
33+
*
34+
* @return a {@link Map} of attributes specific to the underlying compute platform.
35+
*/
2336
Map<String, String> getAttributes();
2437
}

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/GCPPlatformDetector.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ private GCPPlatformDetector() {
3232
this.environmentVariables = EnvironmentVariables.DEFAULT_INSTANCE;
3333
}
3434

35-
// Detects the GCP platform on which the application is running
35+
/**
36+
* Detects the GCP platform on which the application is running.
37+
*
38+
* @return the specific GCP platform on which the application is running.
39+
*/
3640
public DetectedPlatform detectPlatform() {
3741
return generateDetectedPlatform(detectSupportedPlatform());
3842
}
@@ -83,12 +87,22 @@ private DetectedPlatform generateDetectedPlatform(SupportedPlatform platform) {
8387
return detectedPlatform;
8488
}
8589

90+
/**
91+
* SupportedPlatform represents the GCP platforms that can currently be detected by the
92+
* resource-detector.
93+
*/
8694
public enum SupportedPlatform {
95+
/** Represents the Google Compute Engine platform. */
8796
GOOGLE_COMPUTE_ENGINE,
97+
/** Represents the Google Kubernetes Engine platform. */
8898
GOOGLE_KUBERNETES_ENGINE,
99+
/** Represents the Google App Engine platform. Could either be flex or standard. */
89100
GOOGLE_APP_ENGINE,
101+
/** Represents the Google Cloud Run platform. */
90102
GOOGLE_CLOUD_RUN,
103+
/** Represents the Google Cloud Functions platform. */
91104
GOOGLE_CLOUD_FUNCTIONS,
92-
UNKNOWN_PLATFORM, // Not running on GCP
105+
/** Represents the case when the application is not running on GCP. */
106+
UNKNOWN_PLATFORM,
93107
}
94108
}

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/GoogleKubernetesEngine.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.Map;
3131
import java.util.Optional;
3232

33-
/** Utility class to help add GKE specific attributes to a given resource */
3433
final class GoogleKubernetesEngine implements DetectedPlatform {
3534
private final EnvironmentVariables environmentVariables;
3635
private final GCPMetadataConfig metadataConfig;

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/GoogleServerlessCompute.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
import java.util.Map;
2121

2222
/**
23-
* Utility class to help add attributes applicable to serverless compute in GCP to a given resource.
23+
* GoogleServerlessCompute adds attributes applicable to all serverless compute platforms in GCP.
24+
* Currently, this includes Google Cloud Functions & Google Cloud Run.
2425
*/
2526
abstract class GoogleServerlessCompute implements DetectedPlatform {
2627
private final EnvironmentVariables environmentVariables;

0 commit comments

Comments
 (0)