Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 3ea76e9

Browse files
authored
use container type resource instead of k8s type for resource transfomration. (#160)
1 parent 5d4eb99 commit 3ea76e9

5 files changed

Lines changed: 7 additions & 6 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module contrib.go.opencensus.io/exporter/stackdriver
22

33
require (
44
cloud.google.com/go v0.38.0
5-
contrib.go.opencensus.io/resource v0.1.0
5+
contrib.go.opencensus.io/resource v0.1.1
66
github.com/aws/aws-sdk-go v1.19.18
77
github.com/census-instrumentation/opencensus-proto v0.2.0
88
github.com/golang/protobuf v1.3.1

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
44
cloud.google.com/go v0.38.0 h1:ROfEUZz+Gh5pa62DJWXSaonyu3StP6EA6lPEXPI6mCo=
55
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
66
contrib.go.opencensus.io/resource v0.1.0/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA=
7+
contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA=
78
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
89
github.com/aws/aws-sdk-go v1.19.18 h1:Hb3+b9HCqrOrbAtFstUWg7H5TQ+/EcklJtE8VShVs8o=
910
github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=

metrics_proto_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ func TestProtoMetricWithDifferentResource(t *testing.T) {
180180
{
181181
in: &metricspb.Metric{
182182
MetricDescriptor: &metricspb.MetricDescriptor{
183-
Name: "with_k8s_resource",
183+
Name: "with_container_resource",
184184
Description: "This is a test",
185185
Unit: "By",
186186
},
187187
Resource: &resourcepb.Resource{
188-
Type: resourcekeys.K8SType,
188+
Type: resourcekeys.ContainerType,
189189
Labels: map[string]string{
190190
resourcekeys.K8SKeyClusterName: "cluster1",
191191
resourcekeys.K8SKeyPodName: "pod1",
@@ -217,7 +217,7 @@ func TestProtoMetricWithDifferentResource(t *testing.T) {
217217
TimeSeries: []*monitoringpb.TimeSeries{
218218
{
219219
Metric: &googlemetricpb.Metric{
220-
Type: "custom.googleapis.com/opencensus/with_k8s_resource",
220+
Type: "custom.googleapis.com/opencensus/with_container_resource",
221221
Labels: map[string]string{},
222222
},
223223
Resource: &monitoredrespb.MonitoredResource{

resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func defaultMapResource(res *resource.Resource) *monitoredrespb.MonitoredResourc
9090
if res == nil || res.Labels == nil {
9191
return result
9292
}
93-
if res.Type == resourcekeys.K8SType {
93+
if res.Type == resourcekeys.ContainerType {
9494
result.Type = "k8s_container"
9595
match = k8sResourceMap
9696
} else if v, ok := res.Labels[resourcekeys.CloudKeyProvider]; ok {

resource_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestDefaultMapResource(t *testing.T) {
3333
// first mapping that doesn't apply.
3434
{
3535
input: &resource.Resource{
36-
Type: resourcekeys.K8SType,
36+
Type: resourcekeys.ContainerType,
3737
Labels: map[string]string{
3838
stackdriverProjectID: "proj1",
3939
resourcekeys.K8SKeyClusterName: "cluster1",

0 commit comments

Comments
 (0)