Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subset of metadata fields #113

Merged
merged 4 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Documentation is [available here](https://kube-burner.github.io/kube-burner-ocp/
Some of the benefits the OCP wrapper provides are:

- Simplified execution of the supported workloads. (Only some flags are required)
- Adds OpenShift metadata to the generated documents.
- Adds OpenShift metadata to generated jobSummary and a small subset of metadata fields to the remaining metrics.
- Prevents modifying configuration files to tweak some of the parameters of the workloads.
- Discovers the Prometheus URL and authentication token, so the user does not have to perform those operations before using them.
- Workloads configuration is directly embedded in the binary.
Expand Down
6 changes: 5 additions & 1 deletion cluster-density.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func NewClusterDensity(wh *workloads.WorkloadHelper, variant string) *cobra.Comm
var churnDeletionStrategy string
var podReadyThreshold time.Duration
var metricsProfiles []string
var rc int
cmd := &cobra.Command{
Use: variant,
Short: fmt.Sprintf("Runs %v workload", variant),
Expand Down Expand Up @@ -62,7 +63,10 @@ func NewClusterDensity(wh *workloads.WorkloadHelper, variant string) *cobra.Comm
}
}
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
rc = wh.Run(cmd.Name())
},
PostRun: func(cmd *cobra.Command, args []string) {
os.Exit(rc)
},
}
cmd.Flags().DurationVar(&podReadyThreshold, "pod-ready-threshold", 2*time.Minute, "Pod ready timeout threshold")
Expand Down
6 changes: 5 additions & 1 deletion common.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func GatherMetadata(wh *workloads.WorkloadHelper, alerting bool) error {
if err != nil {
return err
}
json.Unmarshal(jsonData, &wh.Metadata)
json.Unmarshal(jsonData, &wh.SummaryMetadata)
wh.MetricsMetadata = map[string]interface{}{
"ocpMajorVersion": clusterMetadata.OCPMajorVersion,
"ocpVersion": clusterMetadata.OCPVersion,
}
return nil
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.3
require (
github.com/cloud-bulldozer/go-commons v1.0.16
github.com/google/uuid v1.6.0
github.com/kube-burner/kube-burner v1.10.7
github.com/kube-burner/kube-burner v1.10.8
github.com/openshift/api v0.0.0-20240527133614-ba11c1587003
github.com/openshift/client-go v0.0.0-20240821135114-75c118605d5f
github.com/praserx/ipconv v1.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kube-burner/kube-burner v1.10.7 h1:QcEQt0x7AxoPT9VTzyO1TZNAdQYAKk4Fz9NJ/uSunjA=
github.com/kube-burner/kube-burner v1.10.7/go.mod h1:NKtSusPSi2rmS5kYAYC1A+JTsC4RsI0VIHFt6ET4EJE=
github.com/kube-burner/kube-burner v1.10.8 h1:WD93tpAbwMWige449qLYUn5T7DRShKQQRepNLiPK/YE=
github.com/kube-burner/kube-burner v1.10.8/go.mod h1:NKtSusPSi2rmS5kYAYC1A+JTsC4RsI0VIHFt6ET4EJE=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
Expand Down
4 changes: 2 additions & 2 deletions index.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func NewIndex(metricsEndpoint *string, ocpMetaAgent *ocpmetadata.Metadata) *cobr
ConfigSpec: &workloads.ConfigSpec,
MetricsEndpoint: *metricsEndpoint,
UserMetaData: userMetadata,
RawMetadata: metadata,
MetricsMetadata: metadata,
})
for _, prometheusClient := range metricsScraper.PrometheusClients {
prometheusJob := prometheus.Job{
Expand Down Expand Up @@ -137,7 +137,7 @@ func NewIndex(metricsEndpoint *string, ocpMetaAgent *ocpmetadata.Metadata) *cobr
JobConfig: config.Job{
Name: jobName,
},
Metadata: metricsScraper.Metadata,
Metadata: metricsScraper.SummaryMetadata,
MetricName: "jobSummary",
Version: fmt.Sprintf("%v@%v", version.Version, version.GitCommit),
Passed: rc == 0,
Expand Down
3 changes: 2 additions & 1 deletion test/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ print_events() {
check_metric_value() {
sleep 3s # There's some delay on the documents to show up in OpenSearch
for metric in "${@}"; do
endpoint="${ES_SERVER}/${ES_INDEX}/_search?q=uuid.keyword:${UUID}+AND+metricName.keyword:${metric}"
query="uuid.keyword:${UUID}+AND+metricName.keyword:${metric}+AND+(metadata.ocpVersion.keyword:*+OR+ocpVersion.keyword:*)"
endpoint="${ES_SERVER}/${ES_INDEX}/_search?q=${query}"
RESULT=$(curl -sS ${endpoint} | jq '.hits.total.value // error')
RETURN_CODE=$?
if [ "${RETURN_CODE}" -ne 0 ]; then
Expand Down
7 changes: 4 additions & 3 deletions workers-scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ func NewWorkersScale(metricsEndpoint *string, ocpMetaAgent *ocpmetadata.Metadata
ConfigSpec: &workloads.ConfigSpec,
MetricsEndpoint: *metricsEndpoint,
UserMetaData: userMetadata,
RawMetadata: metadata,
MetricsMetadata: metadata,
SummaryMetadata: metadata,
})
var indexerValue indexers.Indexer
for _, value := range metricsScraper.IndexerList {
Expand All @@ -130,7 +131,7 @@ func NewWorkersScale(metricsEndpoint *string, ocpMetaAgent *ocpmetadata.Metadata
scenario.OrchestrateWorkload(wscale.ScaleConfig{
UUID: uuid,
AdditionalWorkerNodes: additionalWorkerNodes,
Metadata: metricsScraper.Metadata,
Metadata: metricsScraper.MetricsMetadata,
Indexer: indexerValue,
GC: gc,
ScaleEventEpoch: scaleEventEpoch,
Expand Down Expand Up @@ -162,7 +163,7 @@ func NewWorkersScale(metricsEndpoint *string, ocpMetaAgent *ocpmetadata.Metadata
JobConfig: config.Job{
Name: wscale.JobName,
},
Metadata: metricsScraper.Metadata,
Metadata: metricsScraper.SummaryMetadata,
MetricName: "jobSummary",
Version: fmt.Sprintf("%v@%v", version.Version, version.GitCommit),
Passed: rc == 0,
Expand Down
Loading