Skip to content

Commit 98c54cb

Browse files
Praful Makanichingor13
authored andcommitted
---
yaml --- r: 12005 b: refs/heads/autosynth-containeranalysis c: f5c0394 h: refs/heads/master i: 12003: 33e38f5
1 parent 45dfc3b commit 98c54cb

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
@@ -128,7 +128,7 @@ refs/heads/autosynth-bigquerydatatransfer: 2a9f3938237f85a8919602d74011326580ff3
128128
refs/heads/autosynth-bigquerystorage: 99aee05df348f39d98b6fb23c292006f1d2a6c28
129129
refs/heads/autosynth-bigtable: cd831a28dff2ba4d733608b871a1523a463e7380
130130
refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
131-
refs/heads/autosynth-containeranalysis: cafd7474e37951bcfaf4d81fa9727a6ce74455ce
131+
refs/heads/autosynth-containeranalysis: f5c03944b5628d53edfcd65b504deacc6fe002a9
132132
refs/heads/autosynth-datastore: 02c91de76764225070df7e64314c25b865cf7af8
133133
refs/heads/autosynth-dialogflow: c6bde02c8a8e063a32f9eaf63b2b9fe5e4895d8a
134134
refs/heads/autosynth-errorreporting: 518a442405c822492ed1c139e89e3e3d1804e29c

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