census-instrumentation / opencensus-service

OpenCensus service allows OpenCensus libraries to export to an exporter service rather than having to link vendor-specific exports.
Apache License 2.0
153 stars 63 forks source link

Set g.co/agent in Stackdriver exported via Node info #604

Closed draffensperger closed 5 years ago

draffensperger commented 5 years ago

This uses the Language, CoreLibraryVersion and ExporterVersion fields of the LibraryInfo message on Node to set the g.co/agent span label in the Stackdriver exporter.

Because this code is running in the OpenCensus service (agent/collector) it's safe to assume that the exporter type in the application library code must have been the ocagent-exporter. Hence, it sets the g.co/agent string as follows: opencensus-[Language] [CoreLibraryVersion]; ocagent-exporter [ExporterVersion], e.g. opencensus-python 0.0.1; ocagent-exporter 0.0.2

Fixes https://github.com/census-instrumentation/opencensus-service/issues/525.

codecov[bot] commented 5 years ago

Codecov Report

Merging #604 into master will increase coverage by 0.52%. The diff coverage is 86.11%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #604      +/-   ##
=========================================
+ Coverage   68.97%   69.5%   +0.52%     
=========================================
  Files          93      92       -1     
  Lines        6125    6142      +17     
=========================================
+ Hits         4225    4269      +44     
+ Misses       1679    1646      -33     
- Partials      221     227       +6
Impacted Files Coverage Δ
exporter/exporterwrapper/exporterwrapper.go 0% <0%> (ø) :arrow_up:
exporter/stackdriverexporter/stackdriver.go 57.69% <91.17%> (+57.69%) :arrow_up:
receiver/prometheusreceiver/internal/ocastore.go 72.41% <0%> (-27.59%) :arrow_down:
...iver/prometheusreceiver/internal/metricsbuilder.go 100% <0%> (ø) :arrow_up:
...ceiver/prometheusreceiver/internal/metricfamily.go
...eceiver/prometheusreceiver/internal/transaction.go 89.06% <0%> (+4.21%) :arrow_up:
receiver/prometheusreceiver/metrics_receiver.go 72.13% <0%> (+4.91%) :arrow_up:
receiver/prometheusreceiver/internal/metadata.go 75% <0%> (+75%) :arrow_up:
receiver/prometheusreceiver/internal/logger.go 77.77% <0%> (+77.77%) :arrow_up:

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 b5a7ae3...3f28c6d. Read the comment docs.

draffensperger commented 5 years ago

@songy23 and @pjanotti would you be open to merging this PR even though the OpenCensus service is being replaced by the OpenTelemetry service?

I noticed that the OpenTelemetry service doesn't have a Stackdriver exporter yet, so I think merging this PR would make it easier to adopt this feature in OpenTelemetry if we base the Stackdriver exporter on the OpenCensus service one.

pjanotti commented 5 years ago

Yes, this should be done first here (OC) then we can pick it up on the contrib side of OpenTelemetry when that gets ready.

pjanotti commented 5 years ago

It seems that code coverage numbers are wrong and don't reflect that actual PR numbers...

draffensperger commented 5 years ago

Thanks for the reviews! I'll may not get to this for several days but I plan to fix it up per the comments.

draffensperger commented 5 years ago

@pjanotti I think I've addressed all the comments (though wasn't sure how to easily remove the OCSpanExporter interface). Could you take another look?

draffensperger commented 5 years ago

@pjanotti friendly ping on this - are you comfortable with keeping the new interface instead of adding a dependency on opencensus-go? Would this be ready to merge?

pjanotti commented 5 years ago

hi @draffensperger - sorry, missed your reply earlier. I will merge this and cut a release later this week.

draffensperger commented 5 years ago

@pjanotti awesome, thanks so much for your help with this!