We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
OTLP Exporter should report instrumentation info
Currently the Python OTLP exporter does not export instrumentation information, other implementations do.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py`
Content:
```
1 # Copyright The OpenTelemetry Authors
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 
14 """OTLP Span Exporter"""
15 
16 import logging
17 from typing import Sequence
18 
19 from opentelemetry.exporter.otlp.exporter import (
20     OTLPExporterMixin,
21     _get_resource_data,
22     _translate_key_values,
23 )
24 from opentelemetry.proto.collector.trace.v1.trace_service_pb2 import (
25     ExportTraceServiceRequest,
26 )
27 from opentelemetry.proto.collector.trace.v1.trace_service_pb2_grpc import (
28     TraceServiceStub,
29 )
30 from opentelemetry.proto.trace.v1.trace_pb2 import (
31     InstrumentationLibrarySpans,
32     ResourceSpans,
33 )
34 from opentelemetry.proto.trace.v1.trace_pb2 import Span as CollectorSpan
35 from opentelemetry.proto.trace.v1.trace_pb2 import Status
36 from opentelemetry.sdk.trace import Span as SDKSpan
37 from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
38 
39 logger = logging.getLogger(__name__)
40 
41 
42 # pylint: disable=no-member
43 class OTLPSpanExporter(SpanExporter, OTLPExporterMixin):
44     """OTLP span exporter
45 
46     Args:
47         endpoint: OpenTelemetry Collector receiver endpoint
48         credentials: Credentials object for server authentication
49         metadata: Metadata to send when exporting
50     """
51 
52     _result = SpanExportResult
53     _stub = TraceServiceStub
54 
55     def _translate_name(self, sdk_span):
56         self._collector_span_kwargs["name"] = sdk_span.name
57 
58     def _translate_start_time(self, sdk_span):
59         self._collector_span_kwargs[
60             "start_time_unix_nano"
61         ] = sdk_span.start_time
62 
63     def _translate_end_time(self, sdk_span):
64         self._collector_span_kwargs["end_time_unix_nano"] = sdk_span.end_time
65 
66     def _translate_span_id(self, sdk_span):
67         self._collector_span_kwargs[
68             "span_id"
69         ] = sdk_span.context.span_id.to_bytes(8, "big")
70 
71     def _translate_trace_id(self, sdk_span):
72         self._collector_span_kwargs[
73             "trace_id"
74         ] = sdk_span.context.trace_id.to_bytes(16, "big")
75 
76     def _translate_parent(self, sdk_span):
77         if sdk_span.parent is not None:
78             self._collector_span_kwargs[
79                 "parent_span_id"
80             ] = sdk_span.parent.span_id.to_bytes(8, "big")
81 
82     def _translate_context_trace_state(self, sdk_span):
83         if sdk_span.context.trace_state is not None:
84             self._collector_span_kwargs["trace_state"] = ",".join(
85                 [
86                     "{}={}".format(key, value)
87                     for key, value in (sdk_span.context.trace_state.items())
88                 ]
89             )
90 
91     def _translate_attributes(self, sdk_span):
92         if sdk_span.attributes:
93 
94             self._collector_span_kwargs["attributes"] = []
95 
96             for key, value in sdk_span.attributes.items():
97 
98                 try:
99                     self._collector_span_kwargs["attributes"].append(
100                         _translate_key_values(key, value)
101                     )
102                 except Exception as error:  # pylint: disable=broad-except
103                     logger.exception(error)
104 
105     def _translate_events(self, sdk_span):
106         if sdk_span.events:
107             self._collector_span_kwargs["events"] = []
108 
109             for sdk_span_event in sdk_span.events:
110 
111                 collector_span_event = CollectorSpan.Event(
112                     name=sdk_span_event.name,
113                     time_unix_nano=sdk_span_event.timestamp,
114                 )
115 
116                 for key, value in sdk_span_event.attributes.items():
117                     try:
118                         collector_span_event.attributes.append(
119                             _translate_key_values(key, value)
120                         )
121                     # pylint: disable=broad-except
122                     except Exception as error:
123                         logger.exception(error)
124 
125                 self._collector_span_kwargs["events"].append(
126                     collector_span_event
127                 )
128 
129     def _translate_links(self, sdk_span):
130         if sdk_span.links:
131             self._collector_span_kwargs["links"] = []
132 
133             for sdk_span_link in sdk_span.links:
134 
135                 collector_span_link = CollectorSpan.Link(
136                     trace_id=(
137                         sdk_span_link.context.trace_id.to_bytes(16, "big")
138                     ),
139                     span_id=(sdk_span_link.context.span_id.to_bytes(8, "big")),
140                 )
141 
142                 for key, value in sdk_span_link.attributes.items():
143                     try:
144                         collector_span_link.attributes.append(
145                             _translate_key_values(key, value)
146                         )
147                     # pylint: disable=broad-except
148                     except Exception as error:
149                         logger.exception(error)
150 
151                 self._collector_span_kwargs["links"].append(
152                     collector_span_link
153                 )
154 
155     def _translate_status(self, sdk_span):
156         if sdk_span.status is not None:
157             self._collector_span_kwargs["status"] = Status(
158                 code=sdk_span.status.canonical_code.value,
159                 message=sdk_span.status.description,
160             )
161 
162     def _translate_data(self, data) -> ExportTraceServiceRequest:
163 
164         sdk_resource_instrumentation_library_spans = {}
165 
166         for sdk_span in data:
167 
168             if sdk_span.resource not in (
169                 sdk_resource_instrumentation_library_spans.keys()
170             ):
171                 sdk_resource_instrumentation_library_spans[
172                     sdk_span.resource
173                 ] = InstrumentationLibrarySpans()
174 
175             self._collector_span_kwargs = {}
176 
177             self._translate_name(sdk_span)
178             self._translate_start_time(sdk_span)
179             self._translate_end_time(sdk_span)
180             self._translate_span_id(sdk_span)
181             self._translate_trace_id(sdk_span)
182             self._translate_parent(sdk_span)
183             self._translate_context_trace_state(sdk_span)
184             self._translate_attributes(sdk_span)
185             self._translate_events(sdk_span)
186             self._translate_links(sdk_span)
187             self._translate_status(sdk_span)
188 
189             self._collector_span_kwargs["kind"] = getattr(
190                 CollectorSpan.SpanKind, sdk_span.kind.name
191             )
192 
193             sdk_resource_instrumentation_library_spans[
194                 sdk_span.resource
195             ].spans.append(CollectorSpan(**self._collector_span_kwargs))
196 
197         return ExportTraceServiceRequest(
198             resource_spans=_get_resource_data(
199                 sdk_resource_instrumentation_library_spans,
200                 ResourceSpans,
201                 "spans",
202             )
203         )
204 
205     def export(self, spans: Sequence[SDKSpan]) -> SpanExportResult:
206         return self._export(spans)
207
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py
--- a/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py
+++ b/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py
@@ -27,6 +27,7 @@
 from opentelemetry.proto.collector.trace.v1.trace_service_pb2_grpc import (
     TraceServiceStub,
 )
+from opentelemetry.proto.common.v1.common_pb2 import InstrumentationLibrary
 from opentelemetry.proto.trace.v1.trace_pb2 import (
     InstrumentationLibrarySpans,
     ResourceSpans,
@@ -168,9 +169,22 @@
             if sdk_span.resource not in (
                 sdk_resource_instrumentation_library_spans.keys()
             ):
+                if sdk_span.instrumentation_info is not None:
+                    instrumentation_library_spans = InstrumentationLibrarySpans(
+                        instrumentation_library=InstrumentationLibrary(
+                            name=sdk_span.instrumentation_info.name,
+                            version=sdk_span.instrumentation_info.version,
+                        )
+                    )
+
+                else:
+                    instrumentation_library_spans = (
+                        InstrumentationLibrarySpans()
+                    )
+
                 sdk_resource_instrumentation_library_spans[
                     sdk_span.resource
-                ] = InstrumentationLibrarySpans()
+                ] = instrumentation_library_spans
 
             self._collector_span_kwargs = {}

{"golden_diff": "diff --git a/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py\n--- a/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py\n+++ b/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py\n@@ -27,6 +27,7 @@\n from opentelemetry.proto.collector.trace.v1.trace_service_pb2_grpc import (\n     TraceServiceStub,\n )\n+from opentelemetry.proto.common.v1.common_pb2 import InstrumentationLibrary\n from opentelemetry.proto.trace.v1.trace_pb2 import (\n     InstrumentationLibrarySpans,\n     ResourceSpans,\n@@ -168,9 +169,22 @@\n             if sdk_span.resource not in (\n                 sdk_resource_instrumentation_library_spans.keys()\n             ):\n+                if sdk_span.instrumentation_info is not None:\n+                    instrumentation_library_spans = InstrumentationLibrarySpans(\n+                        instrumentation_library=InstrumentationLibrary(\n+                            name=sdk_span.instrumentation_info.name,\n+                            version=sdk_span.instrumentation_info.version,\n+                        )\n+                    )\n+\n+                else:\n+                    instrumentation_library_spans = (\n+                        InstrumentationLibrarySpans()\n+                    )\n+\n                 sdk_resource_instrumentation_library_spans[\n                     sdk_span.resource\n-                ] = InstrumentationLibrarySpans()\n+                ] = instrumentation_library_spans\n \n             self._collector_span_kwargs = {}\n", "issue": "OTLP Exporter should report instrumentation info\nCurrently the Python OTLP exporter does not export instrumentation information, other implementations do.\n", "before_files": [{"content": "# Copyright The OpenTelemetry Authors\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"OTLP Span Exporter\"\"\"\n\nimport logging\nfrom typing import Sequence\n\nfrom opentelemetry.exporter.otlp.exporter import (\n    OTLPExporterMixin,\n    _get_resource_data,\n    _translate_key_values,\n)\nfrom opentelemetry.proto.collector.trace.v1.trace_service_pb2 import (\n    ExportTraceServiceRequest,\n)\nfrom opentelemetry.proto.collector.trace.v1.trace_service_pb2_grpc import (\n    TraceServiceStub,\n)\nfrom opentelemetry.proto.trace.v1.trace_pb2 import (\n    InstrumentationLibrarySpans,\n    ResourceSpans,\n)\nfrom opentelemetry.proto.trace.v1.trace_pb2 import Span as CollectorSpan\nfrom opentelemetry.proto.trace.v1.trace_pb2 import Status\nfrom opentelemetry.sdk.trace import Span as SDKSpan\nfrom opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult\n\nlogger = logging.getLogger(__name__)\n\n\n# pylint: disable=no-member\nclass OTLPSpanExporter(SpanExporter, OTLPExporterMixin):\n    \"\"\"OTLP span exporter\n\n    Args:\n        endpoint: OpenTelemetry Collector receiver endpoint\n        credentials: Credentials object for server authentication\n        metadata: Metadata to send when exporting\n    \"\"\"\n\n    _result = SpanExportResult\n    _stub = TraceServiceStub\n\n    def _translate_name(self, sdk_span):\n        self._collector_span_kwargs[\"name\"] = sdk_span.name\n\n    def _translate_start_time(self, sdk_span):\n        self._collector_span_kwargs[\n            \"start_time_unix_nano\"\n        ] = sdk_span.start_time\n\n    def _translate_end_time(self, sdk_span):\n        self._collector_span_kwargs[\"end_time_unix_nano\"] = sdk_span.end_time\n\n    def _translate_span_id(self, sdk_span):\n        self._collector_span_kwargs[\n            \"span_id\"\n        ] = sdk_span.context.span_id.to_bytes(8, \"big\")\n\n    def _translate_trace_id(self, sdk_span):\n        self._collector_span_kwargs[\n            \"trace_id\"\n        ] = sdk_span.context.trace_id.to_bytes(16, \"big\")\n\n    def _translate_parent(self, sdk_span):\n        if sdk_span.parent is not None:\n            self._collector_span_kwargs[\n                \"parent_span_id\"\n            ] = sdk_span.parent.span_id.to_bytes(8, \"big\")\n\n    def _translate_context_trace_state(self, sdk_span):\n        if sdk_span.context.trace_state is not None:\n            self._collector_span_kwargs[\"trace_state\"] = \",\".join(\n                [\n                    \"{}={}\".format(key, value)\n                    for key, value in (sdk_span.context.trace_state.items())\n                ]\n            )\n\n    def _translate_attributes(self, sdk_span):\n        if sdk_span.attributes:\n\n            self._collector_span_kwargs[\"attributes\"] = []\n\n            for key, value in sdk_span.attributes.items():\n\n                try:\n                    self._collector_span_kwargs[\"attributes\"].append(\n                        _translate_key_values(key, value)\n                    )\n                except Exception as error:  # pylint: disable=broad-except\n                    logger.exception(error)\n\n    def _translate_events(self, sdk_span):\n        if sdk_span.events:\n            self._collector_span_kwargs[\"events\"] = []\n\n            for sdk_span_event in sdk_span.events:\n\n                collector_span_event = CollectorSpan.Event(\n                    name=sdk_span_event.name,\n                    time_unix_nano=sdk_span_event.timestamp,\n                )\n\n                for key, value in sdk_span_event.attributes.items():\n                    try:\n                        collector_span_event.attributes.append(\n                            _translate_key_values(key, value)\n                        )\n                    # pylint: disable=broad-except\n                    except Exception as error:\n                        logger.exception(error)\n\n                self._collector_span_kwargs[\"events\"].append(\n                    collector_span_event\n                )\n\n    def _translate_links(self, sdk_span):\n        if sdk_span.links:\n            self._collector_span_kwargs[\"links\"] = []\n\n            for sdk_span_link in sdk_span.links:\n\n                collector_span_link = CollectorSpan.Link(\n                    trace_id=(\n                        sdk_span_link.context.trace_id.to_bytes(16, \"big\")\n                    ),\n                    span_id=(sdk_span_link.context.span_id.to_bytes(8, \"big\")),\n                )\n\n                for key, value in sdk_span_link.attributes.items():\n                    try:\n                        collector_span_link.attributes.append(\n                            _translate_key_values(key, value)\n                        )\n                    # pylint: disable=broad-except\n                    except Exception as error:\n                        logger.exception(error)\n\n                self._collector_span_kwargs[\"links\"].append(\n                    collector_span_link\n                )\n\n    def _translate_status(self, sdk_span):\n        if sdk_span.status is not None:\n            self._collector_span_kwargs[\"status\"] = Status(\n                code=sdk_span.status.canonical_code.value,\n                message=sdk_span.status.description,\n            )\n\n    def _translate_data(self, data) -> ExportTraceServiceRequest:\n\n        sdk_resource_instrumentation_library_spans = {}\n\n        for sdk_span in data:\n\n            if sdk_span.resource not in (\n                sdk_resource_instrumentation_library_spans.keys()\n            ):\n                sdk_resource_instrumentation_library_spans[\n                    sdk_span.resource\n                ] = InstrumentationLibrarySpans()\n\n            self._collector_span_kwargs = {}\n\n            self._translate_name(sdk_span)\n            self._translate_start_time(sdk_span)\n            self._translate_end_time(sdk_span)\n            self._translate_span_id(sdk_span)\n            self._translate_trace_id(sdk_span)\n            self._translate_parent(sdk_span)\n            self._translate_context_trace_state(sdk_span)\n            self._translate_attributes(sdk_span)\n            self._translate_events(sdk_span)\n            self._translate_links(sdk_span)\n            self._translate_status(sdk_span)\n\n            self._collector_span_kwargs[\"kind\"] = getattr(\n                CollectorSpan.SpanKind, sdk_span.kind.name\n            )\n\n            sdk_resource_instrumentation_library_spans[\n                sdk_span.resource\n            ].spans.append(CollectorSpan(**self._collector_span_kwargs))\n\n        return ExportTraceServiceRequest(\n            resource_spans=_get_resource_data(\n                sdk_resource_instrumentation_library_spans,\n                ResourceSpans,\n                \"spans\",\n            )\n        )\n\n    def export(self, spans: Sequence[SDKSpan]) -> SpanExportResult:\n        return self._export(spans)\n", "path": "exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py"}], "after_files": [{"content": "# Copyright The OpenTelemetry Authors\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"OTLP Span Exporter\"\"\"\n\nimport logging\nfrom typing import Sequence\n\nfrom opentelemetry.exporter.otlp.exporter import (\n    OTLPExporterMixin,\n    _get_resource_data,\n    _translate_key_values,\n)\nfrom opentelemetry.proto.collector.trace.v1.trace_service_pb2 import (\n    ExportTraceServiceRequest,\n)\nfrom opentelemetry.proto.collector.trace.v1.trace_service_pb2_grpc import (\n    TraceServiceStub,\n)\nfrom opentelemetry.proto.common.v1.common_pb2 import InstrumentationLibrary\nfrom opentelemetry.proto.trace.v1.trace_pb2 import (\n    InstrumentationLibrarySpans,\n    ResourceSpans,\n)\nfrom opentelemetry.proto.trace.v1.trace_pb2 import Span as CollectorSpan\nfrom opentelemetry.proto.trace.v1.trace_pb2 import Status\nfrom opentelemetry.sdk.trace import Span as SDKSpan\nfrom opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult\n\nlogger = logging.getLogger(__name__)\n\n\n# pylint: disable=no-member\nclass OTLPSpanExporter(SpanExporter, OTLPExporterMixin):\n    \"\"\"OTLP span exporter\n\n    Args:\n        endpoint: OpenTelemetry Collector receiver endpoint\n        credentials: Credentials object for server authentication\n        metadata: Metadata to send when exporting\n    \"\"\"\n\n    _result = SpanExportResult\n    _stub = TraceServiceStub\n\n    def _translate_name(self, sdk_span):\n        self._collector_span_kwargs[\"name\"] = sdk_span.name\n\n    def _translate_start_time(self, sdk_span):\n        self._collector_span_kwargs[\n            \"start_time_unix_nano\"\n        ] = sdk_span.start_time\n\n    def _translate_end_time(self, sdk_span):\n        self._collector_span_kwargs[\"end_time_unix_nano\"] = sdk_span.end_time\n\n    def _translate_span_id(self, sdk_span):\n        self._collector_span_kwargs[\n            \"span_id\"\n        ] = sdk_span.context.span_id.to_bytes(8, \"big\")\n\n    def _translate_trace_id(self, sdk_span):\n        self._collector_span_kwargs[\n            \"trace_id\"\n        ] = sdk_span.context.trace_id.to_bytes(16, \"big\")\n\n    def _translate_parent(self, sdk_span):\n        if sdk_span.parent is not None:\n            self._collector_span_kwargs[\n                \"parent_span_id\"\n            ] = sdk_span.parent.span_id.to_bytes(8, \"big\")\n\n    def _translate_context_trace_state(self, sdk_span):\n        if sdk_span.context.trace_state is not None:\n            self._collector_span_kwargs[\"trace_state\"] = \",\".join(\n                [\n                    \"{}={}\".format(key, value)\n                    for key, value in (sdk_span.context.trace_state.items())\n                ]\n            )\n\n    def _translate_attributes(self, sdk_span):\n        if sdk_span.attributes:\n\n            self._collector_span_kwargs[\"attributes\"] = []\n\n            for key, value in sdk_span.attributes.items():\n\n                try:\n                    self._collector_span_kwargs[\"attributes\"].append(\n                        _translate_key_values(key, value)\n                    )\n                except Exception as error:  # pylint: disable=broad-except\n                    logger.exception(error)\n\n    def _translate_events(self, sdk_span):\n        if sdk_span.events:\n            self._collector_span_kwargs[\"events\"] = []\n\n            for sdk_span_event in sdk_span.events:\n\n                collector_span_event = CollectorSpan.Event(\n                    name=sdk_span_event.name,\n                    time_unix_nano=sdk_span_event.timestamp,\n                )\n\n                for key, value in sdk_span_event.attributes.items():\n                    try:\n                        collector_span_event.attributes.append(\n                            _translate_key_values(key, value)\n                        )\n                    # pylint: disable=broad-except\n                    except Exception as error:\n                        logger.exception(error)\n\n                self._collector_span_kwargs[\"events\"].append(\n                    collector_span_event\n                )\n\n    def _translate_links(self, sdk_span):\n        if sdk_span.links:\n            self._collector_span_kwargs[\"links\"] = []\n\n            for sdk_span_link in sdk_span.links:\n\n                collector_span_link = CollectorSpan.Link(\n                    trace_id=(\n                        sdk_span_link.context.trace_id.to_bytes(16, \"big\")\n                    ),\n                    span_id=(sdk_span_link.context.span_id.to_bytes(8, \"big\")),\n                )\n\n                for key, value in sdk_span_link.attributes.items():\n                    try:\n                        collector_span_link.attributes.append(\n                            _translate_key_values(key, value)\n                        )\n                    # pylint: disable=broad-except\n                    except Exception as error:\n                        logger.exception(error)\n\n                self._collector_span_kwargs[\"links\"].append(\n                    collector_span_link\n                )\n\n    def _translate_status(self, sdk_span):\n        if sdk_span.status is not None:\n            self._collector_span_kwargs[\"status\"] = Status(\n                code=sdk_span.status.canonical_code.value,\n                message=sdk_span.status.description,\n            )\n\n    def _translate_data(self, data) -> ExportTraceServiceRequest:\n\n        sdk_resource_instrumentation_library_spans = {}\n\n        for sdk_span in data:\n\n            if sdk_span.resource not in (\n                sdk_resource_instrumentation_library_spans.keys()\n            ):\n                if sdk_span.instrumentation_info is not None:\n                    instrumentation_library_spans = InstrumentationLibrarySpans(\n                        instrumentation_library=InstrumentationLibrary(\n                            name=sdk_span.instrumentation_info.name,\n                            version=sdk_span.instrumentation_info.version,\n                        )\n                    )\n\n                else:\n                    instrumentation_library_spans = (\n                        InstrumentationLibrarySpans()\n                    )\n\n                sdk_resource_instrumentation_library_spans[\n                    sdk_span.resource\n                ] = instrumentation_library_spans\n\n            self._collector_span_kwargs = {}\n\n            self._translate_name(sdk_span)\n            self._translate_start_time(sdk_span)\n            self._translate_end_time(sdk_span)\n            self._translate_span_id(sdk_span)\n            self._translate_trace_id(sdk_span)\n            self._translate_parent(sdk_span)\n            self._translate_context_trace_state(sdk_span)\n            self._translate_attributes(sdk_span)\n            self._translate_events(sdk_span)\n            self._translate_links(sdk_span)\n            self._translate_status(sdk_span)\n\n            self._collector_span_kwargs[\"kind\"] = getattr(\n                CollectorSpan.SpanKind, sdk_span.kind.name\n            )\n\n            sdk_resource_instrumentation_library_spans[\n                sdk_span.resource\n            ].spans.append(CollectorSpan(**self._collector_span_kwargs))\n\n        return ExportTraceServiceRequest(\n            resource_spans=_get_resource_data(\n                sdk_resource_instrumentation_library_spans,\n                ResourceSpans,\n                \"spans\",\n            )\n        )\n\n    def export(self, spans: Sequence[SDKSpan]) -> SpanExportResult:\n        return self._export(spans)\n", "path": "exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/trace_exporter/__init__.py"}]}