投稿時間:2022-12-18 15:10:18 RSSフィード2022-12-18 15:00 分まとめ(12件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita AtCoderの検証用プログラムをPythonで自作した(雑) https://qiita.com/yasubei/items/2c3ad8648db0ce6d48e6 atcoder 2022-12-18 14:19:43
AWS AWSタグが付けられた新着投稿 - Qiita SNSの宛先をGmailにしてみる https://qiita.com/masakazu193/items/5821eea53b733e2a3c8a cloudwatch 2022-12-18 14:42:42
AWS AWSタグが付けられた新着投稿 - Qiita Glue Jupyter Notebookでパラメータを扱う際の1案 https://qiita.com/a_b_/items/75709286fc16e7159287 awsglue 2022-12-18 14:07:15
golang Goタグが付けられた新着投稿 - Qiita Goのhttp.Clientでリダイレクトを判定して処理を行う方法 https://qiita.com/isaka1022/items/d3f41f99d820ebddac61 client 2022-12-18 14:32:08
Ruby Railsタグが付けられた新着投稿 - Qiita railsコマンドまとめ[備忘録:随時追加予定] https://qiita.com/Ktsuki16/items/4acc804102ea6ed3c9bf rollerstaticpagesindexhe 2022-12-18 14:40:30
技術ブログ Developers.IO Rechart v1 が使用されている運用中プロジェクトでの Aliases を使った v2 への 段階的移行 https://dev.classmethod.jp/articles/rechart-v1-to-v2/ aliases 2022-12-18 05:27:43
海外TECH DEV Community Creating a Service Monitor in k8s https://dev.to/apgapg/creating-a-service-monitor-in-k8s-nl8 Creating a Service Monitor in ksPrometheus is an excellent monitoring tool developed for Kubernetes monitoring Many of the helm charts like Nginx RabbitMq provides inbuilt provision for metrics exposing for Prometheus monitoring These metrics are generally exposed on an endpoint say metrics and prometheus pulls down process them on certain interval But the question arrises how does Prometheus knows from where to scrap metrics The answer to this is via Service Monitor Note This articles assumes the reader has basic knowledge of Prometheus Grafana Kubernetes Helm Charts What is Service Monitor Service Monitor is a CRD provided by Prometheus Operator which provides configuration on how provided services should be monitored Or how we wish to collect metrics from different services Prometheus operator uses this service monitor and configures itself internally RequirementsAll services which are wished to be monitored must have following annotations in their manifest configuration annotations prometheus io port metrics prometheus io scrape true Here First line represents PORT number We used a PORT name instead of actual port number here Second line represents a flag whether to scrap metrics or not A service monitor which monitors which services metrics to scrap ExampleLet s say we have a simple ks deployment service having following manifest Deployment apiVersion apps vkind Deploymentmetadata name my service deployment namespace productionspec replicas selector matchLabels app my service strategy rollingUpdate maxSurge maxUnavailable minReadySeconds template metadata namespace production labels app my service spec nodeSelector kubernetes io os linux containers name my service pod image myacr azurecr io my service latest envFrom secretRef name prod secrets ports containerPort resources requests cpu m memory Mi limits cpu m memory Mi Service apiVersion vkind Servicemetadata name my service service namespace productionspec type ClusterIP selector app my service ports port protocol TCP targetPort name metrics Note the config may look daunting but it just has few extra optional parametersThe above is a simple Ks Service and Deployement having type ClusterIP not exposed as we have Nginx gateway If we assume we have already setup our prom client in our NodeJs image to scrap metrics we would have a endpoint metrics where all prometheus metrics are exposed Now we just need to connect this service to prometheus STEP Add required annotations in service spec template annotations prometheus io port metrics prometheus io scrape true and add labels to identify service labels app kubernetes io part of dmsNote Put lables according to new standard as defined in Ks DocsOur final service manifest shall look like Note no changes to deployment maifest needed Service apiVersion vkind Servicemetadata name my service service namespace production annotations prometheus io port metrics prometheus io scrape true labels app kubernetes io part of dmsspec type ClusterIP selector app my service ports port protocol TCP targetPort name metrics Deploy this configuration For eg kubectl apply f my service yml STEP After deployment new service manifest create a new Service monitor as follows apiVersion monitoring coreos com vkind ServiceMonitormetadata name dms service monitor namespace monitoringspec endpoints interval s port metrics scrapeTimeout s namespaceSelector matchNames production selector matchLabels app kubernetes io part of dmsNote The selector config should match with that deined in service as above Namespace can be different You can include specifc namespaces to monitor using namespaceSelector With this our setup is done STEP Check if Prometheus is collecting your metrics Head over to your prometheus server using port forward if not exposed On top menu select Status gt Targets You can see Prometheus has discovered the new target my service monitor and working successfully You can even see your scrape data on home page using query TroubleshootIf you have deployed Prometheus using kube prometheus stack helm chart you might need to upgrade chart using following chart values values ymlprometheus prometheusSpec podMonitorSelectorNilUsesHelmValues false serviceMonitorSelectorNilUsesHelmValues falseFor eg helm upgrade prometheus operator prometheus community kube prometheus stack namespace monitoring namespace monitoring values values ymlThis way we remove pre configured selectors constraints from prometheus deployement Also there is an excellent answer on stackoverflow which describes the whole monitoring flow to troubleshoot ConclusionSo we see how easily we can connect our Prometheus and Nodejs metrics on our ks cluster You dont need a separate Service Monitor everytime you create a new service so long your service correctly passes constraints inside selector in service monitor Whola Both you and I learnt something new today Congrats Further Reading 2022-12-18 05:49:31
海外TECH DEV Community react useRef() hook (web dev simplified) https://dev.to/akshdesai1/react-useref-hook-web-dev-simplified-1obm react useRef hook web dev simplified useRef Hook ref does not cause your component to re update when it gets changed part Source Code import useState useEffect useRef from react export default function App const name setName useState const renderCount setRenderCount useState useEffect gt console log inside useEffect setRenderCount prevRenderCount gt prevRenderCount name const renderCount useRef useEffect gt console log inside useeffect renderCount current const inputRef useRef return lt gt lt input type text value name onChange e gt setName e target value gt lt div gt My name is name lt div gt lt div gt renderCount current lt div gt lt button gt renderCount current lt button gt lt gt Output Image Part Source Code import useState useEffect useRef from react export default function App const name setName useState const renderCount setRenderCount useState useEffect gt console log inside useEffect setRenderCount prevRenderCount gt prevRenderCount name const renderCount useRef useEffect gt console log inside useeffect renderCount current const inputRef useRef return lt gt lt input ref inputRef onClick gt console log clicked type text value name onChange e gt setName e target value gt lt div gt My name is name lt div gt lt div gt renderCount current lt div gt lt button onClick gt inputRef current click gt renderCount current lt button gt lt gt Output Image Part Source Code import useEffect useRef useState from react export default function App const name setName useState const PrevName useRef useEffect gt console log name name console log PrevName current PrevName current PrevName current name console log PrevName current PrevName current return lt gt lt input type text onChange e gt setName e target value gt lt div gt name PrevName current lt div gt lt gt Source Code Thank You You can follow us on Youtube Instagram 2022-12-18 05:32:31
ニュース BBC News - Home The Papers: New strike threats and Sussexes ‘want apology’ https://www.bbc.co.uk/news/blogs-the-papers-64015275?at_medium=RSS&at_campaign=KARANGA family 2022-12-18 05:10:26
北海道 北海道新聞 王将事件「共犯者」立件見通せず 発生9年、実行役逮捕も捜査縮小 https://www.hokkaido-np.co.jp/article/776849/ 射殺事件 2022-12-18 14:49:00
北海道 北海道新聞 唐沢が日本勢最高の6位 山陽女子ロード、ハーフマラソン https://www.hokkaido-np.co.jp/article/776843/ 山陽女子 2022-12-18 14:28:40
北海道 北海道新聞 初の首位打者 日本ハム・松本剛選手のデータ分析 内角打ち向上、右方向を意識 https://www.hokkaido-np.co.jp/article/776794/ 北海道日本ハム 2022-12-18 14:12:34

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)