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

Distribution with zero buckets results in CreateTimeSeries 400 response #234

Open
ascherkus opened this issue Nov 1, 2019 · 2 comments
Open
Labels
bug Something isn't working

Comments

@ascherkus
Copy link
Contributor

Please answer these questions before submitting a bug report.

What version of the Exporter are you using?

2fdcf7b
v0.12.7

What version of OpenCensus are you using?

9c377598961b706d1542bd2d84d538b5094d596e
v0.22.0

What version of Go are you using?

go version go1.12.12 darwin/amd64

What did you do?

Attempted to create a distribution metric and view and export to Stackdriver.

mExample := stats.Int64("example", "example distribution in milliseconds", "ms")
v := &view.View{
  Name: "example"
  Measure: mExample,
  Description: "example description",
  Aggregation: view.Distribution(),
}

What did you expect to see?

Distribution stats uploaded and visible in Stackdriver.

What did you see instead?

400 errors for CreateTimeSeries on the API dashboard:
https://console.cloud.google.com/apis/api/monitoring.googleapis.com/metrics

... and the following logs:
2019/11/01 15:41:32.278782 stackdriver.go:421: Failed to export to Stackdriver: rpc error: code = InvalidArgument desc = Field timeSeries[1].points[0].distributionValue had an invalid value: Distribution |explicit_buckets.bounds| does not have at least one entry.

Additional context

Curious whether this is by design or not -- based on the documentation for view.Distribution() it's permissible to not specify any buckets:

// Distribution indicates that the desired aggregation is
// a histogram distribution.
//
// An distribution aggregation may contain a histogram of the values in the
// population. The bucket boundaries for that histogram are described
// by the bounds. This defines len(bounds)+1 buckets.
//
// If len(bounds) >= 2 then the boundaries for bucket index i are:
//
//     [-infinity, bounds[i]) for i = 0
//     [bounds[i-1], bounds[i]) for 0 < i < length
//     [bounds[i-1], +infinity) for i = length
//
// If len(bounds) is 0 then there is no histogram associated with the
// distribution. There will be a single bucket with boundaries
// (-infinity, +infinity).
//
// If len(bounds) is 1 then there is no finite buckets, and that single
// element is the common boundary of the overflow and underflow buckets.

Is there a possible bug here where the (-infinity, +infinity) bucket isn't created when exporting to Stackdriver?

@ascherkus ascherkus added the bug Something isn't working label Nov 1, 2019
@rghetia
Copy link
Contributor

rghetia commented Dec 2, 2019

@ascherkus you are probably hitting census-instrumentation/opencensus-go#1169. Can you upgrade to opencensus version v0.22.2?

@rghetia
Copy link
Contributor

rghetia commented Dec 20, 2019

@ascherkus any update?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants