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

Commit

Permalink
use container type resource instead of k8s type for resource transfom…
Browse files Browse the repository at this point in the history
…ration. (#160)
  • Loading branch information
rghetia authored May 31, 2019
1 parent 5d4eb99 commit 3ea76e9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module contrib.go.opencensus.io/exporter/stackdriver

require (
cloud.google.com/go v0.38.0
contrib.go.opencensus.io/resource v0.1.0
contrib.go.opencensus.io/resource v0.1.1
github.com/aws/aws-sdk-go v1.19.18
github.com/census-instrumentation/opencensus-proto v0.2.0
github.com/golang/protobuf v1.3.1
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
cloud.google.com/go v0.38.0 h1:ROfEUZz+Gh5pa62DJWXSaonyu3StP6EA6lPEXPI6mCo=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
contrib.go.opencensus.io/resource v0.1.0/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA=
contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/aws/aws-sdk-go v1.19.18 h1:Hb3+b9HCqrOrbAtFstUWg7H5TQ+/EcklJtE8VShVs8o=
github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
Expand Down
6 changes: 3 additions & 3 deletions metrics_proto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ func TestProtoMetricWithDifferentResource(t *testing.T) {
{
in: &metricspb.Metric{
MetricDescriptor: &metricspb.MetricDescriptor{
Name: "with_k8s_resource",
Name: "with_container_resource",
Description: "This is a test",
Unit: "By",
},
Resource: &resourcepb.Resource{
Type: resourcekeys.K8SType,
Type: resourcekeys.ContainerType,
Labels: map[string]string{
resourcekeys.K8SKeyClusterName: "cluster1",
resourcekeys.K8SKeyPodName: "pod1",
Expand Down Expand Up @@ -217,7 +217,7 @@ func TestProtoMetricWithDifferentResource(t *testing.T) {
TimeSeries: []*monitoringpb.TimeSeries{
{
Metric: &googlemetricpb.Metric{
Type: "custom.googleapis.com/opencensus/with_k8s_resource",
Type: "custom.googleapis.com/opencensus/with_container_resource",
Labels: map[string]string{},
},
Resource: &monitoredrespb.MonitoredResource{
Expand Down
2 changes: 1 addition & 1 deletion resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func defaultMapResource(res *resource.Resource) *monitoredrespb.MonitoredResourc
if res == nil || res.Labels == nil {
return result
}
if res.Type == resourcekeys.K8SType {
if res.Type == resourcekeys.ContainerType {
result.Type = "k8s_container"
match = k8sResourceMap
} else if v, ok := res.Labels[resourcekeys.CloudKeyProvider]; ok {
Expand Down
2 changes: 1 addition & 1 deletion resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestDefaultMapResource(t *testing.T) {
// first mapping that doesn't apply.
{
input: &resource.Resource{
Type: resourcekeys.K8SType,
Type: resourcekeys.ContainerType,
Labels: map[string]string{
stackdriverProjectID: "proj1",
resourcekeys.K8SKeyClusterName: "cluster1",
Expand Down

0 comments on commit 3ea76e9

Please sign in to comment.