Skip to content

Update transform_id for W3C Metadata creation and Reporter init #9

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

Merged
merged 4 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ The custom distro to extend the OpenTelemetry Python agent for compatibility wit

### Git Repos and Directory Structure

The code in this repository makes use of code located in the [otel-oboe](https://github.com/librato/otel-oboe) GIT repository. Thus, first make sure that you clone the following repositories into the same root directory. For example, if your development directory is `~/gitrepos/`, please clone the `otel-oboe` and the `opentelemetry-python-instrumentation-custom-distro` repositories under `~/gitrepos`, so that your directory structure looks as shown below:
The code in this repository makes use of code located in an experimental branch of the [oboe](https://github.com/librato/oboe) GIT repository. Thus, first make sure that you clone the following repositories into the same root directory. For example, if your development directory is `~/gitrepos/`, please clone the `oboe` and the `opentelemetry-python-instrumentation-custom-distro` repositories under `~/gitrepos`, so that your directory structure looks as shown below:
```
~/gitrepos/
|
|----otel-oboe/
|----oboe/
|
|----opentelemetry-python-instrumentation-custom-distro/
```
Then in `oboe`, checkout the [add-otel-oboe-features branch](https://github.com/librato/oboe/tree/add-otel-oboe-features).

### Development (Build) Container

Expand All @@ -32,7 +33,7 @@ Then you can start a build container by running `./run_docker_dev.sh` from withi
./run_docker_dev.sh
```
from within the `dev_tools` directory.
* Inside the docker container, you can now build the agent with the provided Makefile.
* Inside the docker container, you can now build the agent with the provided Makefile in the container's `dev_tools` directory.

### Install Agent from Source in Development Mode
* Execute `make wrapper` inside the build container. This copies the C-extension artifacts and builds the SWIG bindings.
Expand Down
4 changes: 2 additions & 2 deletions dev_tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SHELL=bash
#----------------------------------------------------------------------------------------------------------------------#
# variable definitions and recipes for downloading of required header and library files
#----------------------------------------------------------------------------------------------------------------------#
OTELOBOEREPO := /code/otel_oboe/liboboe
OTELOBOEREPO := /code/oboe/liboboe

# Copy the pre-compiled liboboe shared library from source specified in OTELOBOEREPO
copy-liboboe:
Expand Down Expand Up @@ -58,7 +58,7 @@ copy-bson-headers:
if [ $$? -ne 0 ]; then echo " **** fail to copy $$i ****" ; exit 1; fi; \
done

# copy artifacts from local otel-oboe
# copy artifacts from local oboe
copy-all: copy-headers copy-liboboe

#----------------------------------------------------------------------------------------------------------------------#
Expand Down
2 changes: 1 addition & 1 deletion dev_tools/run_docker_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ docker run -it \
--cap-add SYS_PTRACE \
--workdir /code/opentelemetry_distro_solarwinds \
-v "$PWD"/..:/code/opentelemetry_distro_solarwinds \
-v "$PWD"/../../otel-oboe/:/code/otel_oboe \
-v "$PWD"/../../oboe/:/code/oboe \
-v `echo ~`:/home/developer \
dev-container bash
1 change: 1 addition & 0 deletions opentelemetry_distro_solarwinds/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def _initialize_solarwinds_reporter(self):
grpc_proxy='',
stdout_clear_nonblocking=0,
is_grpc_clean_hack_enabled=False,
w3c_trace_format=1,
)

@staticmethod
Expand Down
11 changes: 6 additions & 5 deletions opentelemetry_distro_solarwinds/ot_ao_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
"""

import logging
import os

logger = logging.getLogger(__file__)


def transform_id(span_context):
"""Generates an AppOptics X-Trace ID from the provided OpenTelemetry span context."""
xtr = "2B{0:032X}00000000{1:016X}0{2}".format(span_context.trace_id,
span_context.span_id,
span_context.trace_flags)
logger.debug("Generated X-Trace %s from span context %s", xtr,
"""Generates a liboboe W3C compatible trace_context from provided OTel span context."""
xtr = "00-{0:032X}-{1:016X}-{2:02X}".format(span_context.trace_id,
span_context.span_id,
span_context.trace_flags)
logger.debug("Generated trace_context %s from span context %s", xtr,
span_context)
return xtr