From 958423c53b48aa5e25b9d274d6e0d4023bd75da0 Mon Sep 17 00:00:00 2001 From: duncanpo Date: Fri, 23 Feb 2024 14:11:59 -0500 Subject: [PATCH 01/16] Experiment with uploading artifacts --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b47fcc6..d6999be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,13 @@ jobs: uses: matlab-actions/run-tests@v2 with: select-by-folder: opentelemetry-matlab/test + - name: Compress into single artifact + run: tar -czf otel-matlab-ubuntu.tar.gz ${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: otel-matlab-ubuntu.tar.gz + path: otel-matlab-ubuntu.tar.gz build-and-run-tests-windows: runs-on: windows-latest env: From 317def35b253387a0c8d3381038557ef7dbf65d0 Mon Sep 17 00:00:00 2001 From: duncanpo Date: Mon, 26 Feb 2024 12:58:44 -0500 Subject: [PATCH 02/16] auto package into mltbx --- .github/workflows/build.yml | 52 +++++++++++++++++++++++++++++ tools/packageMatlabInterface.m | 61 ++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 tools/packageMatlabInterface.m diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6999be..6197a7d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,6 +68,13 @@ jobs: uses: matlab-actions/run-tests@v2 with: select-by-folder: opentelemetry-matlab/test + - name: Compress into single artifact + run: tar -czf otel-matlab-windows.tar.gz ${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: otel-matlab-windows.tar.gz + path: otel-matlab-windows.tar.gz build-and-run-tests-macos: runs-on: macos-latest env: @@ -94,3 +101,48 @@ jobs: uses: matlab-actions/run-tests@v2 with: select-by-folder: opentelemetry-matlab/test + - name: Compress into single artifact + run: tar -czf otel-matlab-macos.tar.gz ${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: otel-matlab-macos.tar.gz + path: otel-matlab-macos.tar.gz + package-mltbx: + name: Package MATLAB Toolbox (MLTBX) Files + runs-on: ubuntu-latest + needs: + - build-and-run-tests-ubuntu + - build-and-run-tests-windows + - build-and-run-tests-macos + env: + OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" + steps: + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts-downloaded + - name: Decompress Artifacts + run: | + mv artifacts-downloaded/*/*.tar.gz . + tar -xzf otel-matlab-ubuntu.tar.gz + tar -xzf otel-matlab-macos.tar.gz + tar -xzf otel-matlab-windows.tar.gz + - name: Install MATLAB + uses: matlab-actions/setup-matlab@v1 + with: + release: R2023a + - name: Run commands + env: + MATLABPATH: OpenTelemetry-Matlab/tools + OTEL_MATLAB_TOOLBOX_FOLDER: ${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER: + OTEL_MATLAB_TOOLBOX_VERSION: 1.6.0 + uses: matlab-actions/run-command@v1 + with: + command: packageMatlabInterface + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: otel-matlab.mltbx + path: otel-matlab.mltbx diff --git a/tools/packageMatlabInterface.m b/tools/packageMatlabInterface.m new file mode 100644 index 0000000..2822c24 --- /dev/null +++ b/tools/packageMatlabInterface.m @@ -0,0 +1,61 @@ +% Licensed to the Apache Software Foundation (ASF) under one +% or more contributor license agreements. See the NOTICE file +% distributed with this work for additional information +% regarding copyright ownership. The ASF licenses this file +% to you under the Apache License, Version 2.0 (the +% "License"); you may not use this file except in compliance +% with the License. You may obtain a copy of the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, +% software distributed under the License is distributed on an +% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +% KIND, either express or implied. See the License for the +% specific language governing permissions and limitations +% under the License. + +toolboxFolder = string(getenv("OTEL_MATLAB_TOOLBOX_FOLDER")); +outputFolder = string(getenv("OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER")); +toolboxVersionRaw = string(getenv("OTEL_MATLAB_TOOLBOX_VERSION")); + +% Output folder must exist. +mkdir(outputFolder); + +disp("Toolbox Folder: " + toolboxFolder); +disp("Output Folder: " + outputFolder); +disp("Toolbox Version Raw: " + toolboxVersionRaw); + +% Note: This string processing heuristic may not be robust to future +% changes in the versioning scheme. +dotIdx = strfind(toolboxVersionRaw, "."); +numDots = numel(dotIdx); +if numDots >= 3 + toolboxVersion = extractBefore(toolboxVersionRaw, dotIdx(3)); +else + toolboxVersion = toolboxVersionRaw; +end + +disp("Toolbox Version:" + toolboxVersion); + +identifier = "ad1d0fe6-22d1-4969-9e6f-0ab5d0f12ce3"; +opts = matlab.addons.toolbox.ToolboxOptions(toolboxFolder, identifier); +opts.ToolboxName = "MATLAB Interface to OpenTelemetry"; +opts.ToolboxVersion = toolboxVersion; +opts.AuthorName = ""; +opts.AuthorEmail = ""; + +% Set the SupportedPlatforms +opts.SupportedPlatforms.Win64 = true; +opts.SupportedPlatforms.Maci64 = true; +opts.SupportedPlatforms.Glnxa64 = true; +%opts.SupportedPlatforms.MatlabOnline = true; + +% Interface is only qualified against R2023a at the moment +opts.MinimumMatlabRelease = "R2023a"; +opts.MaximumMatlabRelease = "R2023a"; + +%opts.OutputFile = fullfile(outputFolder, compose("otel-matlab-%s.mltbx", toolboxVersionRaw)); +opts.OutputFile = fullfile(outputFolder, "otel-matlab.mltbx"); +disp("Output File: " + opts.OutputFile); +matlab.addons.toolbox.packageToolbox(opts); From c27487cd2f3b0df9731029351fe6a1580530f23b Mon Sep 17 00:00:00 2001 From: duncanpo Date: Mon, 26 Feb 2024 14:23:23 -0500 Subject: [PATCH 03/16] package into mltbx file --- .github/workflows/build.yml | 4 ++++ tools/packageMatlabInterface.m | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6197a7d..ff2a9fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -118,6 +118,10 @@ jobs: env: OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" steps: + - name: Checkout OpenTelemetry-Matlab + uses: actions/checkout@v4 + with: + path: OpenTelemetry-Matlab - name: Download Artifacts uses: actions/download-artifact@v3 with: diff --git a/tools/packageMatlabInterface.m b/tools/packageMatlabInterface.m index 2822c24..68f2d66 100644 --- a/tools/packageMatlabInterface.m +++ b/tools/packageMatlabInterface.m @@ -38,7 +38,7 @@ disp("Toolbox Version:" + toolboxVersion); -identifier = "ad1d0fe6-22d1-4969-9e6f-0ab5d0f12ce3"; +identifier = "dc2cae2f-4f43-4d2c-b6ed-f1a59f0dfcdf"; opts = matlab.addons.toolbox.ToolboxOptions(toolboxFolder, identifier); opts.ToolboxName = "MATLAB Interface to OpenTelemetry"; opts.ToolboxVersion = toolboxVersion; From 816eeb6de0346fdd7e8e135b623ec2be634c5786 Mon Sep 17 00:00:00 2001 From: duncanpo Date: Mon, 26 Feb 2024 17:50:00 -0500 Subject: [PATCH 04/16] package into .mltbx file --- .github/workflows/build.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff2a9fb..d857387 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,12 +36,13 @@ jobs: with: select-by-folder: opentelemetry-matlab/test - name: Compress into single artifact - run: tar -czf otel-matlab-ubuntu.tar.gz ${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + working-directory: ${{ github.workspace }} + run: tar -czf otel-matlab-ubuntu.tar.gz otel_matlab_install - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: otel-matlab-ubuntu.tar.gz - path: otel-matlab-ubuntu.tar.gz + path: ${{ github.workspace }}/otel-matlab-ubuntu.tar.gz build-and-run-tests-windows: runs-on: windows-latest env: @@ -69,12 +70,13 @@ jobs: with: select-by-folder: opentelemetry-matlab/test - name: Compress into single artifact - run: tar -czf otel-matlab-windows.tar.gz ${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + working-directory: ${{ github.workspace }} + run: tar -czf otel-matlab-windows.tar.gz otel_matlab_install - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: otel-matlab-windows.tar.gz - path: otel-matlab-windows.tar.gz + path: ${{ github.workspace }}/otel-matlab-windows.tar.gz build-and-run-tests-macos: runs-on: macos-latest env: @@ -102,12 +104,13 @@ jobs: with: select-by-folder: opentelemetry-matlab/test - name: Compress into single artifact - run: tar -czf otel-matlab-macos.tar.gz ${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + working-directory: ${{ github.workspace }} + run: tar -czf otel-matlab-macos.tar.gz otel_matlab_install - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: otel-matlab-macos.tar.gz - path: otel-matlab-macos.tar.gz + path: ${{ github.workspace }}/otel-matlab-macos.tar.gz package-mltbx: name: Package MATLAB Toolbox (MLTBX) Files runs-on: ubuntu-latest @@ -139,7 +142,7 @@ jobs: - name: Run commands env: MATLABPATH: OpenTelemetry-Matlab/tools - OTEL_MATLAB_TOOLBOX_FOLDER: ${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + OTEL_MATLAB_TOOLBOX_FOLDER: otel_matlab_install OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER: OTEL_MATLAB_TOOLBOX_VERSION: 1.6.0 uses: matlab-actions/run-command@v1 From ae2874ced084169b79c4a66431e0b6918d6d7ba6 Mon Sep 17 00:00:00 2001 From: duncanpo Date: Wed, 28 Feb 2024 10:15:34 -0500 Subject: [PATCH 05/16] Package into a .mltbx file --- .github/workflows/build.yml | 68 +----------------- .github/workflows/publish.yml | 128 +++++++++++++++++++++++++++++++++ tools/packageMatlabInterface.m | 49 ++++--------- 3 files changed, 143 insertions(+), 102 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d857387..26213b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: "OpenTelemetry-Matlab" +name: "Build and Run Tests" on: workflow_dispatch: push: @@ -35,14 +35,6 @@ jobs: uses: matlab-actions/run-tests@v2 with: select-by-folder: opentelemetry-matlab/test - - name: Compress into single artifact - working-directory: ${{ github.workspace }} - run: tar -czf otel-matlab-ubuntu.tar.gz otel_matlab_install - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: otel-matlab-ubuntu.tar.gz - path: ${{ github.workspace }}/otel-matlab-ubuntu.tar.gz build-and-run-tests-windows: runs-on: windows-latest env: @@ -69,14 +61,6 @@ jobs: uses: matlab-actions/run-tests@v2 with: select-by-folder: opentelemetry-matlab/test - - name: Compress into single artifact - working-directory: ${{ github.workspace }} - run: tar -czf otel-matlab-windows.tar.gz otel_matlab_install - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: otel-matlab-windows.tar.gz - path: ${{ github.workspace }}/otel-matlab-windows.tar.gz build-and-run-tests-macos: runs-on: macos-latest env: @@ -103,53 +87,3 @@ jobs: uses: matlab-actions/run-tests@v2 with: select-by-folder: opentelemetry-matlab/test - - name: Compress into single artifact - working-directory: ${{ github.workspace }} - run: tar -czf otel-matlab-macos.tar.gz otel_matlab_install - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: otel-matlab-macos.tar.gz - path: ${{ github.workspace }}/otel-matlab-macos.tar.gz - package-mltbx: - name: Package MATLAB Toolbox (MLTBX) Files - runs-on: ubuntu-latest - needs: - - build-and-run-tests-ubuntu - - build-and-run-tests-windows - - build-and-run-tests-macos - env: - OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" - steps: - - name: Checkout OpenTelemetry-Matlab - uses: actions/checkout@v4 - with: - path: OpenTelemetry-Matlab - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts-downloaded - - name: Decompress Artifacts - run: | - mv artifacts-downloaded/*/*.tar.gz . - tar -xzf otel-matlab-ubuntu.tar.gz - tar -xzf otel-matlab-macos.tar.gz - tar -xzf otel-matlab-windows.tar.gz - - name: Install MATLAB - uses: matlab-actions/setup-matlab@v1 - with: - release: R2023a - - name: Run commands - env: - MATLABPATH: OpenTelemetry-Matlab/tools - OTEL_MATLAB_TOOLBOX_FOLDER: otel_matlab_install - OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER: - OTEL_MATLAB_TOOLBOX_VERSION: 1.6.0 - uses: matlab-actions/run-command@v1 - with: - command: packageMatlabInterface - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: otel-matlab.mltbx - path: otel-matlab.mltbx diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6eb03ee --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,128 @@ +name: "Publish" +on: + workflow_dispatch: + push: + branches: + - package +jobs: + build-ubuntu: + runs-on: ubuntu-latest + env: + OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" + SYSTEM_LIBSTDCPP_PATH: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6" + steps: + - name: Download OpenTelemetry-Matlab source + uses: actions/checkout@v3 + with: + path: opentelemetry-matlab + - name: Install MATLAB + uses: matlab-actions/setup-matlab@v2 + with: + products: MATLAB_Compiler + - name: Build OpenTelemetry-Matlab + run: | + cd opentelemetry-matlab + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + cmake --build build --config Release --target install + - name: Compress into single artifact + working-directory: ${{ github.workspace }} + run: tar -czf otel-matlab-ubuntu.tar.gz otel_matlab_install + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: otel-matlab-ubuntu.tar.gz + path: ${{ github.workspace }}/otel-matlab-ubuntu.tar.gz + build-windows: + runs-on: windows-latest + env: + OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" + steps: + - name: Download OpenTelemetry-Matlab source + uses: actions/checkout@v3 + with: + path: opentelemetry-matlab + - name: Install MATLAB + uses: matlab-actions/setup-matlab@v2 + with: + products: MATLAB_Compiler + - name: Build OpenTelemetry-Matlab + run: | + cd opentelemetry-matlab + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + cmake --build build --config Release --target install + - name: Compress into single artifact + working-directory: ${{ github.workspace }} + run: tar -czf otel-matlab-windows.tar.gz otel_matlab_install + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: otel-matlab-windows.tar.gz + path: ${{ github.workspace }}/otel-matlab-windows.tar.gz + build-macos: + runs-on: macos-latest + env: + OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" + steps: + - name: Download OpenTelemetry-Matlab source + uses: actions/checkout@v3 + with: + path: opentelemetry-matlab + - name: Install MATLAB + uses: matlab-actions/setup-matlab@v2 + with: + products: MATLAB_Compiler + - name: Build OpenTelemetry-Matlab + run: | + cd opentelemetry-matlab + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }} + cmake --build build --config Release --target install + - name: Compress into single artifact + working-directory: ${{ github.workspace }} + run: tar -czf otel-matlab-macos.tar.gz otel_matlab_install + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: otel-matlab-macos.tar.gz + path: ${{ github.workspace }}/otel-matlab-macos.tar.gz + package-mltbx: + name: Package MATLAB Toolbox (MLTBX) Files + runs-on: ubuntu-latest + needs: + - build-ubuntu + - build-windows + - build-macos + env: + OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" + steps: + - name: Checkout OpenTelemetry-Matlab + uses: actions/checkout@v3 + with: + path: OpenTelemetry-Matlab + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts-downloaded + - name: Decompress Artifacts + run: | + mv artifacts-downloaded/*/*.tar.gz . + tar -xzf otel-matlab-ubuntu.tar.gz + tar -xzf otel-matlab-macos.tar.gz + tar -xzf otel-matlab-windows.tar.gz + - name: Install MATLAB + uses: matlab-actions/setup-matlab@v1 + with: + release: R2023a + - name: Run commands + env: + MATLABPATH: OpenTelemetry-Matlab/tools + OTEL_MATLAB_TOOLBOX_FOLDER: otel_matlab_install + OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER: + OTEL_MATLAB_TOOLBOX_VERSION: 1.6.0 + uses: matlab-actions/run-command@v1 + with: + command: packageMatlabInterface + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: otel-matlab.mltbx + path: otel-matlab.mltbx diff --git a/tools/packageMatlabInterface.m b/tools/packageMatlabInterface.m index 68f2d66..d3dce48 100644 --- a/tools/packageMatlabInterface.m +++ b/tools/packageMatlabInterface.m @@ -1,61 +1,40 @@ -% Licensed to the Apache Software Foundation (ASF) under one -% or more contributor license agreements. See the NOTICE file -% distributed with this work for additional information -% regarding copyright ownership. The ASF licenses this file -% to you under the Apache License, Version 2.0 (the -% "License"); you may not use this file except in compliance -% with the License. You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, -% software distributed under the License is distributed on an -% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -% KIND, either express or implied. See the License for the -% specific language governing permissions and limitations -% under the License. +% packageMatlabInterface.m +% This script packages installed files for OpenTelemetry interface and +% package them into a single .mltbx file. The location of the installed +% files is taken from environment variable OTEL_MATLAB_TOOLBOX_FOLDER and +% the resulting .mltbx file location is taken from environment variable +% OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER. + +% Copyright 2024 The MathWorks, Inc. toolboxFolder = string(getenv("OTEL_MATLAB_TOOLBOX_FOLDER")); outputFolder = string(getenv("OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER")); -toolboxVersionRaw = string(getenv("OTEL_MATLAB_TOOLBOX_VERSION")); +toolboxVersion = string(getenv("OTEL_MATLAB_TOOLBOX_VERSION")); % Output folder must exist. mkdir(outputFolder); disp("Toolbox Folder: " + toolboxFolder); disp("Output Folder: " + outputFolder); -disp("Toolbox Version Raw: " + toolboxVersionRaw); - -% Note: This string processing heuristic may not be robust to future -% changes in the versioning scheme. -dotIdx = strfind(toolboxVersionRaw, "."); -numDots = numel(dotIdx); -if numDots >= 3 - toolboxVersion = extractBefore(toolboxVersionRaw, dotIdx(3)); -else - toolboxVersion = toolboxVersionRaw; -end - disp("Toolbox Version:" + toolboxVersion); identifier = "dc2cae2f-4f43-4d2c-b6ed-f1a59f0dfcdf"; opts = matlab.addons.toolbox.ToolboxOptions(toolboxFolder, identifier); opts.ToolboxName = "MATLAB Interface to OpenTelemetry"; opts.ToolboxVersion = toolboxVersion; -opts.AuthorName = ""; +opts.ToolboxMatlabPath = toolboxFolder; +disp("Toolbox MATLAB Path: " + opts.ToolboxMatlabPath); +opts.AuthorName = "MathWorks DevOps Team"; opts.AuthorEmail = ""; % Set the SupportedPlatforms opts.SupportedPlatforms.Win64 = true; opts.SupportedPlatforms.Maci64 = true; opts.SupportedPlatforms.Glnxa64 = true; -%opts.SupportedPlatforms.MatlabOnline = true; +opts.SupportedPlatforms.MatlabOnline = false; -% Interface is only qualified against R2023a at the moment -opts.MinimumMatlabRelease = "R2023a"; -opts.MaximumMatlabRelease = "R2023a"; +opts.MinimumMatlabRelease = "R2022a"; -%opts.OutputFile = fullfile(outputFolder, compose("otel-matlab-%s.mltbx", toolboxVersionRaw)); opts.OutputFile = fullfile(outputFolder, "otel-matlab.mltbx"); disp("Output File: " + opts.OutputFile); matlab.addons.toolbox.packageToolbox(opts); From 4eee25996edb36994d9d3ab6655c285db39dd80f Mon Sep 17 00:00:00 2001 From: duncanpo Date: Wed, 28 Feb 2024 11:52:31 -0500 Subject: [PATCH 06/16] Package into .mltbx file --- .github/workflows/publish.yml | 7 +++---- tools/packageMatlabInterface.m | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6eb03ee..f123b64 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,7 +9,6 @@ jobs: runs-on: ubuntu-latest env: OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" - SYSTEM_LIBSTDCPP_PATH: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6" steps: - name: Download OpenTelemetry-Matlab source uses: actions/checkout@v3 @@ -105,9 +104,9 @@ jobs: - name: Decompress Artifacts run: | mv artifacts-downloaded/*/*.tar.gz . - tar -xzf otel-matlab-ubuntu.tar.gz - tar -xzf otel-matlab-macos.tar.gz - tar -xzf otel-matlab-windows.tar.gz + tar -xzvf otel-matlab-ubuntu.tar.gz + tar -xzvf otel-matlab-macos.tar.gz + tar -xzvf otel-matlab-windows.tar.gz - name: Install MATLAB uses: matlab-actions/setup-matlab@v1 with: diff --git a/tools/packageMatlabInterface.m b/tools/packageMatlabInterface.m index d3dce48..ff23a11 100644 --- a/tools/packageMatlabInterface.m +++ b/tools/packageMatlabInterface.m @@ -22,6 +22,9 @@ opts = matlab.addons.toolbox.ToolboxOptions(toolboxFolder, identifier); opts.ToolboxName = "MATLAB Interface to OpenTelemetry"; opts.ToolboxVersion = toolboxVersion; +disp("Toolbox Files:"); +disp(opts.ToolboxFiles); +disp("Toolbox MATLAB Path (original): " + opts.ToolboxMatlabPath); opts.ToolboxMatlabPath = toolboxFolder; disp("Toolbox MATLAB Path: " + opts.ToolboxMatlabPath); opts.AuthorName = "MathWorks DevOps Team"; From 259c214822e6e6e6800b13a2caed959599432cdd Mon Sep 17 00:00:00 2001 From: duncanpo Date: Wed, 28 Feb 2024 12:57:37 -0500 Subject: [PATCH 07/16] Add debug info --- tools/packageMatlabInterface.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/packageMatlabInterface.m b/tools/packageMatlabInterface.m index ff23a11..0efbd89 100644 --- a/tools/packageMatlabInterface.m +++ b/tools/packageMatlabInterface.m @@ -24,8 +24,12 @@ opts.ToolboxVersion = toolboxVersion; disp("Toolbox Files:"); disp(opts.ToolboxFiles); -disp("Toolbox MATLAB Path (original): " + opts.ToolboxMatlabPath); -opts.ToolboxMatlabPath = toolboxFolder; +%disp("Toolbox MATLAB Path (original): " + opts.ToolboxMatlabPath); +%opts.ToolboxMatlabPath = toolboxFolder; +disp("Options object:"); +disp(opts); +disp("pwd: " + pwd); +dir disp("Toolbox MATLAB Path: " + opts.ToolboxMatlabPath); opts.AuthorName = "MathWorks DevOps Team"; opts.AuthorEmail = ""; From f3439387a1cbe2856a11b86c1bb96257c1f0a20d Mon Sep 17 00:00:00 2001 From: duncanpo Date: Thu, 29 Feb 2024 10:42:49 -0500 Subject: [PATCH 08/16] remove debug information --- .github/workflows/publish.yml | 2 -- tools/packageMatlabInterface.m | 9 --------- 2 files changed, 11 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f123b64..6c77942 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -109,8 +109,6 @@ jobs: tar -xzvf otel-matlab-windows.tar.gz - name: Install MATLAB uses: matlab-actions/setup-matlab@v1 - with: - release: R2023a - name: Run commands env: MATLABPATH: OpenTelemetry-Matlab/tools diff --git a/tools/packageMatlabInterface.m b/tools/packageMatlabInterface.m index 0efbd89..76adc44 100644 --- a/tools/packageMatlabInterface.m +++ b/tools/packageMatlabInterface.m @@ -22,15 +22,6 @@ opts = matlab.addons.toolbox.ToolboxOptions(toolboxFolder, identifier); opts.ToolboxName = "MATLAB Interface to OpenTelemetry"; opts.ToolboxVersion = toolboxVersion; -disp("Toolbox Files:"); -disp(opts.ToolboxFiles); -%disp("Toolbox MATLAB Path (original): " + opts.ToolboxMatlabPath); -%opts.ToolboxMatlabPath = toolboxFolder; -disp("Options object:"); -disp(opts); -disp("pwd: " + pwd); -dir -disp("Toolbox MATLAB Path: " + opts.ToolboxMatlabPath); opts.AuthorName = "MathWorks DevOps Team"; opts.AuthorEmail = ""; From 49a7373e96087256c431c42fecacbc7d287b7563 Mon Sep 17 00:00:00 2001 From: duncanpo Date: Thu, 29 Feb 2024 10:44:46 -0500 Subject: [PATCH 09/16] rename build.yml and build_and_test.yml --- .github/workflows/{build.yml => build_and_test.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{build.yml => build_and_test.yml} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build_and_test.yml similarity index 100% rename from .github/workflows/build.yml rename to .github/workflows/build_and_test.yml From c294b3e8509967a64f3571194e641ef068dcb682 Mon Sep 17 00:00:00 2001 From: duncanpo Date: Thu, 29 Feb 2024 15:14:35 -0500 Subject: [PATCH 10/16] simplify changing version number --- .github/workflows/publish.yml | 5 ++++- CMakeLists.txt | 25 +++++++++++++++++-------- sdk/common/src/resource.cpp | 4 +--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6c77942..ed43100 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -97,6 +97,9 @@ jobs: uses: actions/checkout@v3 with: path: OpenTelemetry-Matlab + - name: Read version + id: getversion + run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT - name: Download Artifacts uses: actions/download-artifact@v3 with: @@ -114,7 +117,7 @@ jobs: MATLABPATH: OpenTelemetry-Matlab/tools OTEL_MATLAB_TOOLBOX_FOLDER: otel_matlab_install OTEL_MATLAB_TOOLBOX_OUTPUT_FOLDER: - OTEL_MATLAB_TOOLBOX_VERSION: 1.6.0 + OTEL_MATLAB_TOOLBOX_VERSION: ${{ steps.getversion.outputs.version }} uses: matlab-actions/run-command@v1 with: command: packageMatlabInterface diff --git a/CMakeLists.txt b/CMakeLists.txt index b4bc2a8..15ce28b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,12 @@ endif() set(CLIENT_PROJECT_NAME otel-matlab) -project(${CLIENT_PROJECT_NAME} VERSION 0.1.0) +# read version number +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/VERSION OTEL_MATLAB_VERSION_RAW) +string(STRIP ${OTEL_MATLAB_VERSION_RAW} OTEL_MATLAB_VERSION) + + +project(${CLIENT_PROJECT_NAME} VERSION ${OTEL_MATLAB_VERSION}) # ###################################### # libmexclass @@ -270,17 +275,16 @@ if(WITH_OTLP_GRPC) set(OTLP_MACROS ${OTLP_MACROS} "-D WITH_OTLP_GRPC ") endif() endif() - -# On Windows, suppress a compiler warning about deprecation of result_of -if(WIN32) - set(CUSTOM_CXX_FLAGS -D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING) -else() - set(CUSTOM_CXX_FLAGS "") -endif() if(WIN32) + # On Windows, suppress a compiler warning about deprecation of result_of + set(CUSTOM_CXX_FLAGS -D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING) + # pass in version number + set(OTLP_MACROS ${OTLP_MACROS} /DOTEL_MATLAB_VERSION="${OTEL_MATLAB_VERSION}") set(OTEL_PROTO_LIBRARY_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX}) else() + set(CUSTOM_CXX_FLAGS "") + set(OTLP_MACROS ${OTLP_MACROS} "-D OTEL_MATLAB_VERSION=\"${OTEL_MATLAB_VERSION}\"") set(OTEL_PROTO_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() @@ -412,6 +416,7 @@ set(OTLP_GRPC_EXPORTER_MATLAB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/exporters/otlp/+opentelemetry/+exporters/+otlp/OtlpGrpcSpanExporter.m ${CMAKE_CURRENT_SOURCE_DIR}/exporters/otlp/+opentelemetry/+exporters/+otlp/OtlpGrpcMetricExporter.m ${CMAKE_CURRENT_SOURCE_DIR}/exporters/otlp/+opentelemetry/+exporters/+otlp/OtlpGrpcValidator.m) +set(OTLP_MISC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/VERSION) set(OTLP_EXPORTERS_DIR +opentelemetry/+exporters/+otlp) @@ -430,6 +435,10 @@ endif() if(WITH_OTLP_GRPC) install(FILES ${OTLP_GRPC_EXPORTER_MATLAB_SOURCES} DESTINATION ${OTLP_EXPORTERS_DIR}) endif() +# Install license and version. The only reason these are needed is to work around a packaging bug where if +# all files are in packages (+xxx directories), matlab.addons.toolbox.packageToolbox refuses to add the +# toolbox path into MATLAB path. This issue is fixed in R2024a +install(FILES ${OTLP_MISC_FILES} DESTINATION .) # Install dependent runtime libraries set(LIBMEXCLASS_PROXY_INSTALLED_DIR +libmexclass/+proxy) diff --git a/sdk/common/src/resource.cpp b/sdk/common/src/resource.cpp index 7e74227..e2f760f 100644 --- a/sdk/common/src/resource.cpp +++ b/sdk/common/src/resource.cpp @@ -1,4 +1,4 @@ -// Copyright 2023 The MathWorks, Inc. +// Copyright 2023-2024 The MathWorks, Inc. #include @@ -8,8 +8,6 @@ #include "opentelemetry/common/attribute_value.h" #include "opentelemetry/nostd/string_view.h" -#define OTEL_MATLAB_VERSION "1.2.0" - namespace common = opentelemetry::common; namespace nostd = opentelemetry::nostd; From ef8884916baf10d64f64393aed0e162188859a8b Mon Sep 17 00:00:00 2001 From: duncanpo Date: Thu, 29 Feb 2024 15:15:14 -0500 Subject: [PATCH 11/16] simplify changing version number --- VERSION | 1 + 1 file changed, 1 insertion(+) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..9c6d629 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.6.1 From ac7e5d15484b3fd11a494e357c144559d5fc789c Mon Sep 17 00:00:00 2001 From: duncanpo Date: Thu, 29 Feb 2024 17:09:13 -0500 Subject: [PATCH 12/16] Update opentelemetry-cpp to 1.14.2 --- .github/workflows/publish.yml | 2 +- CMakeLists.txt | 6 +++--- README.md | 1 - VERSION => VERSION.txt | 0 test/tmetrics.m | 5 ----- test/ttrace.m | 3 ++- 6 files changed, 6 insertions(+), 11 deletions(-) rename VERSION => VERSION.txt (100%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ed43100..f6c1955 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -99,7 +99,7 @@ jobs: path: OpenTelemetry-Matlab - name: Read version id: getversion - run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT + run: echo "version=$(cat VERSION.txt)" >> $GITHUB_OUTPUT - name: Download Artifacts uses: actions/download-artifact@v3 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 15ce28b..9d50cb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,7 +89,7 @@ endif() set(CLIENT_PROJECT_NAME otel-matlab) # read version number -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/VERSION OTEL_MATLAB_VERSION_RAW) +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt OTEL_MATLAB_VERSION_RAW) string(STRIP ${OTEL_MATLAB_VERSION_RAW} OTEL_MATLAB_VERSION) @@ -130,7 +130,7 @@ else() include(ExternalProject) set(OTEL_CPP_PROJECT_NAME opentelemetry-cpp) set(OTEL_CPP_GIT_REPOSITORY "https://github.com/open-telemetry/opentelemetry-cpp.git") - set(OTEL_CPP_GIT_TAG "e1119ed") + set(OTEL_CPP_GIT_TAG "a799f4a") if(DEFINED OTEL_CPP_PREFIX) string(REPLACE "\\" "/" OTEL_CPP_PREFIX ${OTEL_CPP_PREFIX}) @@ -416,7 +416,7 @@ set(OTLP_GRPC_EXPORTER_MATLAB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/exporters/otlp/+opentelemetry/+exporters/+otlp/OtlpGrpcSpanExporter.m ${CMAKE_CURRENT_SOURCE_DIR}/exporters/otlp/+opentelemetry/+exporters/+otlp/OtlpGrpcMetricExporter.m ${CMAKE_CURRENT_SOURCE_DIR}/exporters/otlp/+opentelemetry/+exporters/+otlp/OtlpGrpcValidator.m) -set(OTLP_MISC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/VERSION) +set(OTLP_MISC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt) set(OTLP_EXPORTERS_DIR +opentelemetry/+exporters/+otlp) diff --git a/README.md b/README.md index 32bb588..579c67c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ MATLAB® interface to [OpenTelemetry™](https://opentelemetry.io/), base ### Status - Tracing and metrics are fully supported. Logs will be in the future. - Supported and tested on Windows®, Linux®, and macOS. -- Attributes in asynchronous metric instruments are currently ignored because of an issue in the opentelemetry-cpp layer. ### MathWorks Products (https://www.mathworks.com) diff --git a/VERSION b/VERSION.txt similarity index 100% rename from VERSION rename to VERSION.txt diff --git a/test/tmetrics.m b/test/tmetrics.m index a9affb4..4362a9a 100644 --- a/test/tmetrics.m +++ b/test/tmetrics.m @@ -541,9 +541,6 @@ function testAsynchronousInstrumentBasic(testCase, create_async, datapoint_name) function testAsynchronousInstrumentAttributes(testCase, create_async, datapoint_name) % test for attributes when observing metrics for an observable counter - - testCase.assumeTrue(false, "Asynchronous metrics attributes incorrectly ignored due to issue in opentelemetry-cpp 1.14.0"); - countername = "bar"; callback = @callbackWithAttributes; @@ -604,8 +601,6 @@ function testAsynchronousInstrumentAnonymousCallback(testCase, create_async, dat function testAsynchronousInstrumentMultipleCallbacks(testCase, create_async, datapoint_name) % Observable counter with more than one callbacks - testCase.assumeTrue(false, "Asynchronous metrics attributes incorrectly ignored due to issue in opentelemetry-cpp 1.14.0"); - countername = "bar"; p = opentelemetry.sdk.metrics.MeterProvider(testCase.ShortIntervalReader); diff --git a/test/ttrace.m b/test/ttrace.m index f3ad617..62b8016 100644 --- a/test/ttrace.m +++ b/test/ttrace.m @@ -88,7 +88,8 @@ function testBasic(testCase) versionidx = find(resourcekeys == "telemetry.sdk.version"); verifyNotEmpty(testCase, versionidx); - verifyEqual(testCase, results.resourceSpans.resource.attributes(versionidx).value.stringValue, '1.2.0'); + versionstr = strip(fileread(fullfile("..", "VERSION.txt"))); + verifyEqual(testCase, results.resourceSpans.resource.attributes(versionidx).value.stringValue, versionstr); nameidx = find(resourcekeys == "telemetry.sdk.name"); verifyNotEmpty(testCase, nameidx); From 6db9ae25f9008ca0d35e31ebaa6528df7f3e5ce5 Mon Sep 17 00:00:00 2001 From: duncanpo Date: Thu, 29 Feb 2024 18:05:52 -0500 Subject: [PATCH 13/16] Fix a problem in packaging --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f6c1955..1e362e6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -99,6 +99,7 @@ jobs: path: OpenTelemetry-Matlab - name: Read version id: getversion + working-directory: OpenTelemetry-Matlab run: echo "version=$(cat VERSION.txt)" >> $GITHUB_OUTPUT - name: Download Artifacts uses: actions/download-artifact@v3 From a6d1b01794676d2d78f3f3de1b67a3af42a0f5bc Mon Sep 17 00:00:00 2001 From: duncanpo Date: Fri, 1 Mar 2024 08:36:29 -0500 Subject: [PATCH 14/16] Fix incompatible glibc issue --- .github/workflows/build_and_test.yml | 9 +++------ .github/workflows/publish.yml | 6 ++++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 26213b3..8d90430 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -4,7 +4,9 @@ on: push: jobs: build-and-run-tests-ubuntu: - runs-on: ubuntu-latest + # Running on ubuntu-latest would use a glibc version that is incompatible when using the built mex files on a Debian 11 + # Instead, run on ubuntu-20.04 + runs-on: ubuntu-20.04 env: OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" SYSTEM_LIBSTDCPP_PATH: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6" @@ -24,11 +26,6 @@ jobs: cmake --build build --config Release --target install - name: Run tests env: - # The version of libstdc++ that is bundled with MATLAB is used when building MEX files. - # This version of libstdc++ is incompatible with the system version of libstdc++. - # As a workaround, set LD_PRELOAD to use the system version of libstdc++ with MATLAB. - LD_PRELOAD: ${{ env.SYSTEM_LIBSTDCPP_PATH }} - # Add the installation directory to the MATLAB Search Path by # setting the MATLABPATH environment variable. MATLABPATH: ${{ env.OPENTELEMETRY_MATLAB_INSTALL }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1e362e6..75a0d48 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,7 +6,9 @@ on: - package jobs: build-ubuntu: - runs-on: ubuntu-latest + # Running on ubuntu-latest would use a glibc version that is incompatible when using the built mex files on a Debian 11 + # Instead, run on ubuntu-20.04 + runs-on: ubuntu-20.04 env: OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install" steps: @@ -85,7 +87,7 @@ jobs: path: ${{ github.workspace }}/otel-matlab-macos.tar.gz package-mltbx: name: Package MATLAB Toolbox (MLTBX) Files - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 needs: - build-ubuntu - build-windows From c303c297d72102ce360512990b7a125730f15318 Mon Sep 17 00:00:00 2001 From: duncanpo Date: Fri, 1 Mar 2024 08:37:37 -0500 Subject: [PATCH 15/16] rename publish workflow --- .github/workflows/{publish.yml => publish_mltbx.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{publish.yml => publish_mltbx.yml} (100%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish_mltbx.yml similarity index 100% rename from .github/workflows/publish.yml rename to .github/workflows/publish_mltbx.yml From 6409673d818158d9816809338a2e71245f789ce5 Mon Sep 17 00:00:00 2001 From: duncanpo Date: Fri, 1 Mar 2024 12:47:23 -0500 Subject: [PATCH 16/16] Publish .mltbx file --- .github/workflows/publish_mltbx.yml | 19 +++++++++++-------- README.md | 7 +++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish_mltbx.yml b/.github/workflows/publish_mltbx.yml index 75a0d48..a506083 100644 --- a/.github/workflows/publish_mltbx.yml +++ b/.github/workflows/publish_mltbx.yml @@ -1,9 +1,8 @@ -name: "Publish" +name: "Publish mltbx" on: workflow_dispatch: - push: - branches: - - package + release: + types: published jobs: build-ubuntu: # Running on ubuntu-latest would use a glibc version that is incompatible when using the built mex files on a Debian 11 @@ -124,8 +123,12 @@ jobs: uses: matlab-actions/run-command@v1 with: command: packageMatlabInterface - - name: Upload artifacts - uses: actions/upload-artifact@v2 + - name: Compress Asset + run: zip otel-matlab-${{ github.event.release.tag_name }}.mltbx.zip otel-matlab.mltbx + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 with: - name: otel-matlab.mltbx - path: otel-matlab.mltbx + upload_url: https://uploads.github.com/repos/mathworks/OpenTelemetry-Matlab/releases/${{ github.event.release.id }}/assets{?name,label}` + asset_path: ./otel-matlab-${{ github.event.release.tag_name }}.mltbx.zip + asset_name: otel-matlab-${{ github.event.release.tag_name }}.mltbx.zip + asset_content_type: application/zip diff --git a/README.md b/README.md index 579c67c..772fd73 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,13 @@ Requires MATLAB release R2022b or newer ## Installation Installation instructions +### Installing With Toolbox Package +1. Under "Assets" of a release, download the toolbox package .mltbx file. +2. Start MATLAB. +3. In the Current Folder browser, navigate to the .mltbx file. +4. Right click on the .mltbx file and select "Install". + +### Building From Source Before proceeding, ensure that the below products are installed: * [MATLAB](https://www.mathworks.com/products/matlab.html)