小编Chu*_*k94的帖子

了解 prometheus 和 Grafana 在 http_server_requests_seconds_count 上使用的increase()和rate()

我尝试从普罗米修斯获取这些测量值:

  1. increase(http_server_requests_seconds_count{uri="myURI"}[10s])
  2. increase(http_server_requests_seconds_count{uri="myURI"}[30s])
  3. rate(http_server_requests_seconds_count{uri="myURI"}[10s])
  4. rate(http_server_requests_seconds_count{uri="myURI"}[30s])

然后我运行一个 python 脚本,其中创建了 5 个线程,每个线程都访问此 myURI 端点:

我在 Grafana 上看到的是:

在此输入图像描述 在此输入图像描述

我收到了这些值:

  1. 0
  2. 6
  3. 0
  4. 0.2

我预计会收到这些(但没有):

  1. 5(如在过去 10 秒内该端点收到5呼叫)
  2. 5(如在过去 30 秒内该端点收到5 个呼叫)
  3. 0.5(10秒内终端接到5个呼叫5/10
  4. 0.167(终端在30秒内接到5个呼叫5/30

有人可以用我的例子解释这个函数背后的公式以及实现我期望的指标/值的方法吗?

spring grafana prometheus micrometer

11
推荐指数
1
解决办法
2万
查看次数

更改eclipse创建.eclipse,.p2和其他文件夹的位置

我看到eclipse在我的用户主文件夹中创建了一些文件夹,如.eclipse .p2等...我想更改此默认文件夹(我想将所有文件保存在D:位置。)。我在Linux中阅读了这个Change .eclipse文件夹,但是我不知道我必须更改哪个文件.ini,如果在安装Eclipse之后进行此操作,我是否还要更改。此外,我有Windows 10而不是Linux。对不起我的英语不好。希望能对您有所帮助。

这是我的eclipse.ini

-data  
D:/Programmi/Eclipse  
-configuration  
D:/Programmi/Eclipse/eclipse `  
-startup  
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar  
--launcher.library    
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.550.v20170928-1359  
-product  
org.eclipse.epp.package.java.product  
-showsplash  
org.eclipse.epp.package.common  
--launcher.defaultAction  
openFile  
--launcher.defaultAction  
openFile  
--launcher.appendVmargs  
-vmargs  
-D"user.home=D:/Programmi/Eclipse/home"
-Dosgi.requiredJavaVersion=1.8  
-Dosgi.instance.area.default=@user.home/eclipse-workspace  
-XX:+UseG1GC  
-XX:+UseStringDeduplication  
--add-modules=ALL-SYSTEM  
-Dosgi.requiredJavaVersion=1.8  
-Xms256m  
-Xmx1024m  
--add-modules=ALL-SYSTEM 
Run Code Online (Sandbox Code Playgroud)

eclipse windows install

7
推荐指数
2
解决办法
6616
查看次数

Java 17 中的密封类以及开闭原则

简而言之,在 Java 的 LTS 版本 (Java 17) 中,我们第一次有了关键字sealed,它使我们能够限制层次结构:

public abstract sealed class Person
    permits Employee, Manager {
 
    //...
}
Run Code Online (Sandbox Code Playgroud)

如果我想创建一个扩展基类的新子类Person,我也必须修改基类。这是否违反开闭原则?

open-closed-principle sealed-class java-17

6
推荐指数
1
解决办法
1333
查看次数

Mapstruct - 找不到符号 [Kotlin + Maven]

当我运行命令时出现以下错误mvn clean install

[ERROR] /Users/xxx/xxx/xxx/xxx.xxx/target/generated-sources/kapt/compile/com/xxx/xxx/xxx/xxx/DataMapperImpl.java:[10,40] cannot find symbol
[ERROR]   symbol: class DataMapperDecorator
[ERROR] /Users/xxx/xxx/xxx/xxx.xxx/target/generated-sources/kapt/compile/com/xxx/xxx/xxx/xxx/DataMapperImpl.java:[10,74] cannot find symbol
[ERROR]   symbol: class DataMapper
[ERROR] /Users/xxx/xxx/xxx/xxx.xxx/xxx/generated-sources/kapt/compile/com/xxx/xxx/xxx/api/DataMapperImpl.java:[12,19] cannot find symbol
[ERROR]   symbol:   class DataMapper
[ERROR]   location: class com.xxx.xxx.xxx.xxx.DataMapperImpl
Run Code Online (Sandbox Code Playgroud)

似乎在 mapstruct 生成DataMapperImpl.java类后,它无法找到类DataMapperDataMapperDecoretor

与mapstruct相关的代码在一个xxx.kt文件中:

//Other stuff
...

@Mapper
@DecoratedWith(DataMapperDecorator::class)
interface DataMapper {
    @Mappings(
        Mapping(source = "data.value", target = "dataValue"),
        Mapping(source = "data.current.value", target = "currentValue"),
    )
    fun toDto(data: Data) : RefDataDto
}

abstract class DataMapperDecorator : …
Run Code Online (Sandbox Code Playgroud)

maven kotlin mapstruct

5
推荐指数
1
解决办法
6818
查看次数

使用 Mac OS 使用 homebrew 启动 postgres 服务时出错

我使用经典命令安装了 postgresql 10:

酿造安装postgresql@10

然后我启动了服务:

酿造服务启动 postgresql@10

输出显示:

成功启动postgresql@10(标签:homebrew.mxcl.postgresql@10)

但是当我运行这个命令时:

酿造服务

这就是我得到的:

Name          Status  User         Plist
cassandra     stopped              
postgresql    stopped              
postgresql@10 error   username /opt/homebrew/opt/postgresql@10/homebrew.mxcl.postgresql@10.plist  
Run Code Online (Sandbox Code Playgroud)

该服务似乎未正确运行。之前我有另一个版本的 Posgresql。又是版本 10,但使用提供的安装程序安装,但使用了 postgresql 的网页。不过我应该把它删除了。

我使用此命令检查已使用的端口:

lsof -nP +c 15 | grep LISTEN
Run Code Online (Sandbox Code Playgroud)

我没有使用端口 5432(postgresql 使用的默认端口)的服务。

postgresql macos homebrew

2
推荐指数
1
解决办法
6077
查看次数