Skip to content

Commit 791be6a

Browse files
Praful Makanichingor13
authored andcommitted
---
yaml --- r: 11539 b: refs/heads/autosynth-dataproc c: f5c0394 h: refs/heads/master i: 11537: 0d3275a 11535: de393a6
1 parent 53bd2be commit 791be6a

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ refs/tags/v0.66.0: ed6a3f57cbdaa20339a1995f7d7d53b172a5b8ef
114114
refs/tags/v0.67.0: 30b56f02092efc6f3c3667650ea8b8825003e0b7
115115
refs/heads/autosynth-compute: fa508ebab5b6a1db14949441c8de868cefbcf1a6
116116
refs/heads/autosynth-container: d0346e84b1f26e3dc10444450a998f357a43bcef
117-
refs/heads/autosynth-dataproc: cafd7474e37951bcfaf4d81fa9727a6ce74455ce
117+
refs/heads/autosynth-dataproc: f5c03944b5628d53edfcd65b504deacc6fe002a9
118118
refs/heads/autosynth-monitoring: 2cb98362409ff765ae26032b64bc84191cdc6dda
119119
refs/heads/autosynth-pubsub: 957d781d8d170777a53a948cd958e368a96eacd5
120120
refs/heads/autosynth-video-intelligence: 06fb1841ae847f4ef79a62ba995efbabc213edf8

branches/autosynth-dataproc/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/MetadataConfig.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ public static String getClusterName() {
5757
return getAttribute("instance/attributes/cluster-name");
5858
}
5959

60+
public static String getContainerName(){
61+
return getAttribute("instance/attributes/container-name");
62+
}
63+
64+
public static String getNamespaceId(){
65+
return getAttribute("instance/attributes/namespace-id");
66+
}
67+
6068
public static String getAttribute(String attributeName) {
6169
try {
6270
URL url = new URL(METADATA_URL + attributeName);

branches/autosynth-dataproc/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/MonitoredResourceUtil.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ public class MonitoredResourceUtil {
3838
private enum Label {
3939
AppId("app_id"),
4040
ClusterName("cluster_name"),
41+
ContainerName("container_name"),
4142
InstanceId("instance_id"),
4243
InstanceName("instance_name"),
4344
ModuleId("module_id"),
45+
NamespaceId("namespace_id"),
4446
PodId("pod_id"),
4547
ProjectId("project_id"),
4648
VersionId("version_id"),
@@ -84,7 +86,9 @@ String getKey() {
8486
.putAll(
8587
Resource.Container.getKey(),
8688
Label.ClusterName,
89+
Label.ContainerName,
8790
Label.InstanceId,
91+
Label.NamespaceId,
8892
Label.PodId,
8993
Label.Zone)
9094
.putAll(Resource.GceInstance.getKey(), Label.InstanceId, Label.Zone)
@@ -135,6 +139,9 @@ private static String getValue(Label label) {
135139
case ClusterName:
136140
value = MetadataConfig.getClusterName();
137141
break;
142+
case ContainerName:
143+
value = MetadataConfig.getContainerName();
144+
break;
138145
case InstanceId:
139146
value = MetadataConfig.getInstanceId();
140147
break;
@@ -144,6 +151,9 @@ private static String getValue(Label label) {
144151
case ModuleId:
145152
value = getAppEngineModuleId();
146153
break;
154+
case NamespaceId:
155+
value = MetadataConfig.getNamespaceId();
156+
break;
147157
case PodId:
148158
value = System.getenv("HOSTNAME");
149159
break;

0 commit comments

Comments
 (0)