Merge pull request #1487 from docker/cli-source

make metrics' source configuration (see compose-switch)
This commit is contained in:
Guillaume Tardif 2021-04-06 11:22:26 +02:00 committed by GitHub
commit 78660493ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import (
"encoding/json"
"net"
"net/http"
"os"
"time"
)
@ -37,9 +38,16 @@ type Command struct {
Status string `json:"status"`
}
const (
// CLISource is sent for cli metrics
CLISource = "cli"
var CLISource = "cli"
func init() {
if v, ok := os.LookupEnv("DOCKER_METRICS_SOURCE"); ok {
CLISource = v
}
}
const (
// APISource is sent for API metrics
APISource = "api"
// SuccessStatus is sent for API metrics