-
Notifications
You must be signed in to change notification settings - Fork 79
Add a public method to convert OpenCensus View to MetricDescriptor. #277
Add a public method to convert OpenCensus View to MetricDescriptor. #277
Conversation
This is useful if you want to use your code as source of truth of MetricDescritors. Managing MetricDescriptors outside of the Go code (e.g. in Terraform configs) is painful, as the changes to MD requires delete/recreate, after deleting all alert policies associated with the metric. On the other hand, the externally managed MDs are bound to be out of sync with what's present in the code. In the end we decide to just extract/collect views from our go code as source of truth, and thus we need to have a public method to convert views to MD.
/cc @rghetia PTAL. |
Friendly ping :-) |
Doesn't OpenCensus already manage the creation of metric descriptors for you? opencensus-go-exporter-stackdriver/stats.go Line 330 in cde3c10
|
Hmm I think I workarounded the issue by adding proper dependency in our Terraform config. It used to be an issue when there's no dependency between the Cloud Run service (where the metric is produced) and the alert/dashboard. I'll close this. Thank you for taking a look! |
Hmm I think we still want to have this feature. The library does take care of the metric creation, but only happen when at lease one call to Given this, we plan to use the new function added in this PR to generate a list of metric descriptors and then we can create them manually. Would it make sense to merge this PR? Thank you! |
Codecov Report
@@ Coverage Diff @@
## master #277 +/- ##
==========================================
- Coverage 72.72% 71.95% -0.78%
==========================================
Files 17 17
Lines 1712 1558 -154
==========================================
- Hits 1245 1121 -124
+ Misses 391 363 -28
+ Partials 76 74 -2
Continue to review full report at Codecov.
|
I appreciate your help! |
Would it be possible to cut a new release including this PR? Thank you! |
release has been cut |
This is useful if you want to use your code as source of truth of
MetricDescritors.
Managing MetricDescriptors outside of the Go code (e.g. in Terraform
configs) is painful, as the changes to MD requires delete/recreate,
after deleting all alert policies associated with the metric. On the
other hand, the externally managed MDs are bound to be out of sync with
what's present in the code.
In the end we decide to just extract/collect views from our go code as
source of truth, and thus we need to have a public method to convert
views to MD.