RSSAmplifier

Blog

jdhao's digital space

Recent content on jdhao's digital space

jdhao.github.ioRSS feed ↗566 posts

Latest posts

Guide on Exporting Opentelemetry Traces to GCP

In this post, I want to share how to export the traces generated by your FastAPI application to the GCP observability platform.

OpenTelemetry Tracing for Your FastAPI application

With OpenTelemetry , you can easily trace a single request across multiple services in a distributed system. In this post, I would like to share how you can set up OpenTelemetry tracing for your FastAPI application.

Vector Field Not Shown in Source in Elasticsearch?

Recently, I was working on migrating our Elasticsearch cluster to serverless . We have an index where some field stores dense vectors used in KNN search.

Elasticsearch Dynamic Mapping Pitfalls

In Elasticsearch, when you index document to an index, if you do not specify the mapping for the field, Elastic will use dynamic mapping to infer the data type for your field.

Manage uv.lock file with Renovate

In our work, we are using renovate to update the dependency packages for Python projects. Previously when we are using good old pip and requirements.txt for package management, renovate works fine since it only needs to update the package version in requirements.txt . We switch to uv this year as our project management tool. Since uv uses pyproject.toml and uv.lock (lockfile) to ensure…

Set up Python Provider for Neovim

To make python plugins work in Neovim, we need to set up the python provider properly. Usually, this means setting up the correct path to Python executable and also installing the pynvim – Neovim client for Python.

Ripgrep Config to Search Hidden Files

Notes about how to use ripgrep to search hidden files and configuration related to Neovim.

Pre-commit Setup for Your Project

We have a Python project where there are several developers, and we have a mature CI pipeline to do code linting, formatting check for python, yaml, json, and testing etc. The problem with CI pipeline is that you can only get feedback after you commit your code and push to the remote repo. The feedback is not instant and may be delayed for several minutes. If there are some linting issues, you…

I read the nvim v0.12 release note so you don't have to

A major Neovim release (version 0.12) has been released a few days ago, after more than one year from the last major release (version 0.11). The following is a list of feature I am interested. For a complete set of features, check full changelog and news . builtin package manager vim.pack # Now you can use the builtin vim.pack API to manage your plugins. Check this detailed post if you want to…

Return Different Values for Each Call of A Mock

When unit-testing a function that make multiple external calls/requests, we want to mock the actual call and return the mock results. For each call, we might want to return different results.

Migrate Python Project from Pip to Uv

Previously, our projects are still using the old Python 3.10, which will be deprecated soon this year . We are also using the good old pip and venv for the project/package management. This is already posing some issues for us: venv is a pure virtual env tool without the ability to manage python versions (it just picks your local python), so it is hard to enforce the local env of each developer…

Using ruff as Linter for Python Projects

In python projects, we always need a linter to catch potential issues and enforce best practices. In the past, there were linters like pylint, flake8. However, they are not performant for large code bases and also you have to install different tools for linting. Then ruff came out in 2022 and completely changed the Python linter landscape. It can literally replace all the other major linters with…

德语常用不规则动词

葱油鸡腿制作

Check Trailing White Spaces in Your Project

When I am working on a Python project, I am using black to format the code, so that we have a unified format across the code base. One pain point, however, is the super annoying trailing white spaces: black can remove trailing spaces for doc string, code and comment, but it will not touch trailing spaces in, e.g., multi-line strings.

菜谱:茄子肉丁

object vs nested type in data mapping in Elasticsearch

In this post, I compare the object vs nested type used in data mapping in Elasticsearch.

Node, Index, Shard in Elasticsearch

Logging setup for Pytest

When you do code testing using pytest, pytest can do sophisticated changes to your logging. This is a very powerful feature, but carries some subtlety.

Select fields in Elasticsearch: _source, fields and stored_fields

In Elasticsearch, when we index documents to an index, by default the source of the document is stored in meta field _source . When you search your index, you see a special field _source for each matched/hit product.

中式葱花饼制作

本文总结如何制作中式家常版本的“葱花饼”。

菜谱: 凉拌苤蓝(卜留克/kohlrabi)

今天总结一下在德国超市里常见的蔬菜苤(piě)蓝(德语叫 kohlrabi ,在中国东北叫“卜留克”) 凉拌的做法。

我也有高考 PTSD

和众多网友一样,我也有高考 PTSD 。

Garmin Course Syncing Not Working?

Recently I was trying to sync my hiking course from Garmin connect to my Garmin Forerunner 965 and found that it does not work.

Prevent Accidental Index Delete in Elasticsearch

In Elasticsearch, you can use wildcard in a lot of the index operations. This is very handy, but can be dangerous sometimes, e.g., when you use wildcards when deleting indexes. You may delete unintended indexes accidentally and cause serious interruptions to your business/work.

How to Import GPX File into Garmin Watch

This post will give a quick summary on how to import GPX route into Garmin watch.

Python system PATH issues When We Use Pytest

When I try to run pytest locally for a Python project, I noticed that the import in those test scripts may fail if I run pytest in different directories. The import error usually means that your actual code modules is not in the python path, so they can not be imported successfully by your test scripts. This has something to do with how pytest set up the python path when you run it.

菜谱:泰式打抛牛肉

本次来复刻泰国非常受欢迎的打抛饭。

菜谱:烤箱羊肉串

本文总结如何用烤箱烤羊肉串。

How to Filter Warnings in Python/pytest

When we are using 3rd packages in Python, we may see some warning messages. For example, when you use the package BeautifulSoup and provide it with an url:

家常烤箱烤鸡腿

这次来总结一下烤箱烤鸡腿的做法。

Comparison between Several Desktop Speakers

In this post, I would like to compare several speakers that are relatively small in size and are suitable as desktop speakers.

How to Use LuaRocks Package in Neovim

Although neovim has built a lot of modules to ease the use of Lua, sometimes we may still want to use packages from LuaRocks . In this post, I would like to share how you can install a package from LuaRocks and use it in nvim.

Macbook 外接显示器

最近趁着黑五入手了外接显示器,顺便了解了一下显示器相关的各种标准和技术,本文做一个总结。

家常萝卜炖羊排

寒冷的冬天,和羊肉汤更配。

Run the Job Immediately after Starting Scheduler in Python APScheduler

When using APScheduler package in Python, I want to run the scheduled job right after I start the scheduler. How can I do it properly?

Retry for Google Cloud Client

When we use one of the google cloud python clients to communicate with GCP, there may be errors occurring sometime calling the client API methods.

菜谱:土豆金枪鱼沙拉

今天来总结一下土豆金枪鱼沙拉的做法。

菜谱:椰香咖喱鸡

本次来总结一下椰汁咖喱鸡的做法。

凉拌绿豆宽粉制作

本次来总结凉拌绿豆宽粉的做法。

Make Python logging Work in GCP

When deploying a Python application to GCP Kuberntes Engine, we may see issues that the logging level is not correct in the cloud logging explorer. In order for the Python logging package to work with GCP, we need some additional configurations.

Liveness and Readiness Check in Kubernetes

Notes on Using GCP Logging Explorer

西班牙土豆饼制作

本次来复刻一下在网上看到的西班牙土豆饼。

Elasticsearch Version Conflict Error

The version conflict error is often seen when doing document indexing operations in Elasticsearch.

How to Use the Elasticsearch task API

In Elasticsearch (ES), you can run a task and check its status with the task API . For example, if you use the reindex API in ES with parameter with_for_completion=False , ES will not wait for the process to finish and will return a task instead.

Speed up document indexing in Elasticsearch via bulk indexing

In Elasticsearch, there is index API where you can index a single document to an index.

Index refresh issue in Elasticsearch

Recently when I was working with Elasticsearch, I found this weird issue that the document count for the newly created index is not correct. Also there are problems with reindex, if you reindex the source index to destination index, there is nothing in the destination index despite no errors.

Google Cloud Storage Usage

Some notes on using the Google Cloud storage .

家常煎羊排制作

在德国的德超很少能见到羊肉,不过在土耳其超市可以很方便买到羊肉。 本期我来做一个煎羊排,之所以不是因为烤羊排是因为我没有合适的烤盘和锡箔纸,所以没有尝试。