Skip to content

Instantly share code, notes, and snippets.

@arsalanses
Created May 5, 2024 08:51
Show Gist options
  • Select an option

  • Save arsalanses/f8e576828052f0d887948f9584d6243e to your computer and use it in GitHub Desktop.

Select an option

Save arsalanses/f8e576828052f0d887948f9584d6243e to your computer and use it in GitHub Desktop.
vector as prometheus_exporter
services:
vector:
image: hub.hamdocker.ir/timberio/vector:0.36.0-alpine
container_name: vector
hostname: vector
ports:
- 127.0.0.1:8000:80
- 127.0.0.1:8002:9598
volumes:
- ./vector.yaml:/etc/vector/vector.yaml:ro
# networks:
# - blackbox
deploy:
resources:
limits:
cpus: '0.7'
memory: 512M
logging:
options:
max-size: "512m"
# networks:
# blackbox:
sources:
http_server:
type: http_server
address: 0.0.0.0:80
encoding: binary
method: GET
query_parameters:
- http_requests_count
- method
- path
transforms:
http_server_to_metric:
type: log_to_metric
inputs:
- http_server
metrics:
- type: counter
field: http_requests_count
namespace: service
tags:
method: "{{ method }}"
path: "{{ path }}"
sinks:
console_data:
type: console
inputs:
- http_server_to_metric
target: stdout
encoding:
codec: json
prometheus_exporter:
type: prometheus_exporter
inputs:
- http_server_to_metric
address: 0.0.0.0:9598
flush_period_secs: 86400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment