Skip to content

Commit

Permalink
[EDIT] Custom postgres_exporter - Bypass some check
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Nguyen Minh committed Aug 27, 2020
1 parent 3ecfd46 commit b037faf
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
12 changes: 7 additions & 5 deletions cmd/postgres_exporter/postgres_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1386,12 +1386,14 @@ func queryNamespaceMappings(ch chan<- prometheus.Metric, server *Server) map[str
// Check and update the exporters query maps if the version has changed.
func (e *Exporter) checkMapVersions(ch chan<- prometheus.Metric, server *Server) error {
log.Debugf("Querying Postgres Version on %q", server)
versionRow := server.db.QueryRow("SELECT version();")
// versionRow := server.db.QueryRow("SELECT version();")
var versionString string
err := versionRow.Scan(&versionString)
if err != nil {
return fmt.Errorf("Error scanning version string on %q: %v", server, err)
}
// err := versionRow.Scan(&versionString)
// if err != nil {
// return fmt.Errorf("Error scanning version string on %q: %v", server, err)
// }
// Ignore query "SELECT version();" to bypass 'versionRow' and 'err' variable above - https://github.com/nmtien96
versionString = "PostgreSQL 12.0.0 . This is fake postgres version to bypass 'versionRow' and 'err' variable above."
semanticVersion, err := parseVersion(versionString)
if err != nil {
return fmt.Errorf("Error parsing version string on %q: %v", server, err)
Expand Down
36 changes: 18 additions & 18 deletions gh-assets-clone.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash
# Script to setup the assets clone of the repository using GIT_ASSETS_BRANCH and
# GIT_API_KEY.

[ ! -z "$GIT_ASSETS_BRANCH" ] || exit 1

setup_git() {
git config --global user.email "travis@travis-ci.org" || exit 1
git config --global user.name "Travis CI" || exit 1
}

# Constants
ASSETS_DIR=".assets-branch"

# Clone the assets branch with the correct credentials
git clone --single-branch -b "$GIT_ASSETS_BRANCH" \
"https://${GIT_API_KEY}@github.com/${TRAVIS_REPO_SLUG}.git" "$ASSETS_DIR" || exit 1

#!/bin/bash
# Script to setup the assets clone of the repository using GIT_ASSETS_BRANCH and
# GIT_API_KEY.

[ ! -z "$GIT_ASSETS_BRANCH" ] || exit 1

setup_git() {
git config --global user.email "travis@travis-ci.org" || exit 1
git config --global user.name "Travis CI" || exit 1
}

# Constants
ASSETS_DIR=".assets-branch"

# Clone the assets branch with the correct credentials
git clone --single-branch -b "$GIT_ASSETS_BRANCH" \
"https://${GIT_API_KEY}@github.com/${TRAVIS_REPO_SLUG}.git" "$ASSETS_DIR" || exit 1

11 changes: 6 additions & 5 deletions vendor/github.com/lib/pq/conn_go18.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vendor/github.com/lib/pq/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b037faf

Please sign in to comment.