Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ fail-fast = false
# timeout tests after 2 minutes
slow-timeout = { period = "30s", terminate-after = 4 }

# blackbox_exporter tests need more time due to HTTP probing
[[profile.default.overrides]]
filter = 'test(blackbox_exporter)'
slow-timeout = { period = "5m", terminate-after = 4 }
# Also increase the hard timeout for these tests
timeout = { period = "10m" }

[profile.default.junit]
# output test results at target/nextest/default/junit.xml
path = "junit.xml"
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- master
- feat/*
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -87,6 +88,11 @@ jobs:
# sudo make install_sw
# cd ..

- name: Run Tests
run: |
cargo nextest run --release --workspace --no-fail-fast -E 'test(blackbox_exporter)'
echo "All tests passed"

- name: Build Vector
# env:
# RUSTFLAGS: "-C target-feature=+crt-static"
Expand All @@ -95,21 +101,16 @@ jobs:
# OPENSSL_DIR: /musl
# OPENSSL_NO_VENDOR: "1"
run: |
cargo build --release
cargo build --release -p vector
echo "Build completed successfully"

- name: Run Tests
run: |
cargo nextest run --release --workspace --no-fail-fast --no-default-features --features default -E 'test(blackbox_exporter)' --slow-timeout 5m --terminate-after 4
echo "All tests passed"


- name: Create Release Archive
run: |
mkdir -p release
cp target/x86_64-unknown-linux-musl/release/vector release/
cp target/release/vector release/
cd release
tar -czf vector-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-musl.tar.gz vector
sha256sum vector-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-musl.tar.gz > vector-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-musl.tar.gz.sha256
tar -czf vector-${{ steps.get_version.outputs.VERSION }}.tar.gz vector
sha256sum vector-${{ steps.get_version.outputs.VERSION }}.tar.gz > vector-${{ steps.get_version.outputs.VERSION }}.tar.gz.sha256

- name: Upload Release Artifacts
uses: actions/upload-artifact@v4
Expand All @@ -121,7 +122,8 @@ jobs:
release:
name: Create Release
needs: build-and-test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
runs-on: vector-builder
environment:
name: production
url: https://github.com/${{ github.repository }}/releases/tag/v${{ needs.build-and-test.outputs.version }}
Expand All @@ -140,8 +142,8 @@ jobs:
draft: false
prerelease: false
files: |
release/vector-${{ needs.build-and-test.outputs.version }}-x86_64-unknown-linux-musl.tar.gz
release/vector-${{ needs.build-and-test.outputs.version }}-x86_64-unknown-linux-musl.tar.gz.sha256
release/vector-${{ needs.build-and-test.outputs.version }}.tar.gz
release/vector-${{ needs.build-and-test.outputs.version }}.tar.gz.sha256
body: |
## Vector v${{ needs.build-and-test.outputs.version }}

Expand All @@ -151,8 +153,8 @@ jobs:

### Installation
```bash
curl -LO https://github.com/${{ github.repository }}/releases/download/v${{ needs.build-and-test.outputs.version }}/vector-${{ needs.build-and-test.outputs.version }}-x86_64-unknown-linux-musl.tar.gz
tar -xzf vector-${{ needs.build-and-test.outputs.version }}-x86_64-unknown-linux-musl.tar.gz
curl -LO https://github.com/${{ github.repository }}/releases/download/v${{ needs.build-and-test.outputs.version }}/vector-${{ needs.build-and-test.outputs.version }}.tar.gz
tar -xzf vector-${{ needs.build-and-test.outputs.version }}.tar.gz
./vector --version
```
env:
Expand Down
17 changes: 16 additions & 1 deletion config/examples/blackbox_exporter_http.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Blackbox Exporter HTTP probing example
# Blackbox Exporter HTTP probing example with optional labels
# ------------------------------------------------------------------------------
# Scraping metrics from Blackbox Exporter HTTP probes and sending to console
# This example demonstrates using predefined optional labels to enrich metrics
# with geographic and infrastructure context

data_dir: "/var/lib/vector"

Expand All @@ -21,6 +23,19 @@ sources:
scrape_interval_secs: 15
# Scrape timeout in seconds
scrape_timeout_secs: 10
# Optional labels to enrich all metrics with contextual information
# Geohash of the probe location
geohash: "9qx7hh9jd"
# Probe region (e.g., AMER, EMEA, APAC)
region: "AMER"
# Probe location (city or location name)
location: "Oregon"
# Two-digit country code
country: "US"
# Check friendly name
name: "Public Sites Monitor"
# Infrastructure provider
provider: "AWS"

# Output
sinks:
Expand Down
92 changes: 92 additions & 0 deletions config/examples/blackbox_exporter_labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Blackbox Exporter with combined predefined and ad-hoc labels
# ------------------------------------------------------------------------------
# Scraping metrics from Blackbox Exporter with both predefined optional labels
# and custom ad-hoc labels. This example demonstrates the full flexibility of
# the optional labels feature.

data_dir: "/var/lib/vector"

# Ingest
sources:
# Probe from US West Coast location
blackbox_us_west:
type: "blackbox_exporter"
url: "http://localhost:9115"
targets:
- "https://api.example.com"
- "https://app.example.com"
module: "http_2xx"
scrape_interval_secs: 15
scrape_timeout_secs: 10
# Predefined optional labels for geographic context
geohash: "9qx7hh9jd"
region: "AMER"
location: "Oregon"
country: "US"
name: "US West API Monitor"
provider: "AWS"
# Ad-hoc custom labels for additional context
labels:
environment: "production"
team: "platform"
datacenter: "us-west-2"
cost_center: "engineering"

# Probe from European location
blackbox_eu:
type: "blackbox_exporter"
url: "http://blackbox-eu.example.com"
targets:
- "https://api.example.com"
- "https://app.example.com"
module: "http_2xx"
scrape_interval_secs: 15
scrape_timeout_secs: 10
# Predefined optional labels for European probe
geohash: "u4pruydqqvj"
region: "EMEA"
location: "Paris"
country: "FR"
name: "EU API Monitor"
provider: "GCP"
# Ad-hoc custom labels
labels:
environment: "production"
team: "platform"
datacenter: "europe-west1"
cost_center: "engineering"

# Probe with partial labels (only some predefined labels)
blackbox_minimal:
type: "blackbox_exporter"
url: "http://localhost:9115"
targets:
- "https://internal.example.com"
module: "http_2xx"
scrape_interval_secs: 30
scrape_timeout_secs: 10
# Only specify the labels you need
region: "AMER"
name: "Internal Services"
# Ad-hoc labels can be used without predefined labels
labels:
environment: "staging"
internal: "true"

# Transform - Optional: Add computed labels based on metric values
transforms:
enrich_metrics:
inputs: ["blackbox_us_west", "blackbox_eu", "blackbox_minimal"]
type: "remap"
source: |
# Add alert severity based on probe success
if .name == "probe_success" && .gauge.value == 0 {
.tags.severity = "critical"
}

# Output
sinks:
prometheus:
inputs: ["enrich_metrics"]
type: "prometheus_remote_write"
endpoint: "http://localhost:9090/api/v1/write"
19 changes: 18 additions & 1 deletion config/examples/blackbox_exporter_multiple.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Blackbox Exporter multiple targets example
# Blackbox Exporter multiple targets example with ad-hoc labels
# ------------------------------------------------------------------------------
# Scraping metrics from multiple Blackbox Exporter probes with different modules
# This example demonstrates using ad-hoc custom labels to add arbitrary
# contextual information to metrics

data_dir: "/var/lib/vector"

Expand All @@ -16,6 +18,11 @@ sources:
module: "http_2xx"
scrape_interval_secs: 15
scrape_timeout_secs: 10
# Ad-hoc custom labels for additional context
labels:
environment: "production"
team: "platform"
service_tier: "critical"

# HTTPS probes with certificate validation
blackbox_https:
Expand All @@ -27,6 +34,11 @@ sources:
module: "http_2xx_tls"
scrape_interval_secs: 60
scrape_timeout_secs: 15
# Different labels for different probe types
labels:
environment: "production"
team: "security"
compliance: "pci-dss"

# TCP probes for service availability
blackbox_tcp:
Expand All @@ -38,6 +50,11 @@ sources:
module: "tcp_connect"
scrape_interval_secs: 30
scrape_timeout_secs: 5
# Labels for infrastructure monitoring
labels:
environment: "production"
team: "database"
cost_center: "engineering"

# Transform - Add environment label
transforms:
Expand Down
Loading