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

java: make telemetry optional #244

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mathieu1fb
Copy link
Collaborator

Features;

Telemetry is now optional for the IoT3 Core and Mobility SDKs.

Closes #235


How to test

  1. Clone the its-client project on your IDE.
  2. Ensure that you have Gradle to be able to build the java/iot3 modules (core, mobility and examples).
  3. Find the Iot3MobilityBootstrapExample class in the examples module, and set appropriate values for the following fields:
private static final String EXAMPLE_UUID = "uuid";
private static final String EXAMPLE_CONTEXT = "context";
// Bootstrap parameters
private static final String BOOTSTRAP_ID = "bootstrap_id";
private static final String BOOTSTRAP_LOGIN = "boostrap_login";
private static final String BOOTSTRAP_PASSWORD = "bootstrap_password";
private static final BootstrapHelper.Role BOOTSTRAP_ROLE = BootstrapHelper.Role.EXTERNAL_APP;
private static final String BOOTSTRAP_URI = "bootstrap.uri.com";
private static final boolean ENABLE_TELEMETRY = false; // enable or disable telemetry here
  1. Run Iot3MobilityBootstrapExample.

Expected results:

  1. On the console, you should see the following:
Bootstrap success
IoT3 ID: <id>
LOGIN: <login>
PASSWORD: <password>
MQTT URI: <mqtt_uri>
TELEMETRY URI: <open_telemetry_uri>
  1. On the console, you should then see that the MQTT connection has been established successfully and that mobility messages are being published and received periodically (CAM, CPM and DENM).
  2. On Jaeger, you should see that telemetry is only being reported when ENABLE_TELEMETRY is set to true.

@mathieu1fb mathieu1fb self-assigned this Dec 11, 2024
Copy link
Member

@fredOG-2A1 fredOG-2A1 left a comment

Choose a reason for hiding this comment

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

Seems good to me

@fredOG-2A1
Copy link
Member

Just one remark.
I tried to launch with Intellij the Iot3MobilityBootstrapExample class in a wrong manner. Without modifying the final String BOOTSTRAP_URI = "bootstrap.uri.com (lines 37 to 45) it gives me this error:
Process 'command 'C:/Users/fyoj6494/.jdks/corretto-17.0.13/bin/java.exe'' finished with non-zero exit value 1

This message isn't very clear.
Debugging the execution, I see that there is a missing caught exception in BootstrapHelper line 78.
If we modify this line to "catch (IllegalArgumentException | InterruptedException | URISyntaxException | IOException exception)" ie adding IllegalArgumentException, the final message is:
Bootstrap error: java.lang.IllegalArgumentException: URI with undefined scheme
Now, the message is meaningful.

What do you think?

@fredOG-2A1
Copy link
Member

By the way, what about Jaeger.
Do you have an url? How can I check or play with Jaeger?

@mathieu1fb
Copy link
Collaborator Author

Just one remark. I tried to launch with Intellij the Iot3MobilityBootstrapExample class in a wrong manner. Without modifying the final String BOOTSTRAP_URI = "bootstrap.uri.com (lines 37 to 45) it gives me this error: Process 'command 'C:/Users/fyoj6494/.jdks/corretto-17.0.13/bin/java.exe'' finished with non-zero exit value 1

This message isn't very clear. Debugging the execution, I see that there is a missing caught exception in BootstrapHelper line 78. If we modify this line to "catch (IllegalArgumentException | InterruptedException | URISyntaxException | IOException exception)" ie adding IllegalArgumentException, the final message is: Bootstrap error: java.lang.IllegalArgumentException: URI with undefined scheme Now, the message is meaningful.

What do you think?

Thanks for "catching" that ;) I'll correct it!

IoT3Core will now only attempt to instantiate the MQTT and OpenTelemetry clients if their parameters have been set with the builder's mqttParams(...) and telemetryParams(...) respectively, or if the builder's bootstrapConfig(...) has been used.

Signed-off-by: Mathieu LEFEBVRE <[email protected]>
IoT3Mobility builder bootstrapConfig(...) now has an 'enableTelemetry' parameter.

IoT3Mobility will now only call the IoT3Core telemetryParams(...) builder if its own builder's telemetryParams(...) or bootstrapConfig(...) with enabled telemetry has been called.

Signed-off-by: Mathieu LEFEBVRE <[email protected]>
This will make the returned boostrap error clearer in case of wrong input parameter.

Signed-off-by: Mathieu LEFEBVRE <[email protected]>
@mathieu1fb mathieu1fb force-pushed the feature/optional-telemetry branch from f0912b1 to 597503f Compare December 16, 2024 12:44
@Orange-OpenSource Orange-OpenSource deleted a comment from fredOG-2A1 Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Make telemetry optionnal
2 participants