azure-iot-sdk: How to enable Application Insights/OpenTelemetry for IoT Device Client Java

Bård Lind 0 Reputation points
2023-12-12T09:54:09.11+00:00

Hi.

I am trying to set up Distributed Tracing for an Java application sending events and telemetry to IoT Hub.

Looking at the examples at https://learn.microsoft.com/en-us/java/api/overview/azure/core-tracing-opentelemetry-readme?view=azure-java-preview

TracingOptions customTracingOptions = new OpenTelemetryTracingOptions()
    .setOpenTelemetry(openTelemetry);

// configure Azure Client to use customTracingOptions - it will use tracerProvider
// to create tracers
AzureClient sampleClient = new AzureClientBuilder()
    .endpoint("https://my-client.azure.com")
    .clientOptions(new ClientOptions().setTracingOptions(customTracingOptions))
    .build();

I'd like to acheive the same with IoT DeviceClient.

Then end goal is tho show Distributed Tracing in Application Insights\Application map.

Two questions:

  1. Are there any plans for DeviceClient/ClientOptions to support something like "setTracingOptions"?
  2. Any sugestions on how to enable distributed tracing while (1.) might be implemented?

Thanks

Bard

Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
208 questions
{count} votes

1 answer

Sort by: Most helpful
  1. LeelaRajeshSayana-MSFT 13,471 Reputation points
    2023-12-20T02:13:28.74+00:00

    Hi @Bård Lind Apologies for the delayed response. The current implementation does not support Distributed Tracing through DeviceClient/ClientOptions. It is only possible through OpenTelemetry SDK at this point in time.

    You can post this question on the GitHub repository issues page. The product team actively maintains this repository and you can get assistance from the directly on this issue.

    Hope this helps.


    If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.

    0 comments No comments