Skip to content

Commit

Permalink
Make one-shot Prometheus emit prog label and metric timestamp flags
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <[email protected]>
  • Loading branch information
roidelapluie committed Sep 17, 2021
1 parent b5c51f4 commit 890e811
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/mtail/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func main() {
mtail.MaxRegexpLength(*maxRegexpLength),
mtail.MaxRecursionDepth(*maxRecursionDepth),
}
eOpts := []exporter.Option{}
if *logRuntimeErrors {
opts = append(opts, mtail.LogRuntimeErrors)
}
Expand Down Expand Up @@ -205,9 +206,11 @@ func main() {
}
if !*emitProgLabel {
opts = append(opts, mtail.OmitProgLabel)
eOpts = append(eOpts, exporter.OmitProgLabel())
}
if *emitMetricTimestamp {
opts = append(opts, mtail.EmitMetricTimestamp)
eOpts = append(eOpts, exporter.EmitTimestamp())
}
if *jaegerEndpoint != "" {
opts = append(opts, mtail.JaegerReporter(*jaegerEndpoint))
Expand All @@ -231,7 +234,7 @@ func main() {
if *oneShot {
switch *oneShotFormat {
case "prometheus":
e, err := exporter.New(ctx, nil, store)
e, err := exporter.New(ctx, nil, store, eOpts...)
if err != nil {
glog.Error(err)
cancel()
Expand Down

0 comments on commit 890e811

Please sign in to comment.