0
votes

I have an function app: funct1(HttpTrigger) -> blob storage -> func2(BlobTrigger). In Application Insights, there will be two separate request telemetry generated with different operation id. Each has its own end-to-end transaction trace.

In order to get the end-to-end trace for the whole app, I would like to correlate two functions by setting the parent id and operation id of func2 with request id and operation id of func1 so both can be shown in application insights as one end-to-end trace.

I have tried following code but it didn't take any effect and there is a lack of documentation about how to use application insights Java SDK in general for customizing telemetry.

@FunctionName("Create-Thumbnail")
@StorageAccount(Config.STORAGE_ACCOUNT_NAME)
@BlobOutput(name = "$return", path = "output/{name}")
public byte[] generateThumbnail(
        @BlobTrigger(name = "blob", path = "input/{name}")
                byte[] content,
        final ExecutionContext context
) {
    try {

        TelemetryConfiguration configuration = TelemetryConfiguration.getActive();
        TelemetryClient client = new TelemetryClient(configuration);
        client.getContext().getOperation().setParentId("MY_CUSTOM_PARENT_ID");
        client.flush();

        return Converter.createThumbnail(content);
    } catch (Exception e) {
        e.printStackTrace();
        return content;
    }
}

Anyone with knowledge in this area can provide some tips?

1
@JuanmaFeliu this is .net example. The java sdk is quite different. Do you have idea about how to do it in Java sdk?codigube

1 Answers

1
votes

I'm afraid it can't be achieved as the official doc said :

In C# and JavaScript, you can use an Application Insights SDK to write custom telemetry data.

If you need to set custom telemetry, you need to add app insights java SDK to your function, but I haven't found any SDK... If there's any progress, I'll update here.