Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpristas committed May 4, 2020
2 parents 933428b + c3dcfc7 commit ed5781e
Show file tree
Hide file tree
Showing 39 changed files with 6,684 additions and 686 deletions.
50 changes: 45 additions & 5 deletions .ci/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,51 @@ pipeline {
}

def pushCIDockerImages(){
sh(label: 'Push Docker image', script: '''
if [ -n "$(command -v docker)" ]; then
docker images || true
fi
''')
catchError(buildResult: 'UNSTABLE', message: 'Unable to push Docker images', stageResult: 'FAILURE') {
if ("${env.BEATS_FOLDER}" == "auditbeat"){
tagAndPush('auditbeat-oss')
} else if ("${env.BEATS_FOLDER}" == "filebeat") {
tagAndPush('filebeat-oss')
} else if ("${env.BEATS_FOLDER}" == "heartbeat"){
tagAndPush('heartbeat')
tagAndPush('heartbeat-oss')
} else if ("${env.BEATS_FOLDER}" == "journalbeat"){
tagAndPush('journalbeat')
tagAndPush('journalbeat-oss')
} else if ("${env.BEATS_FOLDER}" == "metricbeat"){
tagAndPush('metricbeat-oss')
} else if ("${env.BEATS_FOLDER}" == "packetbeat"){
tagAndPush('packetbeat')
tagAndPush('packetbeat-oss')
} else if ("${env.BEATS_FOLDER}" == "x-pack/auditbeat"){
tagAndPush('auditbeat')
} else if ("${env.BEATS_FOLDER}" == "x-pack/elastic-agent") {
tagAndPush('elastic-agent')
} else if ("${env.BEATS_FOLDER}" == "x-pack/filebeat"){
tagAndPush('filebeat')
} else if ("${env.BEATS_FOLDER}" == "x-pack/metricbeat"){
tagAndPush('metricbeat')
}
}
}

def tagAndPush(name){
def libbetaVer = sh(label: 'Get libbeat version', script: 'grep defaultBeatVersion ${BASE_DIR}/libbeat/version/version.go|cut -d "=" -f 2|tr -d \\"', returnStdout: true)?.trim()
if("${env.SNAPSHOT}" == "true"){
libbetaVer += "-SNAPSHOT"
}
def oldName = "${DOCKER_REGISTRY}/beats/${name}:${libbetaVer}"
def newName = "${DOCKER_REGISTRY}/observability-ci/${name}:${libbetaVer}"
def commitName = "${DOCKER_REGISTRY}/observability-ci/${name}:${env.GIT_BASE_COMMIT}"
dockerLogin(secret: "${DOCKERELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}")
retry(3){
sh(label:'Change tag and push', script: """
docker tag ${oldName} ${newName}
docker push ${newName}
docker tag ${oldName} ${commitName}
docker push ${commitName}
""")
}
}

def release(){
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Reference kubernetes manifests mount data directory from the host when running metricbeat as daemonset, so data persist between executions in the same node. {pull}17429[17429]
- Add more detailed error messages, system tests and small refactoring to the service metricset in windows. {pull}17725[17725]
- Stack Monitoring modules now auto-configure required metricsets when `xpack.enabled: true` is set. {issue}16471[[16471] {pull}17609[17609]
- Add Metricbeat IIS module dashboards. {pull}17966[17966]
- Add dashboard for the azure database account metricset. {pull}17901[17901]
- Allow partial region and zone name in googlecloud module config. {pull}17913[17913]
- Add aggregation aligner as a config parameter for googlecloud stackdriver metricset. {issue}17141[[17141] {pull}17719[17719]
Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ def isChangedOSSCode(patterns) {
"^libbeat/.*",
"^testing/.*",
"^dev-tools/.*",
"^\\.ci/.*",
"^\\.ci/scripts/.*",
]
allPatterns.addAll(patterns)
return isChanged(allPatterns)
Expand All @@ -932,7 +932,7 @@ def isChangedXPackCode(patterns) {
"^dev-tools/.*",
"^testing/.*",
"^x-pack/libbeat/.*",
"^\\.ci/.*",
"^\\.ci/scripts/.*",
]
allPatterns.addAll(patterns)
return isChanged(allPatterns)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ This file is generated! See scripts/mage/docs_collector.go
|<<metricbeat-metricset-http-server,server>>
|<<metricbeat-module-ibmmq,IBM MQ>> beta[] |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.1+| .1+| |<<metricbeat-metricset-ibmmq-qmgr,qmgr>> beta[]
|<<metricbeat-module-iis,iis>> beta[] |image:./images/icon-no.png[No prebuilt dashboards] |
|<<metricbeat-module-iis,iis>> beta[] |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.3+| .3+| |<<metricbeat-metricset-iis-application_pool,application_pool>> beta[]
|<<metricbeat-metricset-iis-webserver,webserver>> beta[]
|<<metricbeat-metricset-iis-website,website>> beta[]
Expand Down
132 changes: 67 additions & 65 deletions metricbeat/module/windows/perfmon/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,54 +38,52 @@ var processRegexp = regexp.MustCompile(`(.+?)#[1-9]+`)
func (re *Reader) groupToEvents(counters map[string][]pdh.CounterValue) []mb.Event {
eventMap := make(map[string]*mb.Event)
for counterPath, values := range counters {
hasCounter, counter := re.getCounter(counterPath)
for ind, val := range values {
// Some counters, such as rate counters, require two counter values in order to compute a displayable value. In this case we must call PdhCollectQueryData twice before calling PdhGetFormattedCounterValue.
// For more information, see Collecting Performance Data (https://docs.microsoft.com/en-us/windows/desktop/PerfCtrs/collecting-performance-data).
if val.Err != nil && !re.executed {
re.log.Debugw("Ignoring the first measurement because the data isn't ready",
"error", val.Err, logp.Namespace("perfmon"), "query", counterPath)
continue
}

var eventKey string
if re.config.GroupMeasurements && val.Err == nil {
// Send measurements with the same instance label as part of the same event
eventKey = val.Instance
} else {
// Send every measurement as an individual event
// If a counter contains an error, it will always be sent as an individual event
eventKey = counterPath + strconv.Itoa(ind)
}

// Create a new event if the key doesn't exist in the map
if _, ok := eventMap[eventKey]; !ok {
eventMap[eventKey] = &mb.Event{
MetricSetFields: common.MapStr{},
Error: errors.Wrapf(val.Err, "failed on query=%v", counterPath),
if hasCounter, counter := re.getCounter(counterPath); hasCounter {
for ind, val := range values {
// Some counters, such as rate counters, require two counter values in order to compute a displayable value. In this case we must call PdhCollectQueryData twice before calling PdhGetFormattedCounterValue.
// For more information, see Collecting Performance Data (https://docs.microsoft.com/en-us/windows/desktop/PerfCtrs/collecting-performance-data).
if val.Err != nil && !re.executed {
re.log.Debugw("Ignoring the first measurement because the data isn't ready",
"error", val.Err, logp.Namespace("perfmon"), "query", counterPath)
continue
}
if val.Instance != "" && hasCounter {
//will ignore instance counter
if ok, match := matchesParentProcess(val.Instance); ok {
eventMap[eventKey].MetricSetFields.Put(counter.InstanceField, match)
} else {
eventMap[eventKey].MetricSetFields.Put(counter.InstanceField, val.Instance)
var eventKey string
if re.config.GroupMeasurements && val.Err == nil {
// Send measurements with the same instance label as part of the same event
eventKey = val.Instance
} else {
// Send every measurement as an individual event
// If a counter contains an error, it will always be sent as an individual event
eventKey = counterPath + strconv.Itoa(ind)
}
// Create a new event if the key doesn't exist in the map
if _, ok := eventMap[eventKey]; !ok {
eventMap[eventKey] = &mb.Event{
MetricSetFields: common.MapStr{},
Error: errors.Wrapf(val.Err, "failed on query=%v", counterPath),
}
if val.Instance != "" {
//will ignore instance counter
if ok, match := matchesParentProcess(val.Instance); ok {
eventMap[eventKey].MetricSetFields.Put(counter.InstanceField, match)
} else {
eventMap[eventKey].MetricSetFields.Put(counter.InstanceField, val.Instance)
}
}
}
}
event := eventMap[eventKey]
if val.Measurement != nil {
event.MetricSetFields.Put(counter.QueryField, val.Measurement)
} else {
event.MetricSetFields.Put(counter.QueryField, 0)
}
if counter.ObjectField != "" {
event.MetricSetFields.Put(counter.ObjectField, counter.ObjectName)
if val.Measurement != nil {
eventMap[eventKey].MetricSetFields.Put(counter.QueryField, val.Measurement)
} else {
eventMap[eventKey].MetricSetFields.Put(counter.QueryField, 0)
}
if counter.ObjectField != "" {
eventMap[eventKey].MetricSetFields.Put(counter.ObjectField, counter.ObjectName)
}
}
}
}
// Write the values into the map.
events := make([]mb.Event, 0, len(eventMap))
var events []mb.Event
for _, val := range eventMap {
events = append(events, *val)
}
Expand All @@ -98,30 +96,34 @@ func (re *Reader) groupToSingleEvent(counters map[string][]pdh.CounterValue) mb.
}
measurements := make(map[string]float64, 0)
for counterPath, values := range counters {
_, readerCounter := re.getCounter(counterPath)
for _, val := range values {
// Some counters, such as rate counters, require two counter values in order to compute a displayable value. In this case we must call PdhCollectQueryData twice before calling PdhGetFormattedCounterValue.
// For more information, see Collecting Performance Data (https://docs.microsoft.com/en-us/windows/desktop/PerfCtrs/collecting-performance-data).
if val.Err != nil && !re.executed {
re.log.Debugw("Ignoring the first measurement because the data isn't ready",
"error", val.Err, logp.Namespace("perfmon"), "query", counterPath)
continue
}
var counterVal float64
switch val.Measurement.(type) {
case int64:
counterVal = float64(val.Measurement.(int64))
case int:
counterVal = float64(val.Measurement.(int))
default:
counterVal = val.Measurement.(float64)
}
if _, ok := measurements[readerCounter.QueryField]; !ok {
measurements[readerCounter.QueryField] = counterVal
measurements[readerCounter.QueryField+instanceCountLabel] = 1
} else {
measurements[readerCounter.QueryField+instanceCountLabel] = measurements[readerCounter.QueryField+instanceCountLabel] + 1
measurements[readerCounter.QueryField] = measurements[readerCounter.QueryField] + counterVal
if hasCounter, readerCounter := re.getCounter(counterPath); hasCounter {
for _, val := range values {
// Some counters, such as rate counters, require two counter values in order to compute a displayable value. In this case we must call PdhCollectQueryData twice before calling PdhGetFormattedCounterValue.
// For more information, see Collecting Performance Data (https://docs.microsoft.com/en-us/windows/desktop/PerfCtrs/collecting-performance-data).
if val.Err != nil && !re.executed {
re.log.Debugw("Ignoring the first measurement because the data isn't ready",
"error", val.Err, logp.Namespace("perfmon"), "query", counterPath)
continue
}
if val.Measurement == nil {
continue
}
var counterVal float64
switch val.Measurement.(type) {
case int64:
counterVal = float64(val.Measurement.(int64))
case int:
counterVal = float64(val.Measurement.(int))
default:
counterVal = val.Measurement.(float64)
}
if _, ok := measurements[readerCounter.QueryField]; !ok {
measurements[readerCounter.QueryField] = counterVal
measurements[readerCounter.QueryField+instanceCountLabel] = 1
} else {
measurements[readerCounter.QueryField+instanceCountLabel] = measurements[readerCounter.QueryField+instanceCountLabel] + 1
measurements[readerCounter.QueryField] = measurements[readerCounter.QueryField] + counterVal
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@
- Enable Filebeat input: S3, Azureeventhub, cloudfoundry, httpjson, netflow, o365audit. {pull}17909[17909]
- Configurable log level {pull}18083[18083]
- Use data subfolder as default for process logs {pull}17960[17960]
- Do not require unnecessary configuration {pull}18003[18003]
- Enable debug log level for Metricbeat and Filebeat when run under the Elastic Agent. {pull}17935[17935]
Loading

0 comments on commit ed5781e

Please sign in to comment.