Flux VS Code Extension

Search for a command to run...

No comments yet. Be the first to comment.
Bun, the hyper-fast JavaScript runtime known for its incredible speed and Zig-based architecture, is being completely rewritten in Rust. For a project that has over 22 million monthly downloads and ea

Next.js 16.3 is almost here, and it's packed with a ton of improvements and let's see them in this post 1.Instant Navigation For a while now, there’s been a valid, lingering debateServer Components vs

It’s official. React has merged its long-awaited Rust port of the React Compiler (formerly known as React Forget) into the main repository. What started as an experimental research project by Joseph S

If you follow modern technology trends, you have likely been led to believe that artificial intelligence is entirely built on Python. Every tutorial, machine learning framework documentation, and open

Just when the JavaScript ecosystem was catching its breath after last week’s TanStack Router compromise, the Mini Shai-Hulud supply chain worm has continued its relentless march. Developed by the thre

Source: Nidhinkumar
If you don’t have time to read but want to know what’s there in this post. Find the quick read 👇

Quick Read
In, this blog we will see how to install the Flux Extension in VS Code and make connections to InfluxDB and write queries.
If you are new to InfluxDB check out the below blogs before reading this one 👇
InfluxDB (TICK Stack) — Part1
Overviewmedium.com
InfluxDB with some data
VS Code Text Editor
Installing Flux Extension
Connecting InfluxDB with VS Code
Writing Flux Query in VS Code

Open VS Code Editor and then click Extensions and then type Flux like below

Flux Extension
Click Install to install the Flux extension

Flux Extension
Once the extension is installed successfully you could see the InfluxDB on the sidebar like the below image

InfluxDB
Click the ‘+’ button to add a new connection.

Now, we will connect the InfluxDB in VS Code. Click the ‘+’ button or by using the command palette (Ctrl + Shift + p) and then click the Add new connection.

Add new connection
Now select the connection and then add the InfluxDB token and then click the Test connection to check the connection.

Test Connection
Once the connection is successful you could see the buckets and measurements that are available in the given organization like below

Influx Buckets

Now, will write the Flux query to check whether we can get the data from InfluxDB.
Create a new file in VS Code Editor with extension as .flux and write your flux query.
from(bucket: "systemmetric")
|> range(start: -1h, stop: now())
|> filter(fn: (r) => r["_measurement"] == "cpu")
|> filter(fn: (r) => r["cpu"] == "cpu-total")
|> filter(fn: (r) => r["_field"] == "usage_user")
|> aggregateWindow(every: 1h, fn: mean, createEmpty: false)
|> yield(name: "mean")
Now run the flux query using the command Ctrl + Alt + E. Now you could see the result like below.

Flux Output
You have learned how to use the Flux Extension in VS Code. Will Catch you up in a new post till then Happy Learning:)