census-ecosystem / opencensus-go-exporter-stackdriver

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

Use generic_task resource type when all generic labels are present #286

Closed aeneev closed 3 years ago

aeneev commented 3 years ago

While converting an ocagent resource to a cloud resource, stackdriver exporter looks for a set of labels that apply to a generic_task resource: https://cloud.google.com/monitoring/api/resources#tag_generic_task

However, if it doesn't find one of the labels, it falls back to "global" resource with just the project id label, and it works OK.

But if it does find all of the labels, it will attach them to the exported resource, and Cloud API fails with "Unrecognized resource label" error, because those labels do not exist on a "global" resource.

Changing "global" to "generic_task" fixes this situation.

codecov-commenter commented 3 years ago

Codecov Report

Merging #286 (628b418) into master (f81d98c) will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #286      +/-   ##
==========================================
+ Coverage   71.37%   71.39%   +0.01%     
==========================================
  Files          17       17              
  Lines        1530     1531       +1     
==========================================
+ Hits         1092     1093       +1     
  Misses        364      364              
  Partials       74       74              
Impacted Files Coverage Δ
resource.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f81d98c...628b418. Read the comment docs.