Skip to content

πŸ’‘ [REQUEST] - <Export custom labels from outbound JSON into Prometheus metrics>Β #124

@Davoyan

Description

@Davoyan

БСйчас exporter ΠΏΡƒΠ±Π»ΠΈΠΊΡƒΠ΅Ρ‚ ΠΌΠ΅Ρ‚Ρ€ΠΈΠΊΠΈ Π²ΠΈΠ΄Π°:
xray_proxy_latency_ms{address="1.1.1.1:443",name="proxy",protocol="trojan",sub_name=""} 227
xray_proxy_status{address="1.1.1.1:443",name="proxy",protocol="trojan",sub_name=""} 1

Но, допустим, Ρƒ мСня Π΅ΡΡ‚ΡŒ Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹Π΅ статичСскиС Π°Ρ‚Ρ€ΠΈΠ±ΡƒΡ‚Ρ‹ (location/hoster/ΠΈ Ρ‚.ΠΏ.) Π² ΠΊΠΎΠ½Ρ„ΠΈΠ³Π΅ outbound, ΠΈ я Ρ…ΠΎΡ‡Ρƒ Π²ΠΈΠ΄Π΅Ρ‚ΡŒ ΠΈΡ… Π² labels ΠΌΠ΅Ρ‚Ρ€ΠΈΠΊ, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΡƒΠ΄ΠΎΠ±Π½ΠΎ Ρ„ΠΈΠ»ΡŒΡ‚Ρ€ΠΎΠ²Π°Ρ‚ΡŒ/Π°Π³Ρ€Π΅Π³ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ Π² PromQL ΠΈ Π² Grafana.

Outbound example.

{
  "tag": "proxy",
  "protocol": "trojan",
  "settings": {
    "servers": [
      {
        "address": "1.1.1.1",
        "port": 443,
        "password": "password"
      }
    ]
  },
  "streamSettings": {
    "network": "tcp",
    "tcpSettings": {},
    "security": "tls",
    "tlsSettings": {
      "serverName": "cloudflare.com",
      "allowInsecure": false,
      "show": false
    }
  },
  "metricsLabels": {
    "location": "Netherlands, Amsterdam",
    "hoster": "FreeVDS",
    "otherCustomLabel": "value"
  },
  "mux": {
    "enabled": true,
    "concurrency": 8,
    "xudpConcurrency": 1
  }
}

Для ΠΊΠ°ΠΆΠ΄ΠΎΠΉ ΠΌΠ΅Ρ‚Ρ€ΠΈΠΊΠΈ, которая относится ΠΊ Π΄Π°Π½Π½ΠΎΠΌΡƒ outbound, Π΄ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ labels.

xray_proxy_latency_ms{address="1.1.1.1:443",name="proxy",protocol="trojan",sub_name="",location="Netherlands, Amsterdam",hoster="FreeVDS",otherCustomLabel="value"} 227
xray_proxy_status{address="1.1.1.1:443",name="proxy",protocol="trojan",sub_name="",location="Netherlands, Amsterdam",hoster="FreeVDS",otherCustomLabel="value"} 1

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions