Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stackdriver trace exporter #288

Closed
wants to merge 13 commits into from
Prev Previous commit
Next Next commit
fix example
clsung committed Nov 23, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 54896efe6d7b7203b39026ddd08f11bfbe665442
2 changes: 1 addition & 1 deletion ext/opentelemetry-ext-stackdriver/examples/client.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

from opentelemetry import trace
from opentelemetry.ext import http_requests
from opentelemetry.ext.stackdriver import StackdriverSpanExporter
from opentelemetry.ext.stackdriver.trace import StackdriverSpanExporter
from opentelemetry.sdk.trace import Tracer
from opentelemetry.sdk.trace.export import SimpleExportSpanProcessor

2 changes: 1 addition & 1 deletion ext/opentelemetry-ext-stackdriver/examples/server.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@

from opentelemetry import trace
from opentelemetry.ext import http_requests
from opentelemetry.ext.stackdriver import StackdriverSpanExporter
from opentelemetry.ext.stackdriver.trace import StackdriverSpanExporter
from opentelemetry.ext.wsgi import OpenTelemetryMiddleware
from opentelemetry.sdk.trace import Tracer
from opentelemetry.sdk.trace.export import BatchExportSpanProcessor
2 changes: 1 addition & 1 deletion ext/opentelemetry-ext-stackdriver/examples/trace.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
# limitations under the License.

from opentelemetry import trace
from opentelemetry.ext.stackdriver import StackdriverSpanExporter
from opentelemetry.ext.stackdriver.trace import StackdriverSpanExporter
from opentelemetry.sdk.trace import Tracer
from opentelemetry.sdk.trace.export import SimpleExportSpanProcessor

Original file line number Diff line number Diff line change
@@ -69,7 +69,8 @@ def export(self, spans: typing.Sequence[Span]) -> SpanExportResult:

try:
self.client.batch_write_spans(
"projects/{}".format(self.project_id), {"spans": stackdriver_spans}
"projects/{}".format(self.project_id),
{"spans": stackdriver_spans},
)
except Exception as ex:
logger.warning("Error while writing to stackdriver: %s", ex)
@@ -109,8 +110,6 @@ def translate_to_stackdriver(
if span.end_time:
end_time = ns_to_iso_str(span.end_time)

time_events = None

span.attributes["g.co/agent"] = AGENT
attr_map = extract_attributes(span.attributes)