Feng's Notes Isn't coding fun?

CodeDeepDive -- Loki (1)

This is the start a series of posts about the notes I made when I read the source code of popular open source projects. I myself learned a lot from digging into the code of open source projects. I hope it can help you too. I will start with Loki, a log aggregation system inspired by Prometheus. Overview grafana/loki consists two components: Loki: the log aggregation system Promtail: the agent to collect logs and send to Loki in a nutshell, loki and promtail is a service-client arhitecture.

How to monitor springboot metrics with prometheus and grafana

When you deploy springboot apps to production, you would like to know how your apps are doing. You would like to know how many requests are coming in, how much memory is used, how many errors are there, etc. In this article I would like to share my experience on how to monitor your springboot app with prometheus and grafana. Structure Assuming you already know what is prometheus and grafana. If not, you can check out their official websites.

How to build a modern web app with Go and React

Go is a fancinating language for building backend service, while React is a modern framework for building frontend web app. I would like to share my experience on how you can put this two together to build a full stack web app. The structure The chance is you probably can find a template on github and develop your app based on that. But I recommend you pause for a second and think about the structure of the codebase.

Learn How to Build Go Applications From Grafana

Grafana has developed really fast in the past few years. It has been the de facto standard for observability. I have been using grafana and loki for a while and I am really impressed by its performance and the quality of the code. Grafana builds most its backend components in Go. Meanwhile I am also using Go to build stuff. So it seems a good idea to learn some good practice from Grafana’s codebase.

Build Go Commandline App With Cobra

The framework I am using to build this blog is Hugo. Under the hood, it uses Cobra to build the command line interface. Besides Hugo, Cobra is also used by many other popular projects such as kubectl, github cli, etc. I was curious about how it works so I decided to learn by building a simple command line app with it. The app I am going to build is a regex tool that uses openAI’s API to generate a regex expression based on a list of strings or the semantic meaning of the given strings(e.

Goroutine Pool review

Goroutine is perhaps the main reason why people choose golang for their projects. It is a lightweight thread managed by the go runtime. It is also easy to use. You can simply use go keyword to start a goroutine. However, if you need to run a large number or cpu intensive goroutines, you might want to use a goroutine pool to manage them and make sure you don’t run out of memory or cpu resources.

Task queues in different languages

Task queue is used widely in software development. It is a mechanism to distribute work across threads or machines. It is also a way to coordinate workers to perform tasks. The scenario could be a web application that needs to process a large number of requests, a data pipeline that needs to process a large amount of data or a scheduled job that needs to run periodically. I have used task queues in different languages.

Rss reader in golang -- Miniflux review

Background I have been using feedly for years to read rss feeds. It is a great service however it grows more and more complicated and tries hard to sell me their premium features. I understand that they need to make money, but I decided to find a self-host solution for my simplest need: read self selected rss feeds on a clean UI. no AI recommendation, no social sharing, no fancy features.

Cache on the edge with Cloudflare Workers

I recently found a nice project which offers iframe line to display stars of any github repo. I found it could be useful on my another building website which aims to track the trending repos on github. So I tried to put it on and it worked well…at first. How when I put several repos on one page the tool stopped working and don’t show the star number. I checked its source code https://github.

Streamlit app to manage your cloudflare images

In my previous article I introduced how to build a sql chatbot with langchain and streamlit. I was then thinking if I can use streamlit to manage my image gallery on cloudflare. I found it was as easy as I thought, of course with a bit help of chatgpt.. Why I need this I have been using cloudflare images service for a while and satisfied with its speed. However, it doesn’t have a good UI tool.