1- # Build OpenTelemetry-Matlab on Linux and run the GitHub example, with the workflow
2- # itself instrumented to emit OpenTelemetry spans. The MATLAB example picks up the
3- # TRACEPARENT environment variable set by the instrumentation so that the MATLAB spans
1+ # Install a released OpenTelemetry-Matlab toolbox on Linux and run the GitHub example, with
2+ # the workflow itself instrumented to emit OpenTelemetry spans. The MATLAB example picks up
3+ # the TRACEPARENT environment variable set by the instrumentation so that the MATLAB spans
44# and the GitHub workflow spans form a single trace.
55name : " GitHub Workflow Tracing Test"
66on :
77 workflow_dispatch :
88 push :
9- branches :
9+ branches :
1010 - github_otel
1111env :
1212 MLM_LICENSE_TOKEN : ${{ secrets.MLM_LICENSE_TOKEN }}
1313jobs :
14- build-and- run-github-example-ubuntu :
14+ run-github-example-ubuntu :
1515 runs-on : ubuntu-22.04
1616 env :
17- OPENTELEMETRY_MATLAB_INSTALL : " ${{ github.workspace }}/otel_matlab_install"
17+ OTEL_MATLAB_RELEASE : " 1.11.0"
18+ OTEL_MATLAB_MLTBX : " ${{ github.workspace }}/otel-matlab.mltbx"
1819 steps :
1920 # must be the first step so that all subsequent steps are captured as spans
2021 - name : Instrument job
@@ -25,34 +26,33 @@ jobs:
2526 OTEL_EXPORTER_OTLP_PROTOCOL : " http/protobuf"
2627 with :
2728 cache : ' false'
29+ # source is only needed for the example
2830 - name : Download OpenTelemetry-Matlab source
2931 uses : actions/checkout@v3
3032 with :
3133 path : opentelemetry-matlab
32- - name : Install ninja-build
33- run : sudo apt-get install ninja-build
34+ - name : Download OpenTelemetry-Matlab release
35+ env :
36+ GH_TOKEN : ${{ github.token }}
37+ run : gh release download "${{ env.OTEL_MATLAB_RELEASE }}" --repo "${{ github.repository }}" --pattern otel-matlab.mltbx --output "${{ env.OTEL_MATLAB_MLTBX }}"
3438 - name : Install MATLAB
3539 uses : matlab-actions/setup-matlab@v2
3640 with :
3741 release : R2025a
38- - name : Build OpenTelemetry-Matlab
39- working-directory : opentelemetry-matlab
40- run : |
41- cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
42- cmake --build build --config Release --target install
4342 # Run MATLAB in a shell step (rather than via matlab-actions/run-command) so that
4443 # it inherits the TRACEPARENT environment variable injected by the instrumentation.
4544 # The OTLP HTTP exporter in MATLAB reads the endpoint and headers from the
4645 # OTEL_EXPORTER_OTLP_* environment variables.
4746 - name : Run GitHub example
4847 env :
49- # Add the installation directory to the MATLAB Search Path by
48+ # Add the example directory to the MATLAB Search Path by
5049 # setting the MATLABPATH environment variable.
51- MATLABPATH : " ${{ env.OPENTELEMETRY_MATLAB_INSTALL }}:${{ github.workspace }}/opentelemetry-matlab/examples/github"
50+ MATLABPATH : " ${{ github.workspace }}/opentelemetry-matlab/examples/github"
5251 OTEL_EXPORTER_OTLP_ENDPOINT : ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}
5352 OTEL_EXPORTER_OTLP_HEADERS : ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
5453 OTEL_EXPORTER_OTLP_PROTOCOL : " http/protobuf"
5554 run : |
5655 echo "TRACEPARENT=$TRACEPARENT"
57- # shut down the tracer provider at the end to flush all spans before MATLAB exits
58- matlab-batch "github_example; opentelemetry.sdk.common.Cleanup.shutdown(opentelemetry.trace.Provider.getTracerProvider());"
56+ # install the toolbox, run the example, then shut down the tracer provider
57+ # to flush all spans before MATLAB exits
58+ matlab-batch "matlab.addons.install('${{ env.OTEL_MATLAB_MLTBX }}', true); github_example; opentelemetry.sdk.common.Cleanup.shutdown(opentelemetry.trace.Provider.getTracerProvider());"
0 commit comments