Setting up a Basic File Transfer Extension

Introduction

To showcase the Opentelemetry functionality, we will be creating a basic, contrived Extension that transfer files locally from one folder to another.

Step 1 -  Initializing the OtelDemo Extension

Go ahead and navigate to a directory where you would like to store the Extension. Download the attached Extension template below.

Now, we will create an Extension based off the OtelDemo Extension template. Open up the terminal to that folder and run

uip init -t <path to OtelDemoTemplate.zip> OtelDemoExt

This command should create a folder named OtelDemoExt with the Extension inside of it. 

Now would be a good time to go through src/extension.py and see how/what it's doing.

Step 3 - Testing the Extension

We will test the Extension using the UIP VSCode Plugin debugger.

Go ahead and open the folder containing the Extension in VSCode. It is assumed that the new Universal Extension Bundle 2.1.0, containing API Level 1.5.0, is installed, and the 1.5.0 API level is selected.

Once opened, press F5 and add a debug configuration as follows:

configurations.yml
api:
  extension_start:
    - name: es1
      log_level: Inherited
      runtime_dir: /home/shrey/dev/extensions/test/OtelDemoTest
      fields:
        src_folder: /tmp/test_src
        dst_folder: /tmp/test_dst
        file_type:
          - txt

We will be transferring all *.txt files from /tmp/test_src to /tmp/test_dst. Ensure the source and destination directories exist, and the source folder contains a.txtb.txtc.zipd.jsone.yaml.

Debug the es1 target, and you should see a.txt and b.txt transferred to the /tmp/test_dst. Inspect the UIP Debug output channels to ensure everything worked as expected.

< Prev    Next >