python |
Pythonタグが付けられた新着投稿 - Qiita |
複式簿記は行列簿記のCOO形式? |
https://qiita.com/gummycandy/items/b3bde72c04c7183b30ab
|
複式簿記 |
2022-05-22 20:06:52 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Djangoプロジェクト作成 |
https://qiita.com/y5347M/items/57178b8434da5ef20f64
|
django |
2022-05-22 20:04:18 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
GitHubでのブランチ作成からローカル環境へのクローンまで |
https://qiita.com/cats_2311/items/6c62e5ecdea23351fc81
|
github |
2022-05-22 20:25:42 |
海外TECH |
DEV Community |
Generate application metrics using SpringBoot and Micrometer |
https://dev.to/sabyasachi/generate-application-metrics-using-springboot-and-micrometer-39mo
|
Generate application metrics using SpringBoot and Micrometer IntroductionObservability is one of the pillars of modern microservices architecture Application metrics is one dimension of that observbility When an application runs on production we may want to know various operational metrics like memory cpu threadpool usage etc as well as buisness metrics for example how many request for a particular operations are made Spring boot with the help of micrometer enables application developers to expose various metrices Setup metricsTo add support for metrics we need to add actuator dependency lt dependency gt lt groupId gt org springframework boot lt groupId gt lt artifactId gt spring boot starter actuator lt artifactId gt lt dependency gt and we also need to enable the metrics endpoint like following management endpoints web exposure include metricsThat s it our application now set to expose metrics The below curlcurl localhost actuator metrics jq will give response like names application ready time application started time disk free disk total executor active executor completed executor pool core executor pool max executor pool size executor queue remaining executor queued hikaricp connections hikaricp connections acquire hikaricp connections active hikaricp connections creation hikaricp connections idle hikaricp connections max hikaricp connections min hikaricp connections pending hikaricp connections timeout hikaricp connections usage http server requests jdbc connections active jdbc connections idle jdbc connections max jdbc connections min jvm buffer count jvm buffer memory used jvm buffer total capacity jvm classes loaded jvm classes unloaded jvm gc live data size jvm gc max data size jvm gc memory allocated jvm gc memory promoted jvm gc overhead jvm gc pause jvm memory committed jvm memory max jvm memory usage after gc jvm memory used jvm threads daemon jvm threads live jvm threads peak jvm threads states logback events process cpu usage process files max process files open process start time process uptime system cpu count system cpu usage system load average m tomcat sessions active current tomcat sessions active max tomcat sessions alive max tomcat sessions created tomcat sessions expired tomcat sessions rejected These are the metrics that spring boot provides out of the box We can see it includes jvm memory threads cpu usage etc The below request will show used jvm memory curl http localhost actuator metrics jvm memory max jq name jvm memory max description The maximum amount of memory in bytes that can be used for memory management baseUnit bytes measurements statistic VALUE value availableTags tag area values heap nonheap tag id values CodeHeap profiled nmethods G Old Gen CodeHeap non profiled nmethods G Survivor Space Compressed Class Space Metaspace G Eden Space CodeHeap non nmethods A metrics can have multiple dimensions For example jvm memory max has heap and nonheap size We can drill down to metrics using its tags like curl http localhost actuator metrics jvm memory max tag area heap jq name jvm memory max description The maximum amount of memory in bytes that can be used for memory management baseUnit bytes measurements statistic VALUE value availableTags tag id values G Old Gen G Survivor Space G Eden Space So far we know that spring boot exposes metrics and we can request metric endpoint to get those metrics and if required we can drill down to this metrics using available tags Custom MetricsWhat if we need more metrics Spring uses Micrometer underneath which takes care of generating and exposing metrics MeterRegistry is the core concept of micrometer that holds multiple metrices We can simply inject an instance of MeterRegistry in our custom metrics provider like below Componentpublic class InventoryMetrics private Counter inventoryCounter public InventoryMetrics MeterRegistry meterRegistry inventoryCounter Counter builder products description Product Count register meterRegistry public void inventoryAdded int count inventoryCounter increment count Here we have created a new metrics named products every time we add a new product we will increment the value Now if we curl our metrics endpoint with we get product countcurl http localhost actuator metrics products jq name products description Product Count baseUnit null measurements statistic COUNT value availableTags Streaming metricsOn production we would like to stream metrices to a data store like elasticsearch influxdb etc Spring Boot supports out of the box various data sinks actuator metrics For this post I ran a influxdb docker image locally We can see our custom metrics pushed to influx On the application side configuration looks like management metrics export influx uri http localhost token lt your token gt bucket lt your bucket gt org lt your org gt autoCreateDb falseNOTE Config properties for influxdb x and x different The above config is for influxdb x For x we need to use username password and db instead of token bucket and org Also autoCreateDb should be false as otherwise springboot will try to create a db named mydb Micrometer metric TypesCounter Counters are monotonically increasing metrics It can be incremented by a fixed amount which is always positive Gauge Gauges are instantaneous metrics this can either go up or down Timer Timers are short duration latencies and frequency of events Our custom metric is a type of counter to measure the added products This is at a very high level how to expose metrics In production though we need to be aware of the volume of metrics because if volumes and frequency is high our dashboards can become really slow We should also think about a retention policy of data to not to store unecessary old data This will help saving some storage In conclusion metrics are essential part of our services and spring boot make it easy to gather and expose it to various data sinks |
2022-05-22 11:20:28 |
海外TECH |
DEV Community |
DO NOT do this, while building a React app! |
https://dev.to/zabdeldjallil/do-not-do-this-while-building-a-react-app-4d7i
|
DO NOT do this while building a React app Maintaining standards and a good workflow while building the React application can give you some hard times mainly because of time constraints We usually do some things that make it hard to either debug or read our code later and that s a bad practice Here s a list of things to avoid when build React applications Consider that most of these points can be used in things like Angular and Vue Do not share CSS across multiple componentsSo one big mistake we make once in a while would be to have a central CSS file usually our app css and just put all our styling inside that this is very bad mainly because when the project starts getting large styles may start conflicting Avoid having large Component files Having large component files gets annoying for everyone working in your team and in time it may be hard debugging components previously built Dividing components should be done by tearing down a user interface to the most basic building blocks or components This reduces the complexity of the component and provides an easier way of knowing if something goes wrong Share reusable Functions across ComponentsTry your best to have components or files that aren t large by declaring util functions that are used across multiple components and exporting those functions This way the components can access them and it helps to remove repeated codes Passing functions down as children paramsDuring development we run into issues like parent components needing to update states to cause a re render during the app s running process so we create a function in the parent component and pass the function that interacts with that component But in a case where the component for some reason doesn t work we d have to go a long way searching for the parent component that doesn t pass this function One way to avoid this is to use the React context provider which shares state with all the children component it has in the application |
2022-05-22 11:11:11 |
海外TECH |
DEV Community |
Use firebase in your React App |
https://dev.to/chamodperera/using-firebase-in-your-react-app-jpb
|
Use firebase in your React AppHi everyone this is my first post Feel free to comment any mistakes below So recently I ve been creating my personal portfolio site with reactjs It has a section to showcase my projects blogs etc And I needed to add any projects to that without updating the code That s where I used firebase as a solution for this case So Firebase is a platform developed by Google for creating mobile and web applications It was originally an independent company founded in In Google acquired the platform and it is now their flagship offering for app development So let s get started I am using firebase V for this Step setting up a new react project First steps first setting up a react project If you are new to react check out the React documentation to get started React is a free and open source front end JavaScript library for building user interfaces based on UI components You can create a new react app by running the following code in your console npx create react app my app |
2022-05-22 11:03:15 |
ニュース |
BBC News - Home |
Australia election: Anthony Albanese signals climate policy change |
https://www.bbc.co.uk/news/world-australia-61539426?at_medium=RSS&at_campaign=KARANGA
|
energy |
2022-05-22 11:07:12 |
ニュース |
BBC News - Home |
E.On UK boss warns 40% of customers face fuel poverty |
https://www.bbc.co.uk/news/business-61541294?at_medium=RSS&at_campaign=KARANGA
|
government |
2022-05-22 11:36:15 |
ニュース |
BBC News - Home |
Manchester Arena attack: Events under way to mark fifth anniversary |
https://www.bbc.co.uk/news/uk-england-manchester-61522046?at_medium=RSS&at_campaign=KARANGA
|
manchester |
2022-05-22 11:54:30 |
ニュース |
BBC News - Home |
Monkeypox: Israel and Switzerland confirm cases |
https://www.bbc.co.uk/news/health-61540474?at_medium=RSS&at_campaign=KARANGA
|
outbreak |
2022-05-22 11:10:00 |
ニュース |
BBC News - Home |
Professor Brian Cox: Maybe humans are the Martians |
https://www.bbc.co.uk/news/science-environment-61540945?at_medium=RSS&at_campaign=KARANGA
|
physicist |
2022-05-22 11:02:02 |
ニュース |
BBC News - Home |
French Open: Ons Jabeur beaten in first round by Magda Linette |
https://www.bbc.co.uk/sport/tennis/61541126?at_medium=RSS&at_campaign=KARANGA
|
french |
2022-05-22 11:55:14 |
北海道 |
北海道新聞 |
新体操、課題は完成度と表現力 団体日本代表がエキシビション |
https://www.hokkaido-np.co.jp/article/683976/
|
東京体育館 |
2022-05-22 20:32:00 |
北海道 |
北海道新聞 |
西岡、宇山が世界トランポリンへ 全日本年齢別選手権 |
https://www.hokkaido-np.co.jp/article/683975/
|
世界選手権 |
2022-05-22 20:29:00 |
北海道 |
北海道新聞 |
知床の不明者、道内在住は4人か 「まだ信じたくない」「どこかで生きていて」 |
https://www.hokkaido-np.co.jp/article/683972/
|
道内 |
2022-05-22 20:26:59 |
北海道 |
北海道新聞 |
チェーンソー日本一決定大会 青森で、伐木技術を競う |
https://www.hokkaido-np.co.jp/article/683974/
|
青森 |
2022-05-22 20:23:00 |
北海道 |
北海道新聞 |
中国空母「遼寧」、東シナ海へ 沖縄南方で艦載機発着艦、帰途か |
https://www.hokkaido-np.co.jp/article/683971/
|
中国海軍 |
2022-05-22 20:07:00 |
北海道 |
北海道新聞 |
線路上に枝や土砂、快速など31本運休 小樽 |
https://www.hokkaido-np.co.jp/article/683970/
|
運休 |
2022-05-22 20:01:00 |
コメント
コメントを投稿