...
Panel | ||||
---|---|---|---|---|
|
Prerequisites
It is assumed the following are installed and configured properly:
- Opentelemetry Collector
- Jaeger
- Prometheus
- Grafana
- Universal Agent 7.5.0.0 or higher
- Universal Controller 7.5.0.0 or higher
- UIP-CLI
It is highly recommended to first go through The Basics, if this is the first time you are creating an Extension.
Introduction
To showcase the Opentelemetry functionality, we will be working with creating a basic File Monitor , contrived Extension that can monitor for creation and deletion of filestransfer files locally from one folder to another.
Step 1 -
...
Initializing the OtelDemo
Extension
To create a custom starter template, we will first make use of the built-in ue-task
Go ahead and navigate to a directory where you would like to store the Extension. Download the attached Extension template below.
View file | ||||
---|---|---|---|---|
|
Now, we will create an Extension based off the OtelDemo
Extension template. Open up the terminal to the demo_template
that folder and run
Code Block |
---|
uip init -t ue-task -e "extension_name=my_custom_ext" -e "universal_template_name=my_custom_template" |
The di
<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:
Code Block | ||||
---|---|---|---|---|
| ||||
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.txt
, b.txt
, c.zip
, d.json
, e.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.