Skip to content

Commit a5179f0

Browse files
Praful Makanichingor13
authored andcommitted
---
yaml --- r: 11947 b: refs/heads/autosynth-bigtable c: f5c0394 h: refs/heads/master i: 11945: 3f5f3c9 11943: 1311468
1 parent fe91e0b commit a5179f0

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
@@ -126,7 +126,7 @@ refs/heads/autosynth-asset: af3772eb76acbfc401f7c3f9310f09f2b0e17602
126126
refs/heads/autosynth-automl: 8c05f2af9d8bcf10536f8255093c2484bfe9243c
127127
refs/heads/autosynth-bigquerydatatransfer: 2a9f3938237f85a8919602d74011326580ff387f
128128
refs/heads/autosynth-bigquerystorage: 99aee05df348f39d98b6fb23c292006f1d2a6c28
129-
refs/heads/autosynth-bigtable: cafd7474e37951bcfaf4d81fa9727a6ce74455ce
129+
refs/heads/autosynth-bigtable: f5c03944b5628d53edfcd65b504deacc6fe002a9
130130
refs/heads/autosynth-bigtable-admin: 3cd9cc8e61a8a8e02cbdfc4a1c1adb95e4103555
131131
refs/heads/autosynth-containeranalysis: 963746c85ab8171d519059a6be1b74015e453bbf
132132
refs/heads/autosynth-datastore: 02c91de76764225070df7e64314c25b865cf7af8

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