From 7d57544e3516860eb5ee8193dfea24ddbd058e04 Mon Sep 17 00:00:00 2001 From: William Armiros Date: Fri, 23 Oct 2020 10:41:10 -0600 Subject: [PATCH] addressed comments --- exporter/logzioexporter/go.mod | 2 +- exporter/logzioexporter/go.sum | 1 - go.sum | 4 +++ .../internal/aws/ecs/ecs.go | 25 ++++++++++--------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/exporter/logzioexporter/go.mod b/exporter/logzioexporter/go.mod index 1085b7e20fe6..810284b59e17 100644 --- a/exporter/logzioexporter/go.mod +++ b/exporter/logzioexporter/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( github.com/census-instrumentation/opencensus-proto v0.3.0 github.com/hashicorp/go-hclog v0.14.0 - github.com/jaegertracing/jaeger v1.20.0 + github.com/jaegertracing/jaeger v1.19.2 github.com/logzio/jaeger-logzio v0.0.0-20200826115713-de8961d427e3 github.com/stretchr/testify v1.6.1 go.opentelemetry.io/collector v0.11.1-0.20201001213035-035aa5cf6c92 diff --git a/exporter/logzioexporter/go.sum b/exporter/logzioexporter/go.sum index 74544ead5283..22eef1841cf3 100644 --- a/exporter/logzioexporter/go.sum +++ b/exporter/logzioexporter/go.sum @@ -558,7 +558,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.14.5/go.mod h1:UJ0EZAp832vCd54Wev9N1BM github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= github.com/grpc-ecosystem/grpc-gateway v1.15.0 h1:ntPNC9TD/6l2XDenJZe6T5lSMg95thpV9sGAqHX4WU8= github.com/grpc-ecosystem/grpc-gateway v1.15.0/go.mod h1:vO11I9oWA+KsxmfFQPhLnnIb1VDE24M+pdxZFiuZcA8= -github.com/grpc-ecosystem/grpc-gateway v1.15.2/go.mod h1:vO11I9oWA+KsxmfFQPhLnnIb1VDE24M+pdxZFiuZcA8= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= diff --git a/go.sum b/go.sum index 9c5c500eacde..79da8a6f2a11 100644 --- a/go.sum +++ b/go.sum @@ -90,6 +90,8 @@ github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EF github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v3.5.0+incompatible h1:AShr9cqkF+taHjyQgcBcQUt/ZNK+iPq4ROaZwSX5c/U= +github.com/DataDog/datadog-go v3.5.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/sketches-go v0.0.1/go.mod h1:Q5DbzQ+3AkgGwymQO7aZFNP7ns2lZKGtvRBzRXfdi60= github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= @@ -261,6 +263,8 @@ github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6ps github.com/dgraph-io/ristretto v0.0.1/go.mod h1:T40EBc7CJke8TkpiYfGGKAeFjSaxuFXhuXRyumBd6RE= github.com/dgraph-io/ristretto v0.0.2 h1:a5WaUrDa0qm0YrAAS1tUykT5El3kt62KNZZeMxQn3po= github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= +github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= diff --git a/processor/resourcedetectionprocessor/internal/aws/ecs/ecs.go b/processor/resourcedetectionprocessor/internal/aws/ecs/ecs.go index d1097279a739..50022e46c4ce 100644 --- a/processor/resourcedetectionprocessor/internal/aws/ecs/ecs.go +++ b/processor/resourcedetectionprocessor/internal/aws/ecs/ecs.go @@ -1,6 +1,7 @@ package ecs import ( + "bytes" "context" "fmt" "go.opentelemetry.io/collector/translator/conventions" @@ -110,9 +111,9 @@ func getTmdeFromEnv() string { } func parseCluster(cluster string) string { - parts := strings.Split(cluster, "/") - if len(parts) > 1 { - return parts[1] + i := bytes.IndexByte([]byte(cluster), byte('/')) + if i != -1 { + return cluster[i+1:] } return cluster @@ -134,10 +135,10 @@ func parseRegionAndAccount(taskARN string) (region string, account string) { // containers not using AWS Logs, and those without log group metadata to get the final lists of valid log data // See: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v4.html#task-metadata-endpoint-v4-response func getValidLogData(containers []Container, self *Container, account string) [4]pdata.AnyValueArray { - lgn := pdata.NewAnyValueArray() - lga := pdata.NewAnyValueArray() - lsn := pdata.NewAnyValueArray() - lsa := pdata.NewAnyValueArray() + logGroupNames := pdata.NewAnyValueArray() + logGroupArns := pdata.NewAnyValueArray() + logStreamNames := pdata.NewAnyValueArray() + logStreamArns := pdata.NewAnyValueArray() for _, container := range containers { logData := container.LogOptions @@ -147,14 +148,14 @@ func getValidLogData(containers []Container, self *Container, account string) [4 self.DockerId != container.DockerId && logData != (LogData{}) { - lgn.Append(pdata.NewAttributeValueString(logData.LogGroup)) - lga.Append(pdata.NewAttributeValueString(constructLogGroupArn(logData.Region, account, logData.LogGroup))) - lsn.Append(pdata.NewAttributeValueString(logData.Stream)) - lsa.Append(pdata.NewAttributeValueString(constructLogStreamArn(logData.Region, account, logData.LogGroup, logData.Stream))) + logGroupNames.Append(pdata.NewAttributeValueString(logData.LogGroup)) + logGroupArns.Append(pdata.NewAttributeValueString(constructLogGroupArn(logData.Region, account, logData.LogGroup))) + logStreamNames.Append(pdata.NewAttributeValueString(logData.Stream)) + logStreamArns.Append(pdata.NewAttributeValueString(constructLogStreamArn(logData.Region, account, logData.LogGroup, logData.Stream))) } } - return [4]pdata.AnyValueArray{lgn, lga, lsn, lsa} + return [4]pdata.AnyValueArray{logGroupNames, logGroupArns, logStreamNames, logStreamArns} } func constructLogGroupArn(region, account, group string) string {