V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ruandao
V2EX  ›  问与答

prometheus 如何做减法?

  •  
  •   ruandao · Dec 11, 2018 · 3201 views
    This topic created in 2699 days ago, the information mentioned may be changed or developed.

    dayProfit{p="profit"} - dayProfit{p="loss"}

    无效

    单独使用,两个 metric 都可以正常使用

    6 replies    2018-12-12 09:18:59 +08:00
    mondeo
        1
    mondeo  
       Dec 11, 2018 via iPhone
    两个查询出来的结果集要一致才能做减法吧
    ruandao
        2
    ruandao  
    OP
       Dec 11, 2018
    @mondeo #1 是同时记录的, 且是同一个 metric 记录的, 只是 label 不一样
    seerhut
        3
    seerhut  
       Dec 11, 2018
    向量不能这么减,非要减转成标量再减,scalar()-scalar()
    atnoot
        4
    atnoot  
       Dec 11, 2018 via iPhone
    job 是否可以呢
    rayingecho
        5
    rayingecho  
       Dec 11, 2018   ❤️ 1
    dayProfit{p="profit"} - ignoring(p) dayProfit{p="loss"}
    ruandao
        6
    ruandao  
    OP
       Dec 12, 2018
    @rayingecho #5 谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   758 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 21:12 · PVG 05:12 · LAX 14:12 · JFK 17:12
    ♥ Do have faith in what you're doing.