Skip to content

python/iot3: add service_id to OTLP spans#533

Merged
ymorin-orange merged 4 commits into
Orange-OpenSource:masterfrom
ymorin-orange:nyma/gh-491-service-id
May 29, 2026
Merged

python/iot3: add service_id to OTLP spans#533
ymorin-orange merged 4 commits into
Orange-OpenSource:masterfrom
ymorin-orange:nyma/gh-491-service-id

Conversation

@ymorin-orange
Copy link
Copy Markdown
Member

@ymorin-orange ymorin-orange commented May 27, 2026

Changes

  • IoT3 SDK:
    • core: add service-id tag to OTLP trace spans
  • applications:
    • interqueuemanager: set the service-id tag
    • vehicle: set the service-id tag

Close #491

Test

How to test

Note: in the following, lines starting with $ are to be executed on your
machine, as a non-root user;
lines starting with (docker)$ are to be executed in the Docker container;
lines starting with (docker)🐍 $ are to be executed in the Docker container,
in the python venv.

  1. Prepare a test environment:
    1. in a terminal, prepare a collector implementing the OpenTelemetry API, on localhost. If you don't have one, you may use an existing one, like:
      $ docker container run \
          --rm \
          -p 16686:16686 \
          -p 4318:4318 \
          jaegertracing/all-in-one:1.58
      
      then open a browser on the Jaegger UI (or that of your own collector if you have one):
      http://localhost:16686/
      
    2. in another terminal, start a container with Python 3.11
      and the necessary packages:
      $ docker container run \
          --detach \
          --name iot3 \
          --rm \
          -ti \
          --network host \
          -e http_proxy \
          -e https_proxy \
          -e no_proxy \
          --user $(id -u):$(id -u) \
          --mount type=bind,source=$(pwd),destination=$(pwd) \
          --workdir $(pwd) \
          python:3.11.14-slim-trixie \
          /bin/bash -il
      
      $ docker container exec -u 0:0 iot3 apt update
      $ docker container exec -u 0:0 iot3 apt install -y git build-essential
      
      $ docker container attach iot3
    3. prepare a Python 3.11 environment
      (docker)$ python3.11 -m venv /tmp/venv
      (docker)$ . /tmp/venv/bin/activate
  2. Build the Python IoT3 package:
    (docker)🐍 $ pip \
                    --disable-pip-version-check \
                    --no-cache-dir \
                    wheel \
                    -w /tmp/wheels \
                    python/iot3
  3. Install the Python IoT3 package:
    (docker)🐍 $ pip \
                    --disable-pip-version-check \
                    --no-cache-dir \
                    install \
                    --no-deps \
                    /tmp/wheels/*.whl
  4. Run the IoT3 Core SDK tests:
    (docker)🐍 ./python/iot3/tests/test-iot3-core-otel
  5. In the Jaeger UI, search traces for the test-service. Open a span, and look for its attributes.

Expected results

  1. The test environment is ready
  2. The package was built successfully
  3. The package was installed successfully
  4. The test succeds
  5. The traces are available; spans have an attribute named iot3.core.service_id with value test_42.

@ymorin-orange ymorin-orange requested a review from Hugues360 May 27, 2026 13:28
@ymorin-orange ymorin-orange self-assigned this May 27, 2026
@ymorin-orange ymorin-orange added the Python Python code label May 27, 2026
@ymorin-orange ymorin-orange changed the title Nyma/gh 491 service python/iot3: add service_id to OTLP spans May 27, 2026
@Hugues360
Copy link
Copy Markdown
Collaborator

The description of the MR is not updated (in particular the link of the issue to be fixed)

@Hugues360
Copy link
Copy Markdown
Collaborator

I had a problem to get python:3.11.17-slim-trixie:
docker: Error response from daemon: manifest for python:3.11.17-slim-trixie not found: manifest unknown: manifest unknown.
I made the test with python:3.11.14-slim-trixie

Copy link
Copy Markdown
Collaborator

@Hugues360 Hugues360 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little proposed modification for the type of service_id (Optional[str] should be I think better) but everything is ok otherwise, I approve

Comment thread python/iot3/src/iot3/core/otel.py Outdated
*,
service_name: str,
endpoint: str,
service_id: str = None,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

srvice-id should be Optional[str], no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

srvice-id should be Optional[str], no?

Indeed. And this is also missing on others parameters too... I'll fix all of that, thanks!

@ymorin-orange
Copy link
Copy Markdown
Member Author

I made the test with python:3.11.14-slim-trixie

MR description updated, thanks.

@ymorin-orange
Copy link
Copy Markdown
Member Author

The description of the MR is not updated (in particular the link of the issue to be fixed)

MR description updated, thanks.

@ymorin-orange ymorin-orange force-pushed the nyma/gh-491-service-id branch from 8817c56 to bb6c825 Compare May 29, 2026 10:38
Reported-by: Hugues OUDEVILLE <hugues.oudeville@orange.com>
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Closes Orange-OpenSource#491

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
@ymorin-orange ymorin-orange force-pushed the nyma/gh-491-service-id branch from bb6c825 to 6a27c1e Compare May 29, 2026 10:58
@ymorin-orange ymorin-orange merged commit 710373c into Orange-OpenSource:master May 29, 2026
119 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Python Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an id tag in telemetry spans

2 participants