日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

Spring Tips: The Wavefront Observability Platform

發布時間:2024/3/13 javascript 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Spring Tips: The Wavefront Observability Platform 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Engineering
Josh Long
April 29, 2020

speaker: Josh Long (@starbuxman)

Hi, Spring fans! Welcome to another installment of Spring Tips! In this installment, we’ll revisit two topics that we’ve addressed in two previous videos (distributed tracing and metrics collection) in terms of the superb Tanzu Wavefront observability platform.

The first video of the two videos, as mentioned above, dating way back in early 2017, looked at distributed tracing with spring cloud sleuth and openzipkin. Spring Cloud Sleuth is an abstraction for capturing the flow of messages from one node to another. It’s useful to help you see how messages move through a system. Spring cloud sleuth integrates with all the usual ingress and egress points in a Spring Boot application. Make an HTTP request using either the Restteplat or the reactive WebClient or Spring Cloud Feign? It works. Receive an HTTP request to a traditional (Servlet-based) or reactive HTTP endpoint built with Spring? It works. Send or receive a message using Spring Cloud Stream or Spring Integration? Yep. You guessed it. It just works. You don’t have to do anything, either.

Just add the Spring Cloud Sleuth starter to the classpath, and Spring Cloud Sleuth does the rest. It can, in turn, forward the information that it captures to an out-of-band trace server like OpenZipkin. Some even provide Zipkin-compatible proxies, like Google Cloud StackDriver trace. I like that last bit as it almost feels like we’ve gone full circle. Remember that Zipkin was inspired by, among other things, google ’s dapper whitepaper. It’s nice that we can, in turn, use Zipkin to talk to google cloud’s tracing infrastructure. Distributed tracing is ideal when you want to drill down into the specifics of a single request into, or out of, the system.

The second video from early 2018 looks at collecting metrics with Micrometer.

Micrometer is an abstraction that captures metrics - statistics - about your application that can then be made available from the spring boot actuator /actuator/metrics endpoint or forwarded to a time series database like Wavefront. Micrometer can also talk to other time-series databases like AppOptics, Azure Monitor, Netflix Atlas, CloudWatch, Datadog, Dynatrace, Elastic, Ganglia, Graphite, Humio, Influx/Telegraf, JMX, KairosDB, New Relic, Prometheus, SignalFx, Google Stackdriver, StatsD. Metrics are useful when you want to capture statistics - aggregate numbers about the frequency a given HTTP endpoint is hit, or an HTTP endpoint returns a particular status code or responds to a specific HTTP verb.

That was a quick recap. For a more in-depth look at both of these, I would refer you to the two referenced Spring Tips videos. That’s why they’re there! The beautiful thing about Wavefront is that you won’t interact with these project’s APIs in this installment because, as we’re about to see, the Wavefront Spring Boot integration jsut works. And this is no small surprise: the Spring Boot team worked hard on making the Wavefront integration work seamlessly. Wavefront has other integrations for tons of different platforms, runtimes, and projects, too.

NOTE: I’ve pasted together the seemingly endless list of other integrations supported into one ginormous screenshot that you can find at the bottom of this blog. It’ll be the image that’s like ten times longer in length than the blog itself.

Let’s build a new project using the Spring Initializr. You must use a build of Spring Boot greater than Spring Boot 2.3.M4. Select R2DBC, PostgreSQL, Reactive Web, Spring Cloud Sleuth and Lombok. Click Generate, unzip the resulting file. When I wrote this, it worked well enough to use Spring Cloud Hoxton SR3. No need for the snapshots. Also, we need to add the Wavefront starter itself. Add the following dependency to the pom.xml.

<dependency><groupId>com.wavefront</groupId><artifactId>wavefront-spring-boot-starter</artifactId><version>2.0.0-SNAPSHOT</version> </dependency>

The Wavefront Spring Boot starter is a SNAPSHOT dependency - it wouldn’t be a Spring Tips video if we didn’t dare to dance on the edge! At the time of this writing, the dependency is in the Sonatype SNAPSHOTS repository. I needed to have the following Spring and Sonatype repositories in my build. Who knows, though? Perhaps everything will be GA by the time you read this. Things move quickly in these bootiful parts!

<repositories><repository><id>sonatype-snapshots</id><name>Sonatype Snapshots</name><url>https://oss.sonatype.org/content/repositories/snapshots/</url><snapshots><enabled>true</enabled></snapshots></repository><repository><id>spring-milestones</id><name>Spring Milestones</name><url>https://repo.spring.io/milestone</url></repository><repository><id>spring-snapshots</id><name>Spring Snapshots</name><url>https://repo.spring.io/snapshot</url><snapshots><enabled>true</enabled></snapshots></repository> </repositories> <pluginRepositories><pluginRepository><id>spring-milestones</id><name>Spring Milestones</name><url>https://repo.spring.io/milestone</url></pluginRepository><pluginRepository><id>spring-snapshots</id><name>Spring Snapshots</name><url>https://repo.spring.io/snapshot</url><snapshots><enabled>true</enabled></snapshots></pluginRepository> </pluginRepositories>

That all done, import the project up in your favorite IDE.

The application is a typical reactive Spring Boot application, with which you have no doubt become familiar after watching so many other SPring Tips installments on functional reactive HTTP endpints, Spring Data R2DBC, testing reactive services, and more. Here’s the code.

package com.example.wavefront;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.annotation.Id;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Flux;

import static org.springframework.web.reactive.function.server.RouterFunctions.route;
import static org.springframework.web.reactive.function.server.ServerResponse.ok;

@SpringBootApplication
public class WavefrontApplication {

public static void main(String[] args) {SpringApplication.run(WavefrontApplication.class, args); }@Bean RouterFunction<ServerResponse> routes(ReservationRepository rr) {return route().GET("/reservations", r -> ok().body(rr.findAll(), Reservation.class)).GET("/hello", r -> ok().bodyValue("Hi, Spring fans!")).build();}@Bean ApplicationRunner runner(ReservationRepository reservationRepository) {return args -> {var data = Flux.just("A", "B", "C", "D").map(name -> new Reservation(null, name)).flatMap(reservationRepository::save);reservationRepository.deleteAll().thenMany(data).thenMany(reservationRepository.findAll()).subscribe(System.out::println);}; }

}

interface ReservationRepository extends ReactiveCrudRepository<Reservation, String> {
}

@Data
@AllArgsConstructor
@NoArgsConstructor
class Reservation {

@Id private String id; private String name;

}

We’ll need to speicfy some configuration information for the PostgreSQL database in our src/main/resources/application.properties.

spring.r2dbc.url=r2dbc:postgresql://localhost/orders
spring.r2dbc.username=orders
spring.r2dbc.password=orders

We’ll also need to specify how our application identifies itself to Wavefront in src/main/resources/application.properties. Wavefront can observe multiple applications. An application, in turn, can have numerous services within it. An application name is a logical grouping of services. For our application, the name will be spring-tips, and the service name will be reservations.

wavefront.application.name=spring-tips
wavefront.application.service=reservations

Aaaaannd… that’s it! Start the application in your IDE or on the command line using mvn spring-boot:run. You’ll see that the application starts up and displays some information on the console, sort of like this.

To share this account, make sure the following is added to your configuration:

management.metrics.export.wavefront.api-token=58e749b5-ee60-4c0b-988e-458c6cb77b32 management.metrics.export.wavefront.uri=https://wavefront.surf

Connect to your Wavefront dashboard using this one-time use link:
https://wavefront.surf/us/cY69hp561D

Yep. That’s it. When the Wavefront Spring Boot starter starts up, it negotiates a token for your application. So your dashboard is already ready and waiting for you by the time the application starts up. The spring boot starter is even kind enough to capture the Wavefront token for you in ~/.wavefront_token. Subsequent runs will read that data for you. Or, you could use the Spring Boot properties printed out on the console, and it’ll defer to that, too.

you probably don’t want to have the token checked into your git repository. Instead, prefer environment variables or the Spring Cloud Config Server. Want to learn more about configuration? See this SPring tips video on configuration.

Note the last URL there for reference later on. But first, go to your browser and exercise some of the endpoints, http://localhost:8080/reservations and http://localhost:8080/hello. Invoke them both in the browser a half dozen times.

Now, go to that wavefront URL, and you should see a dashboard with the data for your application. If you don’t, then just wait a minute. IT takes a few minutes to see the data collected from your application.

You’ll immediately see that Wavefront has captured metrics about your application at both the application level - it knows, for example, about your HTTP requests, as well as at the JVM level, where it knows about things like your JVM’s memory use.

Click on one of those HTTP requests or go to Application > Traces, and you’ll be able to drill down into the traces for your application, like this. There is a ton of information there, too.

Everything I’ve shown you thus far is just what gets prepared for you out of the box. The real power is in the customization and the integrations. You can create custom dashboards to show all sorts of information that matters to you. Graph useful business indicators. Use plots, time series, and more. And, once you’ve figured out what the correct data to act on is, and figured out how to best contextualize data, then it’s trivial to install integrations to alert you when its time to act.

Speaking of integrations, I promised I’d show you some of the other integrations available. So, here it is, your moment of zen: the insane list of other integrations for the rare sort who is not Spring Boot (huh?):

Still here? …Why? Get! You’ve got places to be, production deploys to savor, growth to measure. Take what you’ve learned here today and integrate Wavefront into your application. If you’re using Tanzu Enterprise-ready Kubernetes Grid (Kubernetes), Tanzu Application Service (Cloud Foundry), or Azure Spring Cloud, then this should be an especially tantalizing opportunity. Finally, an observability platform that can scale like your Spring Boot-based microservices do. So, go. Go try out Wavefront. Get to production, faster, and safer.
comments powered by Disqus

translate:
翻譯:

如上所述,這兩個視頻的第一個視頻可以追溯到2017年初,它著眼于spring cloud sleuth和openzipkin的分布式跟蹤。Spring Cloud Sleuth是一個抽象,用于捕獲從一個節點到另一個節點的消息流。幫助您了解消息如何在系統中移動是很有用的。Spring cloud sleuth與Spring引導應用程序中所有常見的入口和出口點集成。使用Restteplat或reactive WebClient或Spring Cloud Feign發出HTTP請求?它起作用了。接收到用Spring構建的傳統(基于Servlet)或反應式HTTP端點的HTTP請求?它起作用了。使用Spring云流或Spring集成發送或接收消息?是的。你猜對了。它只是起作用。你也不必做任何事。
只需將Spring Cloud Sleuth starter添加到類路徑,剩下的由Spring Cloud Sleuth完成。反過來,它可以將捕獲的信息轉發給像OpenZipkin這樣的帶外跟蹤服務器。有些甚至提供了與Zipkin兼容的代理,比如Google Cloud StackDriver trace。我喜歡這最后一點,因為它幾乎感覺我們已經走了一個完整的循環。請記住,Zipkin的靈感來源于谷歌的時髦白皮書。很高興我們可以反過來使用Zipkin與google云的跟蹤基礎設施進行對話。當您想要深入到系統中或系統外的單個請求的細節時,分布式跟蹤是理想的選擇。
2018年初的第二個視頻著眼于用千分尺收集指標。
測微計是一個抽象,它捕獲關于您的應用程序的度量-統計信息,然后可以從spring boot actuator/actuator/metrics端點獲得,或者轉發到Wavefront之類的時間序列數據庫。測微計還可以與其他時間序列數據庫進行對話,如AppOptics、Azure Monitor、Netflix Atlas、CloudWatch、Datadog、Dynatrace、Elastic、Ganglia、Graphite、Humio、Inflox/Telegraf、JMX、KairosDB、New Relic、Prometheus、SignalFx、Google Stackdriver、StatsD。當您想要捕獲統計信息時,度量是很有用的—有關給定HTTP端點被擊中的頻率的聚合數字,或者HTTP端點返回特定的狀態代碼或響應特定的HTTP動詞。
這是一個快速的概括。為了更深入地了解這兩個方面,我將向您介紹兩個參考的Spring提示視頻。這就是他們來的原因!Wavefront的優點在于,在本期中您不會與這些項目的api交互,因為正如我們即將看到的,Wavefront Spring Boot集成jsut可以工作。這也不足為奇:Spring Boot團隊努力使波前集成無縫工作。Wavefront還集成了大量不同平臺、運行時和項目。
注意:我已經將看似無止境的其他集成列表粘貼到一個ginormous截圖中,您可以在這個博客的底部找到它。這張圖片的長度是博客本身的十倍。
讓我們使用Spring初始化器構建一個新項目。您必須使用比SpringBoot2.3.M4更大的SpringBoot版本。選擇R2DBC、PostgreSQL、Reactive Web、Spring Cloud Sleuth和Lombok。單擊Generate,解壓縮結果文件。當我寫這篇文章的時候,使用SpringCloudHoxtonSR3已經足夠好了。不需要快照。另外,我們還需要添加波前啟動器本身。將以下依賴項添加到pom.xml中。
Wavefront Spring Boot starter是一個快照依賴項-如果我們不敢在邊緣跳舞,它就不是Spring Tips視頻!在編寫本文時,依賴項位于Sonatype快照存儲庫中。我需要在我的構建中包含以下Spring和Sonatype存儲庫。但誰知道呢?也許你讀到這篇文章的時候一切都會好起來的。在這些卑鄙的地方事情進展很快!
我們需要在src/main/resources/application.properties中為PostgreSQL數據庫指定一些配置信息。
spring.r2dbc.url=r2dbc:postgresql://localhost/orders
spring.r2dbc.username=訂單
spring.r2dbc.password=訂單
我們還需要在src/main/resources/application.properties中指定應用程序如何將自己標識為Wavefront。波前可以觀察多種應用。反過來,一個應用程序內部可以有許多服務。應用程序名是服務的邏輯分組。對于我們的應用程序,名稱是spring tips,服務名稱是reservations。
wavefront.application.name=彈簧頭
wavefront.application.service=預訂
啊!就是這樣!使用mvn spring boot:run在IDE或命令行啟動應用程序。您將看到應用程序啟動并在控制臺上顯示一些信息,大致如下。

總結

以上是生活随笔為你收集整理的Spring Tips: The Wavefront Observability Platform的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 极品人妻一区二区三区 | 色婷婷综合成人av | 日韩在线欧美 | 国产真人真事毛片 | 亚洲精品国产精品乱码不99按摩 | www.youjizz国产 | 一区二区三区视频网 | 欧洲一区二区在线 | av伦理在线 | 中文字幕av一区二区三区人妻少妇 | 亚洲最新在线观看 | 亚洲一区二区三区午夜 | 精品久久久久久久久久久久 | 国产成人aa | 亚洲日本三级 | 国产一区福利 | 亚洲一卡二卡在线 | 丝袜美腿亚洲综合 | av图片在线观看 | 成人久久精品 | 黄色免费一级视频 | www.热久久 | 亚洲免费av网 | 鲁一鲁色一色 | 日韩欧美中文字幕精品 | 精品一区二区在线观看视频 | 日韩欧美中文字幕一区二区三区 | 偷偷操网站| 精品久久免费 | 干极品美女 | 女人天堂网 | av激情在线观看 | 欧美性xxxxx极品娇小 | 雷电将军和丘丘人繁衍后代视频 | 日韩人妻一区二区三区蜜桃 | 亚洲av无码片一区二区三区 | 脱女学生小内内摸了高潮 | 亚洲伊人久久久 | 亚洲精品午夜 | 成人av网站在线 | 春日野结衣av | 国产嗷嗷叫| 色片在线免费观看 | 久久国产精品免费观看 | 日本美女在线 | 5个黑人躁我一个视频 | 在线视频日本 | 噜噜噜网站 | 二色av | 国产日韩视频 | 久久久精品网站 | 亚洲久视频 | 日本激情一区二区 | 开心激情综合网 | 欧美激情在线 | 日日夜夜免费 | 在线观看黄色av网站 | 少妇激情偷人爽爽91嫩草 | 国产精品资源在线观看 | 日韩视频在线观看 | 捆绑凌虐一区二区三区 | 欧美日韩国产一级片 | 成年人视频在线 | 日日夜夜影院 | 国产五月天婷婷 | 国产一区二区三区毛片 | 超碰毛片 | 寡妇av| 91久久免费| www.久久久久久久久 | 成人tiktok黄短视频 | 成人a级片 | 特黄视频免费看 | 欧美日韩另类视频 | 日韩不卡av在线 | 亚洲欧美一区二区三区 | 国产网站黄色 | 免费三片60分钟 | 爱爱视频天天干 | 波多野结衣国产 | 伊人情人综合 | 欧美精品乱人伦久久久久久 | 日韩r级电影在线观看 | 亚洲精品无码久久久久久久 | 秋霞影院午夜老牛影院 | 懂色视频在线观看 | 亚洲射射 | 少妇在线视频 | 91婷婷在线| 国产成人精品aa毛片 | 国产亚洲精品aaaaaaa片 | 欧美日韩不卡 | 日韩中文字幕电影 | 国产第九页| av影片在线观看 | 久久亚洲一区二区 | 色播导航| 亚洲欧洲日本一区二区三区 | 国产一区99 |