-
Notifications
You must be signed in to change notification settings - Fork 625
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
[feat]: Add OTLP HTTP/JSON traces exporter #3681
Conversation
data = serialized_data | ||
if self._compression == Compression.Gzip: | ||
gzip_data = BytesIO() | ||
with gzip.GzipFile(fileobj=gzip_data, mode="w") as gzip_stream: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encoding="utf-8"
gzip_stream.write(serialized_data) | ||
data = gzip_data.getvalue() | ||
elif self._compression == Compression.Deflate: | ||
data = zlib.compress(bytes(serialized_data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data = zlib.compress(bytes(serialized_data)) | |
data = zlib.compress(serialized_data.encode()) |
>>> bytes("foo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: string argument without an encoding
DEFAULT_TIMEOUT = 10 # in seconds | ||
REQUESTS_SUCCESS_STATUS_CODES = (200, 202) | ||
|
||
logger = logging.getLogger(__name__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module has both of logger
and _logger
.
# Second loop encodes the data into JSON format. | ||
# | ||
|
||
sdk_resource_spans = defaultdict(lambda: defaultdict(list)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should use protobuf json serializer.
from opentelemetry.exporter.otlp.proto.common.trace_encoder import (
encode_spans,
)
from google.protobuf import json_format
message = encode_spans(sdk_spans)
return json_format.MessageToJson(message, indent=None)
exporter-otlp-json can be just copy of exporter-otlp-proto-http and just replace these lines: Line 136 in 2b9dcfc
Line 181 in 2b9dcfc
Line 138 in 2b9dcfc
into |
Or can we just add |
@MikeGoldsmith are you still working on this PR? |
Hi @ocelotl - I had the intention of keeping this going but have struggled to get back to it. It's probably best to close this PR and unassign me from the issue. If I find I get more time and it's still available, I'll put my hand up again. Thanks |
Description
Adds a OTLP HTTP/JSON exporter. Currently only exports trace data, but can be expanded to add metrics and logs too.
Fixes #1003
NOTE: I've created as a draft to gather feedback and will add more tests. Also needs lint rules applied too.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Contrib Repo Change?
Checklist: