census-ecosystem / opencensus-go-exporter-stackdriver

OpenCensus Go exporter for Stackdriver Monitoring and Trace
Apache License 2.0
67 stars 79 forks source link

Prevent from attempting to create metrics with unspecified MetricKind #305

Closed ygonzal6 closed 1 year ago

ygonzal6 commented 1 year ago

Attempting to create metrics with unspecified metricKind floods GCP logs with the following error: "Request was missing field metricDescriptor.metricKind: The descriptor does not have the metric kind set." This will happen when metric type is of TypeSummary.

google-cla[bot] commented 1 year ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

dashpole commented 1 year ago

/gcbrun please add unit tests

dashpole commented 1 year ago

/gcbrun

dashpole commented 1 year ago
=== RUN   TestMetricTypeToMonitoringMetricKind
--- FAIL: TestMetricTypeToMonitoringMetricKind (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe5e139]

goroutine 2541 [running]:
testing.tRunner.func1.2({0xf40920, 0x218d8e0})
    /usr/local/go/src/testing/testing.go:1209 +0x36c
testing.tRunner.func1()
    /usr/local/go/src/testing/testing.go:1212 +0x3b6
panic({0xf40920, 0x218d8e0})
    /usr/local/go/src/runtime/panic.go:1047 +0x266
contrib.go.opencensus.io/exporter/stackdriver.TestMetricTypeToMonitoringMetricKind(0xc000225a00)
    /workspace/metrics_test.go:433 +0x459
testing.tRunner(0xc000225a00, 0x106a290)
    /usr/local/go/src/testing/testing.go:1259 +0x230
created by testing.(*T).Run
    /usr/local/go/src/testing/testing.go:1306 +0x727
FAIL    contrib.go.opencensus.io/exporter/stackdriver   8.212s
dashpole commented 1 year ago

/gcbrun