-
-
Save seankhliao/497ccd8a60a093c334af066bd83624d0 to your computer and use it in GitHub Desktop.
c2d debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
receivers: | |
prometheus: | |
config: | |
global: | |
scrape_interval: 5s | |
scrape_configs: | |
- job_name: foo | |
static_configs: | |
- targets: ['0.0.0.0:8080'] | |
use_start_time_metric: true | |
# use_start_time_metric: false | |
processors: | |
filter: | |
metrics: | |
metric: | |
- 'name != "foobar"' | |
transform: | |
metric_statements: | |
- context: metric | |
statements: | |
- 'set(name, "fizzbuzz")' | |
cumulativetodelta: | |
initial_value: auto | |
exporters: | |
logging: | |
verbosity: detailed | |
connectors: | |
forward: | |
service: | |
pipelines: | |
metrics/1: | |
receivers: | |
- prometheus | |
processors: | |
- filter | |
exporters: | |
- logging | |
- forward | |
metrics/2: | |
receivers: | |
- forward | |
processors: | |
- transform | |
- cumulativetodelta | |
exporters: | |
- logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/http" | |
"time" | |
"github.com/prometheus/client_golang/prometheus" | |
"github.com/prometheus/client_golang/prometheus/promauto" | |
"github.com/prometheus/client_golang/prometheus/promhttp" | |
) | |
func main() { | |
ctr := promauto.NewCounter(prometheus.CounterOpts{ | |
Name: "foobar", | |
}) | |
go func() { | |
for range time.NewTicker(time.Second).C { | |
ctr.Add(1) | |
} | |
}() | |
http.ListenAndServe(":8080", promhttp.Handler()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment