Skip to content

Commit 721058a

Browse files
Praful Makanichingor13
authored andcommitted
---
yaml --- r: 12095 b: refs/heads/autosynth-errorreporting c: f5c0394 h: refs/heads/master i: 12093: 17cbfac 12091: f257376 12087: 36d77ec 12079: b830cce 12063: 0d70141 12031: 07727ff
1 parent 24e0a05 commit 721058a

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
@@ -131,7 +131,7 @@ refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
131131
refs/heads/autosynth-containeranalysis: 781fdb430a60f9a6491f116e31e4e10118157bdb
132132
refs/heads/autosynth-datastore: af1fb76aa3eee02fe6f31f8fa1c72a4f048d149b
133133
refs/heads/autosynth-dialogflow: ebdd13c445b9674ff9ad4601f78d7ecd6f9c3660
134-
refs/heads/autosynth-errorreporting: cafd7474e37951bcfaf4d81fa9727a6ce74455ce
134+
refs/heads/autosynth-errorreporting: f5c03944b5628d53edfcd65b504deacc6fe002a9
135135
refs/heads/autosynth-firestore: 450623a0568a156847a97f05d0ea5aeeeeaca698
136136
refs/heads/autosynth-iot: 2a21f544087dee8f5b5802779ff9e2a70c1acdca
137137
refs/heads/autosynth-kms: 44920781bf79d494a1835207fc7110b743a1d7d4

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