はじめに こんにちは、テックリードのかどたみです。 弊社では以前の記事でも紹介したとおりマイクロサービス開発にNestJSを利用しています。今回はNestJSでマイクロサービス開発をする際のログの出力についてご紹介します。 この記事はエモーションテック Advent Calendar 2022の6日目の記事です。 背景 マイクロサービスのメリットの一つとして、サービスごとに開発するドメインの範囲を狭め、機能追加や改修の影響範囲を最小限にできることが挙げられます。 しかし、いざ運用しようとするとユーザーからのアクセス一つにおいて複数のサービスで処理が走ることから、どのサービスで障害になっているのか、どのユーザーがどこまでアクセスできているのかなどバグ発生時の原因や影響範囲の特定に時間がかかることもあります。 そこで、マイクロサービス間でログに出力する内容を揃えることで分析をしやすくなるように
Debugging asynchronous code in JavaScript can feel like navigating a minefield at times. You don't know when and where the console.logs will print out, and you have no idea how your code is executed. It's hard to correctly structure async code so it executes in the right order as you intend it to. Wouldn't it be nice if you had some guidance while writing asynchronous code, and to get a helpful me
Today we're going to build and run an ice cream shop and learn asynchronous JavaScript at the same time. Along the way, you'll learn how to use: Callbacks Promises Async / Await Here's what we'll cover in this article: What is Asynchronous JavaScript? Synchronous vs Asynchronous JavaScript How Callbacks Work in JavaScript How Promises Work in JavaScript How Async / Await Works in JavaScript So let
この記事はミツエーリンクス Advent Calendar 2020 - Adventarの14日目の記事です。 少し前にNode.jsのv15がリリースされました。v15にはAbortControllerの実装が追加されています。 AbortControllerは簡単に言うとPromiseなどの非同期処理を中断させるために実装されたインターフェースです。Node.jsだけではなくWeb APIにも存在しており、この度Node.jsに実装されたAbortControllerはWeb APIをベースにしています(ただしExperimental扱いです)。 (12/15追記:12/9にリリースされたNode.js 15.4.0でExperimentalではなくなりました。) 今回はAbortControllerをどのように使うのかをご紹介したいとおもいます。 AbortControllerの使
先日、TypeScript 3.8 RCが公開されました。TypeScript 3.8はクラスのprivateフィールド(#nameみたいなやつ)を始めとして、ECMAScriptの新機能のサポートがいくつか追加されています。この記事で取り扱うtop-level awaitもその一つです。 この記事ではtop-level awaitに焦点を当てて、その意味や使い方について余すところなく解説します。top-level awaitは一見単純な機能に見えますが、実はモジュール (ES Modules) と深い関係があり、そこがtop-level awaitの特に難しい点です。そこで、この記事ではECMAScriptのモジュールについても詳しく解説します。この記事を読んでtop-level awaitを完全に理解して備えましょう。 **※ この記事は3分の1くらい読むと「まとめ」があり、残りはおま
Layering: Fix the jobs infrastructure Presenter: Daniel Ehrenberg Author: Domenic Denicola June 2019 TC39 meeting
import execa from 'execa'; import Listr from 'listr'; const tasks = new Listr([ { title: 'Git', task: () => { return new Listr([ { title: 'Checking git status', task: () => execa.stdout('git', ['status', '--porcelain']).then(result => { if (result !== '') { throw new Error('Unclean working tree. Commit or stash changes first.'); } }) }, { title: 'Checking remote history', task: () => execa.stdout(
JavaScript programmers may expect that the following two programs are largely similar in terms of how they perform with respect to the ECMAScript job queue (if inside of an async function): promise.then(f); f(await promise); However, if promise is a built-in promise, then these two code fragments will differ in the number of iterations through the job queue are taken: because await always wraps a
1 Sep A tour of JavaScript timers on the web Posted September 1, 2018 by Nolan Lawson in Web. Tagged: javascript, performance. 14 Comments Pop quiz: what is the difference between these JavaScript timers? Promises setTimeout setInterval setImmediate requestAnimationFrame requestIdleCallback More specifically, if you queue up all of these timers at once, do you have any idea which order they’ll fir
In this blog post, we run shell commands as child processes in Node.js. We then use async language features to read the stdouts of those processes and write to their stdins. Running commands in child processes # Let’s start with running a shell command in a child process: const {onExit} = require('@rauschma/stringio'); const {spawn} = require('child_process'); async function main() { const filePa
Update 2018-04-24: Using the library stringio to read lines from stdin. Node.js 10 was released on April 24, 2018. This version provides experimental support for asynchronously iterating over readable streams. This blog post explains how that works. Reading streams asynchronously # In this section, we examine two ways of reading data from a stream asynchronously: via callbacks and via asynchronou
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く