Skip to content

Migrate obs-infraobs-integrations to package-spec v3 #2 - #8171

Merged
tommyers-elastic merged 44 commits into
elastic:mainfrom
shmsr:migrate-infraobs-ps-v3-batch-2-serverless
Oct 19, 2023
Merged

Migrate obs-infraobs-integrations to package-spec v3 #2#8171
tommyers-elastic merged 44 commits into
elastic:mainfrom
shmsr:migrate-infraobs-ps-v3-batch-2-serverless

Conversation

@shmsr

@shmsr shmsr commented Oct 12, 2023

Copy link
Copy Markdown
Member

Migrate a batch of packages from v1/v2 to v3 package-spec. Used the following scripts and some manual changes to generate the changes in this PR:

yq_hack.zsh

#!/bin/bash

set -e
set -u
set -o pipefail
set -x

pushd $1

find data_stream -type f -path "*fields*" -name "*.yml" -exec yq e -i "del .[].release" {} \;
find data_stream -type f -path "*fields*" -name "ecs.yml" -exec yq e -i "unique_by(.name)" {} \;
find data_stream -type f -path "*fields*" -name "*.yml" -exec yq e -i "del .[].fields.[].required" {} \;

yq e -i 'del .release' manifest.yml
yq e -i "with(select(.license != null); .conditions.elastic.subscription = .license) | del .license" manifest.yml

popd

git add -u $1/
git commit -m "[$1]: migration with yq"

ecs-update.zsh

#!/bin/bash

set -u
set -o pipefail
set -x

echo "-- executing ecs-update for $1 --"

ecs-update -format-version=3.0.0 -fix-dotted-yaml-keys -add-owner-type -owner elastic/obs-infraobs-integrations -v -skip-format=true $1

if (( $? )) 
then
    echo "-- write validation for $1 --"
    pushd $1

    go run ../scripting/write_validation.go

    popd

    # Try again?
    git checkout .
    ecs-update -format-version=3.0.0 -fix-dotted-yaml-keys -add-owner-type -owner elastic/obs-infraobs-integrations -v -skip-format=true $1
fi

And another Go program to write the validation.yml by parsing the elastic-package lint errors.

Then I hooked this scripts to run with:

$ pkgs=($(cat .github/CODEOWNERS | grep '@elastic/obs-infraobs-integrations' | cut -d ' ' -f 1 | cut -d '/' -f 3 | sort | uniq))

$ for ((idx=16; idx<=30; idx++))
do
scripting/yq_hack.zsh $pkgs[idx]
done
$ for ((idx=16; idx<=30; idx++))
do
scripting/ecs_update.zsh $pkgs[idx] || break
done

Another variation of the above script:

$ for ((idx=16; idx<=30; idx++))
do
case $pkgs[idx] in
  "nagios_xi" | "ibmmq" | "haproxy") echo "-- skip $pkgs[idx] --";;
  "nginx" | "memcached" | "kafka_log" | "jolokia_input" | "mongodb" | "mysql" | "microsoft_sqlserver" | "kafka" | "influxdb" | "iis" | "golang" | "hadoop") echo "-- done $pkgs[idx] --";;
  *) scripting/ecs_update.zsh $pkgs[idx] || break;;
esac
done

As I am creating a batch of 15 packages per migration, I am using a for loop. In case the migration is not possible for some packages, I put it in the first case to skip them.

Proposed commit message

Migrate packages owned by obs-infraobs-integrations but few couldn't be migrated. Marking them as follows:

  • golang
  • hadoop
  • haproxy
  • ibmmq
  • iis
  • influxdb
  • jolokia_input
  • kafka
  • kafka_log
  • memcached
  • microsoft_sqlserver
  • mongodb
  • mysql
  • nagios_xi
  • nginx

Please see the comment #8171 (comment) in this PR itself to understand why some packages couldn't be migrated and also learn about the challenges faced when migrating.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Relates to #8170

Screenshots

shmsr added 18 commits October 12, 2023 13:45
The format_version in the package manifest changed from 2.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/golang
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/hadoop
The format_version in the package manifest changed from 2.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/jolokia_input
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/kafka_log
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Added
'owner.type: elastic' to package manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/memcached
@elasticmachine

elasticmachine commented Oct 12, 2023

Copy link
Copy Markdown

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-10-19T07:50:38.693+0000

  • Duration: 24 min 30 sec

Test stats 🧪

Test Results
Failed 0
Passed 223
Skipped 0
Total 223

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine

elasticmachine commented Oct 12, 2023

Copy link
Copy Markdown

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (17/17) 💚
Files 91.304% (21/23) 👎 -8.696
Classes 91.304% (21/23) 👎 -8.696
Methods 88.066% (214/243) 👍 12.308
Lines 94.99% (2977/3134) 👎 -5.01
Conditionals 100.0% (0/0) 💚
shmsr added 9 commits October 12, 2023 14:17
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/iis
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/influxdb
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/kafka
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/microsoft_sqlserver
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/mongodb
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/mysql
The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/nginx
@shmsr

shmsr commented Oct 12, 2023

Copy link
Copy Markdown
Member Author
  • haproxy

    • Legacy viz: file "/Users/subhamsarkar/go/src/github.com/elastic/integrations/build/packages/haproxy-1.8.4.zip/kibana/visualization/haproxy-794b6cd0-471d-11e8-bc13-1397384faad3.json" is invalid: found legacy visualization "Active servers in backend [Metrics HAProxy]" (metric, TSVB)
  • ibmmq

    • Legacy viz: file "/Users/subhamsarkar/go/src/github.com/elastic/integrations/build/packages/ibmmq-1.2.3.zip/kibana/dashboard/ibmmq-ba1d8830-7c7b-11e9-9645-e37efaf5baff.json" is invalid: "[Logs IBM MQ] Overview of error log" contains legacy visualization: "Top 5 Errors [Logs IBM MQ]" (table, Aggs-based)
  • nagios_xi

    • file "/Users/subhamsarkar/go/src/github.com/elastic/integrations/build/packages/nagios_xi-1.1.1.zip/data_stream/service/fields/fields.yml" is invalid: field 0.fields.0.fields.20: Additional property decription is not allowed
      • This is not expected. Needs to be checked. Skipping for now.
Comment thread packages/mysql/data_stream/performance/manifest.yml
Comment thread packages/mysql/data_stream/status/manifest.yml Outdated

@tommyers-elastic tommyers-elastic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome - no blockers from me. couple of comments still to resolve though. thanks !

@tommyers-elastic
tommyers-elastic merged commit 6445a75 into elastic:main Oct 19, 2023
@elasticmachine

Copy link
Copy Markdown

Package golang - 1.1.0 containing this change is available at https://epr.elastic.co/search?package=golang

@elasticmachine

Copy link
Copy Markdown

Package hadoop - 1.3.0 containing this change is available at https://epr.elastic.co/search?package=hadoop

@elasticmachine

Copy link
Copy Markdown

Package iis - 1.16.0 containing this change is available at https://epr.elastic.co/search?package=iis

@elasticmachine

Copy link
Copy Markdown

Package jolokia - 0.3.0 containing this change is available at https://epr.elastic.co/search?package=jolokia

@elasticmachine

Copy link
Copy Markdown

Package kafka - 1.10.0 containing this change is available at https://epr.elastic.co/search?package=kafka

@elasticmachine

Copy link
Copy Markdown

Package kafka_log - 1.4.0 containing this change is available at https://epr.elastic.co/search?package=kafka_log

@elasticmachine

Copy link
Copy Markdown

Package memcached - 1.3.0 containing this change is available at https://epr.elastic.co/search?package=memcached

@elasticmachine

Copy link
Copy Markdown

Package microsoft_sqlserver - 2.3.0 containing this change is available at https://epr.elastic.co/search?package=microsoft_sqlserver

@elasticmachine

Copy link
Copy Markdown

Package mysql - 1.16.0 containing this change is available at https://epr.elastic.co/search?package=mysql

@elasticmachine

Copy link
Copy Markdown

Package nginx - 1.16.0 containing this change is available at https://epr.elastic.co/search?package=nginx

orestisfl pushed a commit to orestisfl/integrations that referenced this pull request May 15, 2026
…ic#8171)

* [hadoop]: migration with yq

* [haproxy]: migration with yq

* [ibmmq]: migration with yq

* [iis]: migration with yq

* [influxdb]: migration with yq

* [kafka]: migration with yq

* [kafka_log]: migration with yq

* [memcached]: migration with yq

* [microsoft_sqlserver]: migration with yq

* [mongodb]: migration with yq

* [mysql]: migration with yq

* [nagios_xi]: migration with yq

* [nginx]: migration with yq

* [golang] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 2.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/golang

* [hadoop] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/hadoop

* [jolokia] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 2.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/jolokia_input

* [kafka_log] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/kafka_log

* [memcached] - change to format_version 3.0.0

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Added
'owner.type: elastic' to package manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/memcached

* [iis] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/iis

* [influxdb] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/influxdb

* [kafka] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/kafka

* [microsoft_sqlserver]: migration with yq

* [microsoft_sqlserver] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/microsoft_sqlserver

* [mongodb] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/mongodb

* [mysql] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/mysql

* [nginx] - removed dotted YAML keys from manifest

The format_version in the package manifest changed from 1.0.0 to 3.0.0. Removed
dotted YAML keys from package manifest. Added 'owner.type: elastic' to package
manifest.

[git-generate]
go run github.com/andrewkroh/go-examples/ecs-update@latest -v -format-version=3.0.0 -skip-format -fix-dotted-yaml-keys -add-owner-type packages/nginx

* Add validation.yml

* Format packages and quote fields where necessary

* revert changes for packages for which v3 migration failed

* [hadoop,haproxy,iis,mongodb]: remove duplicates from agent.yml instead of ecs.yml

* Fix PR number in changelog

* Fix inconsistency w/ elastic-build

* [mongodb]: Add dimension field which was removed during dedup of fields

* quote fields where necessary

* Add release field to data stream's manifest if removed from fields

* Quote index.mapping.dimension_fields.limit to avoid getting changed by ep format

* Revert "Quote index.mapping.dimension_fields.limit to avoid getting changed by ep format"

This reverts commit 37b2f20cd11e50f1700273891269b78f1a1a382a.

* Add comment

* [mongodb]: revert changes package-spec v3 migration

* [influxdb]: revert changes package-spec v3 migration

* remove validation.yml for package which are not migrated to v3

* remove comment

* [hadoop]: update definition for tags

* remove release: beta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment