Skip to content

Commit bce291c

Browse files
Praful Makanichingor13
authored andcommitted
---
yaml --- r: 11699 b: refs/heads/autosynth-pubsub c: f5c0394 h: refs/heads/master i: 11697: 3ee181e 11695: 49cb14c
1 parent 6a1c941 commit bce291c

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
@@ -116,7 +116,7 @@ refs/heads/autosynth-compute: fa508ebab5b6a1db14949441c8de868cefbcf1a6
116116
refs/heads/autosynth-container: d0346e84b1f26e3dc10444450a998f357a43bcef
117117
refs/heads/autosynth-dataproc: c0f21dd811166848a60f810565a5614bb9c7f47e
118118
refs/heads/autosynth-monitoring: 28bf7ca67c0aab4815884e5d6253aaa8aa3baa1c
119-
refs/heads/autosynth-pubsub: cafd7474e37951bcfaf4d81fa9727a6ce74455ce
119+
refs/heads/autosynth-pubsub: f5c03944b5628d53edfcd65b504deacc6fe002a9
120120
refs/heads/autosynth-video-intelligence: 06fb1841ae847f4ef79a62ba995efbabc213edf8
121121
refs/heads/autosynth-vision: 6bece1ee6c1c41d5822c72bf0d6a82484166b402
122122
refs/heads/spanner: 54a5e197bfe0a004e13c190427f46c3413ab572d

branches/autosynth-pubsub/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-pubsub/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)