Skip to content

Commit

Permalink
Merge branch 'v3' into PMM-12619-env-vars-rename
Browse files Browse the repository at this point in the history
  • Loading branch information
idoqo committed Mar 3, 2024
2 parents f40cc41 + 6651430 commit 68a08ad
Show file tree
Hide file tree
Showing 25 changed files with 619 additions and 530 deletions.
5 changes: 5 additions & 0 deletions admin/commands/management/add_postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ var addPostgreSQLResultT = commands.ParseTemplate(`
PostgreSQL Service added.
Service ID : {{ .Service.ServiceID }}
Service name: {{ .Service.ServiceName }}
{{ if .Warning }}
Warning: {{ .Warning }}
{{- end -}}
`)

type addPostgreSQLResult struct {
Service *postgresql.AddPostgreSQLOKBodyService `json:"service"`
Warning string `json:"warning"`
}

func (res *addPostgreSQLResult) Result() {}
Expand Down Expand Up @@ -223,5 +227,6 @@ func (cmd *AddPostgreSQLCommand) RunCmd() (commands.Result, error) {

return &addPostgreSQLResult{
Service: resp.Payload.Service,
Warning: resp.Payload.Warning,
}, nil
}
8 changes: 8 additions & 0 deletions agent/serviceinfobroker/service_info_broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/go-sql-driver/mysql"
"github.com/lib/pq"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"go.mongodb.org/mongo-driver/mongo"

Expand Down Expand Up @@ -231,6 +232,13 @@ func (sib *ServiceInfoBroker) getPostgreSQLInfo(ctx context.Context, dsn string,
}
res.Version = version

var pgsmVersion string
err = db.QueryRowContext(ctx, "SELECT /* agent='serviceinfobroker' */ extversion FROM pg_extension WHERE extname = 'pg_stat_monitor';").Scan(&pgsmVersion)
if err != nil && !errors.Is(err, sql.ErrNoRows) {
res.Error = err.Error()
}
res.PgsmVersion = pgsmVersion

return &res
}

Expand Down
14 changes: 14 additions & 0 deletions agent/serviceinfobroker/service_info_broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,20 @@ func TestServiceInfoBroker(t *testing.T) {
assert.InDelta(t, 250, resp.TableCount, 150)
})

t.Run("PostgreSQLOptions", func(t *testing.T) {
cfgStorage := config.NewStorage(&config.Config{
Paths: config.Paths{TempDir: t.TempDir()},
})
c := New(cfgStorage)
resp := c.GetInfoFromService(context.Background(), &agentpb.ServiceInfoRequest{
Dsn: tests.GetTestPostgreSQLDSN(t),
Type: inventorypb.ServiceType_POSTGRESQL_SERVICE,
}, 0)
require.NotNil(t, resp)
assert.Equal(t, []string{"postgres", "pmm-agent"}, resp.DatabaseList)
assert.Equal(t, "", resp.PgsmVersion)
})

t.Run("MongoDBWithSSL", func(t *testing.T) {
mongoDBDSNWithSSL, mongoDBTextFiles := tests.GetTestMongoDBWithSSLDSN(t, "../")

Expand Down
843 changes: 427 additions & 416 deletions api/agentpb/agent.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions api/agentpb/agent.pb.validate.go

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

2 changes: 2 additions & 0 deletions api/agentpb/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ message ServiceInfoResponse {
string version = 3;
// A list of PostgreSQL databases.
repeated string database_list = 4;
// A version of pg_stat_monitor, empty if unavailable.
string pgsm_version = 5;
}

// JobStatusRequest is a ServerMessage asking pmm-agent for job status.
Expand Down

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

5 changes: 5 additions & 0 deletions api/managementpb/json/managementpb.json
Original file line number Diff line number Diff line change
Expand Up @@ -4626,6 +4626,11 @@
}
},
"x-order": 0
},
"warning": {
"description": "Warning message.",
"type": "string",
"x-order": 4
}
}
}
Expand Down
82 changes: 46 additions & 36 deletions api/managementpb/postgresql.pb.go

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

2 changes: 2 additions & 0 deletions api/managementpb/postgresql.pb.validate.go

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

2 changes: 2 additions & 0 deletions api/managementpb/postgresql.proto
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ message AddPostgreSQLResponse {
inventory.PostgresExporter postgres_exporter = 2;
inventory.QANPostgreSQLPgStatementsAgent qan_postgresql_pgstatements_agent = 3;
inventory.QANPostgreSQLPgStatMonitorAgent qan_postgresql_pgstatmonitor_agent = 4;
// Warning message.
string warning = 5;
}

// PostgreSQL service provides public Management API methods for PostgreSQL Service.
Expand Down
5 changes: 5 additions & 0 deletions api/swagger/swagger-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -22963,6 +22963,11 @@
}
},
"x-order": 3
},
"warning": {
"description": "Warning message.",
"type": "string",
"x-order": 4
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions api/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -19291,6 +19291,11 @@
}
},
"x-order": 3
},
"warning": {
"description": "Warning message.",
"type": "string",
"x-order": 4
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/docker/rpmbuild/Dockerfile.el9
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM oraclelinux:9-slim

RUN microdnf install -y yum
# enable nodesource repo for nodejs
RUN curl -sL https://rpm.nodesource.com/setup_18.x | bash -
RUN curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
RUN microdnf install -y yum

RUN yum update -y && \
yum install -y --setopt=skip_missing_names_on_install=False \
Expand Down
2 changes: 2 additions & 0 deletions build/scripts/vars
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pmm_branch=$(git rev-parse --abbrev-ref HEAD)

pmm_base_version=$(cat ${root_dir}/VERSION)
full_pmm_version=${pmm_base_version}-${pmm_branch}-$(git rev-parse --short HEAD)
# Replace '/' with '-' to prevent sed from failing on dependabot-authored PRs
full_pmm_version=${full_pmm_version//\//-}

# TODO Maybe it makes sense to use variable from job here
if [[ ${pmm_branch} =~ release-* || \
Expand Down
Loading

0 comments on commit 68a08ad

Please sign in to comment.