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

chore: Trace log pom property reflect usage #2059

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

willmurphyscode
Copy link
Contributor

@willmurphyscode willmurphyscode commented Aug 24, 2023

This reflect code occasionally throws an obscure panic, but not enough information is logged before the panic to know why it panicked. Log enough to tell what property and package are being analyzed when the panic occurs.

Test command:

go run cmd/syft/main.go -vvvv ./test/integration/test-fixtures/image-pkg-coverage/pkgs/java/example-java-app-maven-0.1.0.jar

Example of new logging:

...
[0000] TRACE parsing file contents path=/example-java-app-maven-0.1.0.jar
[0000] TRACE parsing pom.xml artifactID=example-java-app-maven name= path=META-INF/maven/org.anchore/example-java-app-maven/pom.xml projectURL=
[0000] TRACE resolving property existingPropertyValue=org.anchore propertyName=groupId
[0000] TRACE resolving property existingPropertyValue=0.1.0 propertyName=version
[0000] TRACE parsing pom.xml artifactID=joda-time name=Joda-Time path=META-INF/maven/joda-time/joda-time/pom.xml projectURL=http://www.joda.org/joda-time/
[0000] TRACE resolving property existingPropertyValue=joda-time propertyName=groupId
[0000] TRACE resolving property existingPropertyValue=2.9.2 propertyName=version
...

This reflect code occasionally throws an obscure panic, but not enough
information is logged before the panic to know why it panicked. Log
enough to tell what property and package are being analyzed when the
panic occurs.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
@willmurphyscode willmurphyscode added the changelog-ignore Don't include this issue in the release changelog label Aug 24, 2023
@github-actions
Copy link

Benchmark Test Results

Benchmark results from the latest changes vs base branch
goos: linux%0Agoarch: amd64%0Apkg: github.com/anchore/syft/test/integration%0Acpu: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz%0A                                                              │ ./.tmp/benchmark-477666a.txt │%0A                                                              │            sec/op            │%0AImagePackageCatalogers/alpmdb-cataloger-2                                       15.31m ±  4%25%0AImagePackageCatalogers/apkdb-cataloger-2                                        895.5µ ±  4%25%0AImagePackageCatalogers/binary-cataloger-2                                       255.7µ ±  5%25%0AImagePackageCatalogers/dpkgdb-cataloger-2                                       763.8µ ±  1%25%0AImagePackageCatalogers/dotnet-portable-executable-cataloger-2                   27.37µ ±  3%25%0AImagePackageCatalogers/go-module-binary-cataloger-2                             133.3µ ±  3%25%0AImagePackageCatalogers/java-cataloger-2                                         22.15m ±  4%25%0AImagePackageCatalogers/graalvm-native-image-cataloger-2                         133.1µ ±  8%25%0AImagePackageCatalogers/javascript-package-cataloger-2                           472.0µ ±  3%25%0AImagePackageCatalogers/nix-store-cataloger-2                                    337.8µ ± 13%25%0AImagePackageCatalogers/php-composer-installed-cataloger-2                       852.9µ ±  3%25%0AImagePackageCatalogers/portage-cataloger-2                                      534.6µ ±  4%25%0AImagePackageCatalogers/python-package-cataloger-2                               3.485m ± 17%25%0AImagePackageCatalogers/r-package-cataloger-2                                    287.6µ ±  3%25%0AImagePackageCatalogers/rpm-db-cataloger-2                                       599.3µ ± 22%25%0AImagePackageCatalogers/ruby-gemspec-cataloger-2                                 990.3µ ±  4%25%0AImagePackageCatalogers/sbom-cataloger-2                                         125.1µ ±  6%25%0Ageomean                                                                         597.1µ%0A%0A                                                              │ ./.tmp/benchmark-477666a.txt │%0A                                                              │             B/op             │%0AImagePackageCatalogers/alpmdb-cataloger-2                                       5.133Mi ± 0%25%0AImagePackageCatalogers/apkdb-cataloger-2                                        184.6Ki ± 0%25%0AImagePackageCatalogers/binary-cataloger-2                                       30.75Ki ± 0%25%0AImagePackageCatalogers/dpkgdb-cataloger-2                                       141.2Ki ± 0%25%0AImagePackageCatalogers/dotnet-portable-executable-cataloger-2                   3.695Ki ± 0%25%0AImagePackageCatalogers/go-module-binary-cataloger-2                             9.906Ki ± 0%25%0AImagePackageCatalogers/java-cataloger-2                                         3.070Mi ± 0%25%0AImagePackageCatalogers/graalvm-native-image-cataloger-2                         8.594Ki ± 0%25%0AImagePackageCatalogers/javascript-package-cataloger-2                           83.81Ki ± 0%25%0AImagePackageCatalogers/nix-store-cataloger-2                                    38.93Ki ± 0%25%0AImagePackageCatalogers/php-composer-installed-cataloger-2                       155.2Ki ± 0%25%0AImagePackageCatalogers/portage-cataloger-2                                      109.8Ki ± 0%25%0AImagePackageCatalogers/python-package-cataloger-2                               986.4Ki ± 0%25%0AImagePackageCatalogers/r-package-cataloger-2                                    42.90Ki ± 0%25%0AImagePackageCatalogers/rpm-db-cataloger-2                                       171.0Ki ± 0%25%0AImagePackageCatalogers/ruby-gemspec-cataloger-2                                 123.2Ki ± 0%25%0AImagePackageCatalogers/sbom-cataloger-2                                         14.20Ki ± 0%25%0Ageomean                                                                         93.04Ki%0A%0A                                                              │ ./.tmp/benchmark-477666a.txt │%0A                                                              │          allocs/op           │%0AImagePackageCatalogers/alpmdb-cataloger-2                                        88.06k ± 0%25%0AImagePackageCatalogers/apkdb-cataloger-2                                         4.034k ± 0%25%0AImagePackageCatalogers/binary-cataloger-2                                         866.0 ± 0%25%0AImagePackageCatalogers/dpkgdb-cataloger-2                                        2.911k ± 0%25%0AImagePackageCatalogers/dotnet-portable-executable-cataloger-2                     132.0 ± 0%25%0AImagePackageCatalogers/go-module-binary-cataloger-2                               281.0 ± 0%25%0AImagePackageCatalogers/java-cataloger-2                                          40.69k ± 0%25%0AImagePackageCatalogers/graalvm-native-image-cataloger-2                           228.0 ± 0%25%0AImagePackageCatalogers/javascript-package-cataloger-2                            1.264k ± 0%25%0AImagePackageCatalogers/nix-store-cataloger-2                                      820.0 ± 0%25%0AImagePackageCatalogers/php-composer-installed-cataloger-2                        3.845k ± 0%25%0AImagePackageCatalogers/portage-cataloger-2                                       2.194k ± 0%25%0AImagePackageCatalogers/python-package-cataloger-2                                16.13k ± 0%25%0AImagePackageCatalogers/r-package-cataloger-2                                      851.0 ± 0%25%0AImagePackageCatalogers/rpm-db-cataloger-2                                        3.914k ± 0%25%0AImagePackageCatalogers/ruby-gemspec-cataloger-2                                  2.291k ± 0%25%0AImagePackageCatalogers/sbom-cataloger-2                                           394.0 ± 0%25%0Ageomean                                                                          2.000k

Copy link
Contributor

@kzantow kzantow left a comment

Choose a reason for hiding this comment

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

👍

@willmurphyscode willmurphyscode merged commit 9a2a988 into main Aug 24, 2023
@willmurphyscode willmurphyscode deleted the chore-trace-pom-reflection branch August 24, 2023 15:28
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
This reflect code occasionally throws an obscure panic, but not enough
information is logged before the panic to know why it panicked. Log
enough to tell what property and package are being analyzed when the
panic occurs.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-ignore Don't include this issue in the release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants