There’s a number of times we might want to use Grafana for visualization our data for better research. As a QA engineer, when doing load test our services, I use Grafana with InfluxDB and Graphite in Gatling.

First thing first, to trigger up InfluxDB with Graphite plugin, use this command.

docker run -p 8086:8086 -p 2003:2003 \
-e INFLUXDB_GRAPHITE_ENABLED=true \
influxdb

Run command line in Docker to check graphite db is created

docker exec -it {influxdb_process_ID} influx
Image for post
Image for post

Some configuration in Grafana

  • Data sources configuration
Image for post
Image for post
  • Dashboard settings
Image for post
Image for post

And here we go

Image for post
Image for post

That’s it.

Hope it helps.

~~ PEACE ~~


Recently I met the issue where it stated like this from the log

Found an incorrect Java versionJava version found 11.0.9.1

This is related to the configuration of Jenkins from /etc/init.d/jenkins

The current configuration for JAVA_VERSION is like

JAVA_VERSION=$($JAVA -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*".*/\1\2/p;')

Changed to below made the trick

JAVA_VERSION=$($JAVA -version 2>&1 | sed -n ';s/.* version "\([0-9]*\)\.\([0-9]*\)\..*".*/\1\2/p;')

Hope it helps~~

PEACE~~


in Python with pandas and sqlite3

What you need to install

sqlite3
pandas

Then simply run supported functionality. Here is the sample code

if __name__ == "__main__":
import sqlite3
import pandas as pd

# load data
df = pd.read_csv('../resources/hgnc_data.txt', sep='\t')

# strip whitespace from headers
df.columns = df.columns.str.strip()

con = sqlite3.connect("hgnc.db")

# drop data into database
df.to_sql("hgnc_data", con)

con.close()

And we’re good to go.

~~PEACE~~


When it comes to find text we often think of grep or awk. But to replace text in file is really simple with sed.

For example you want to replace “ensemble” to “ensembl”, just

sed -i 's/ensemble/ensembl/g' input.txt

Hope it helps

PEACE~~~


There is time, when we’re not sure what the key_name in json data will be. How do we do it in Go?

Image for post
Image for post
Photo by Paweł Czerwiński on Unsplash

We will use interface for the dynamic key.

For example the json value be like:

{
"TRPV6": {
"ncbi": {
"symbol": "",
"symbol_source": "",
"id": "",
"gene_name": "",
"gene_synonyms": null,
"biotype": "",
"contig": "",
"start": 0,
"end": 0,
"reference_genome": "",
"strand": "",
"description": ""
},
"ensembl": {
"symbol": "TRPV6",
"symbol_source": "ensembl_havana",
"id": "ENSG00000165125",
"gene_name": "TRPV6",
"gene_synonyms": [
"CaT1",
"ECAC2"
],
"biotype": "",
"contig": "chr7",
"start": 142871208,
"end": 142885745,
"reference_genome": "GRCh38",
"strand": "-",
"description": ""
},
"gene_cards": {
"symbol": "",
"id": "",
"gene_name": "",
"gene_synonyms": null,
"biotype": "",
"contig": "",
"start": 0,
"end": 0,
"reference_genome": "",
"strand": "",
"description": null
}
}…

Golang

using mutex.

Image for post
Image for post
Photo by Sincerely Media on Unsplash

When working with files or databases, or anything that relates to write permission, if we want to implement concurrency we need to implement lock. Because if we don’t, the data will be mess up by running concurrency.

So in Go, there is a couple of ways to do it like with mutex or using channel. In this post, we will use mutex for demonstration.

For example like we want to append data to the slice in Go when doing concurrency, first we need to define mutex

var (
mu = &sync.Mutex{}
data = make([]byte, 0)
)

Then in our go routine, we need to call

mu.Lock()
data = append(data, dataLocal...)
data = append(data, []byte("\n")...)
mu.Unlock()

before and after manipulate the data.

And that is it.

Hope it helps!

PEACE as always..


Documentation

with Crowdin.

Image for post
Image for post
Photo by Andrea Rodriguez on Unsplash

Docusaurus is a very convenient framework for building websites when it comes to documentation or blogging. Often in times, we need to have multiple translation support due to a wide range of audience.

Docusaurus now has version 2, but it is still alpha, so there is some functionality like translation is not well supported.

In this post, to demonstrate how to apply translation in Docusaurus, we will use version 1.

First we need to go over how Docusaurus apply translation. It comes with Crowdin support.

Image for post
Image for post
Crowdin Homepage

We need to create a new account and a project in crowdin. In order to work with Docusaurus, we need to get the Project_ID and API_Token from crowdin. …


True friends

Inspired by Jordan Peterson talk.

Image for post
Image for post
Photo by Chewy on Unsplash

You know someone is your true friend if:

  • If you do something wrong, they will tell you the truth
  • Even better, if you achieve something, they will set up the celebration for you

A true friend is someone will help you to go after what you want, not what they think is good for you.

~~ PEACE ~~


Life

Because you can set the schedule for the things that you enjoy.

Image for post
Image for post
Photo by Marc Kleen on Unsplash

So often in life, we neglect to set schedules. Because we don’t want to attach to something, because what if we don’t like to do it.

But you know what, if you don’t set the schedule, you might work like a blind. And day after day, you will fail because you don’t set the goal, the target where you might want to get.

And in fact, if you don’t get to where you want, you will do the things that are meaningless to you. And if you know you’re doing the things that is meaningless, you will not be HAPPY.

To be happy, you have to do the thing that you think it’s meaningful. That the thing is important to you, and to someone. …


Book Recommendation

A great book from a great thinker.

Image for post
Image for post
Photo by Sincerely Media on Unsplash
  1. STAND UP STRAIGHT WITH YOUR SHOULDERS
    BACK

2. TREAT YOURSELF LIKE SOMEONE YOU ARE
RESPONSIBLE FOR HELPING

3. MAKE FRIENDS WITH PEOPLE WHO WANT THE
BEST FOR YOU

4. COMPARE YOURSELF TO WHO YOU WERE
YESTERDAY, NOT TO WHO SOMEONE ELSE IS
TODAY

5. DO NOT LET YOUR CHILDREN DO ANYTHING THAT
MAKES YOU DISLIKE THEM

6. SET YOUR HOUSE IN PERFECT ORDER BEFORE YOU
CRITICIZE THE WORLD

7. PURSUE WHAT IS MEANINGFUL (NOT WHAT IS
EXPEDIENT)

8. TELL THE TRUTH — OR, AT LEAST, DON’T LIE

9. ASSUME THAT THE PERSON YOU ARE LISTENING
TO MIGHT KNOW SOMETHING YOU DON’T

10. BE PRECISE IN YOUR SPEECH

11. DO NOT BOTHER CHILDREN WHEN THEY ARE
SKATEBOARDING

12. PET A CAT WHEN YOU ENCOUNTER ONE ON THE
STREET

About

Donald Le

A passionate automation engineer who strongly believes in “A man can do anything he wants if he puts in the work”.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store