小编Jen*_*ger的帖子

如何在 Grafana 上使用 LogQL 将 Loki 解析的字段绘制为数值?

我的设置:Loki:2.1.0,Grafana:6.7.3

我的软件在 Kubernetes 上运行,Loki 收集其日志。它看起来像这样:

[2021-03-29 10:13:05] [INFO] Q_len=256 sol_q=0.049 info_q=0.240
[2021-03-29 10:13:05] [INFO] Q_len=196 sol_q=0.047 info_q=0.144 
Run Code Online (Sandbox Code Playgroud)

我在日志中使用了 logfmt,因此 loki 可以检测到我的字段: ![图片|496x169](上传://vlvULKFu8DhvVZJb9qxURLMlSso.png)

现在我想要info_q在 Grafana 上绘制一段时间内的平均值。这是我尝试过的事情:

avg by (info) (avg_over_time({job="ism/ism-core-es"} | regexp `.*info_q=(?P<info_q>.*)` | unwrap info_q [1m]))
Run Code Online (Sandbox Code Playgroud)

回报在此输入图像描述

正如错误消息所示,我做了

avg by (info) (avg_over_time({job="ism/ism-core-es"} | regexp `.*info_q=(?P<info_q>.*)` | unwrap info_q | __error__="" [1m] ))
Run Code Online (Sandbox Code Playgroud)

返回空图表。和这个

avg_over_time(
{job="ism/ism-core-es"}
| regexp ".*info_q=(?P<info_q>.*?)"
| unwrap info_q [5m])
Run Code Online (Sandbox Code Playgroud)

也不返回任何内容。

我究竟做错了什么?我必须输入cast吗?任何帮助表示赞赏!

logging grafana grafana-loki

9
推荐指数
1
解决办法
6422
查看次数

Maven Aspectj插件再次调用JPA模型生成器

我有一个Maven项目,我使用Hibernate元模型生成器生成JPA元模型.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>xxx</groupId>
        <artifactId>xxx</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <artifactId>xxx</artifactId>
    <dependencies>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>

        <dependency>
            <!-- needed for meta model generation (see also compiler plugin config) -->
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-jpamodelgen</artifactId>
            <version>4.3.8.Final</version>
        </dependency>
    </dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)

AspectJ编译器在父项目中配置.当我运行Maven时,首先调用Java编译器插件并生成源代码target/generated-sources/generated-sources/annotations正确.然后执行AspectJ插件,再次生成源,现在进入我的项目的根文件夹并抛出以下错误:

D:\xxx\git\xxx>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xxx 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xxx ---
[INFO] Deleting D:\...
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ xxx --- …
Run Code Online (Sandbox Code Playgroud)

hibernate jpa aspectj maven aspectj-maven-plugin

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

类型推断失败:没有足够的信息来推断参数请明确指定它

我正在尝试在Kotlin写一个Vaadin应用程序.对于数据绑定,Vaadin 8现在提供了类型安全数据绑定的可能性.在Kotlin我会期待这样的工作:

class LoginModel {
    var username: String = ""
    var password: String = ""
}

class LoginView : FormLayout() {
  val name = TextField("name")
  val password = TextField("password")
  val loginButton = Button("login")

  init {
      val binder = Binder<LoginModel>()
      binder.forField(name).bind(
          { it.username }, 
          { bean, value -> bean.username = value })

     //... 
  }
}
Run Code Online (Sandbox Code Playgroud)

我在这里收到以下错误消息:

Error:(23, 31) Kotlin: Type inference failed: Not enough information to infer parameter BEAN in fun <BEAN : Any!, TARGET : Any!, BEAN : Any!> Binder.BindingBuilder<BEAN#1 …
Run Code Online (Sandbox Code Playgroud)

data-binding type-inference vaadin kotlin

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

计算grafana中两个查询之间的差异

我有一个 grafana 仪表板,其中有 2 个流入查询,它们计算单个值 (AB)

我现在需要计算它们之间的差异A - B。这在 influx 或 grafana 中是否有可能?

请注意,这两个值来自同一数据库但来自不同的测量

格拉法纳仪表板

influxdb grafana

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

自动创建的 PR 不会触发 Github 工作流程

我实现了一个每周运行一次的工作流程,更新所有项目依赖项,并使用工作流程令牌打开一个包含更改的 PR。

name: Automatic dependency update
"on":
  workflow_dispatch: null
  schedule:
  - cron: 0 0 * * 1
jobs:
  update:
    name: Update to latest versions
    runs-on:
    - self-hosted
    - default-runner
    steps:
    - name: Checkout Project
      uses: actions/checkout@v2
    - name: Install Java
      uses: actions/setup-java@v2
    - name: Update Versions
      run: |
        ./gradlew useLatestVersions --info 
    - name: Commit and open PR
      uses: peter-evans/create-pull-request@v3
      with:
        commit-message: Update to latest versions
        committer: Update Bot <workflow@xxx.com>
        branch: auto-dependency-update
        base: dev
        delete-branch: true
        title: Automatic dependency update
        draft: …
Run Code Online (Sandbox Code Playgroud)

pull-request github-actions

3
推荐指数
1
解决办法
1989
查看次数