elastic / ecs-logging-java

https://www.elastic.co/guide/en/ecs-logging/java/current/intro.html
Apache License 2.0
139 stars 74 forks source link

Adding service version #132

Closed szisiu closed 2 years ago

szisiu commented 3 years ago

Added ECS service.version field support.

Refs: https://github.com/elastic/ecs-logging-java/issues/129

cla-checker-service[bot] commented 3 years ago

❌ Author of the following commits did not sign a Contributor Agreement: 4189e802ef57854683d053f8b0bead9ba6e6f01a

Please, read and sign the above mentioned agreement if you want to contribute to this project

apmmachine commented 3 years ago

:grey_exclamation: Build Aborted

The PR is not allowed to run in the CI yet

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

Expand to view the summary

#### Build stats * Reason: `The PR is not allowed to run in the CI yet` * Start Time: 2021-07-07T10:31:16.597+0000 * Duration: 3 min 0 sec * Commit: 4189e802ef57854683d053f8b0bead9ba6e6f01a #### Trends :test_tube: ![Image of Build Times](https://apm-ci.elastic.co/job/apm-agent-java/job/ecs-logging-java-mbp/job/PR-132/buildTimeGraph/png)

Steps errors 2

Expand to view the steps failures

##### `Load a resource file from a shared library`

  • Took 0 min 0 sec . View more details on here
  • Description: approval-list/elastic/ecs-logging-java.yml
##### `Error signal`
  • Took 0 min 0 sec . View more details on here
  • Description: githubPrCheckApproved: The PR is not allowed to run in the CI yet. (Only users with write permissions can do so.)

Log output

Expand to view the last 100 lines of log output

``` [2021-07-07T10:31:36.799Z] > git merge 0f8c44cf406ea117d30bbbd5f9691b1aaec34e30 # timeout=10 [2021-07-07T10:31:36.834Z] > git rev-parse HEAD^{commit} # timeout=10 [2021-07-07T10:31:36.841Z] Merge succeeded, producing 5009997a022949971e17f103f82cdd748f703897 [2021-07-07T10:31:36.841Z] Checking out Revision 5009997a022949971e17f103f82cdd748f703897 (PR-132) [2021-07-07T10:31:36.841Z] > git config core.sparsecheckout # timeout=10 [2021-07-07T10:31:36.849Z] > git checkout -f 5009997a022949971e17f103f82cdd748f703897 # timeout=15 [2021-07-07T10:31:36.867Z] Commit message: "Merge commit '0f8c44cf406ea117d30bbbd5f9691b1aaec34e30' into HEAD" [2021-07-07T10:31:36.867Z] > git rev-list --no-walk 4189e802ef57854683d053f8b0bead9ba6e6f01a # timeout=10 [2021-07-07T10:31:36.889Z] Cleaning workspace [2021-07-07T10:31:36.889Z] > git rev-parse --verify HEAD # timeout=10 [2021-07-07T10:31:36.899Z] Resetting working tree [2021-07-07T10:31:36.899Z] > git reset --hard # timeout=10 [2021-07-07T10:31:36.916Z] > git clean -fdx # timeout=10 [2021-07-07T10:31:37.529Z] Masking supported pattern matches of $JOB_GCS_BUCKET or $NOTIFY_TO [2021-07-07T10:31:37.589Z] Timeout set to expire in 1 hr 0 min [2021-07-07T10:31:37.603Z] The timestamps step is unnecessary when timestamps are enabled for all Pipeline builds. [2021-07-07T10:31:52.692Z] Still waiting to schedule task [2021-07-07T10:31:52.692Z] All nodes of label ‘linux&&immutable’ are offline [2021-07-07T10:33:46.382Z] Running on apm-ci-immutable-ubuntu-1804-1625653909287231817 in /var/lib/jenkins/workspace/java_ecs-logging-java-mbp_PR-132 [2021-07-07T10:33:52.686Z] [INFO] 'shallow' is forced to be disabled when running on PullRequests [2021-07-07T10:33:52.698Z] Running in /var/lib/jenkins/workspace/java_ecs-logging-java-mbp_PR-132/src/github.com/elastic/ecs-logging-java [2021-07-07T10:33:52.711Z] [INFO] gitCheckout: Checkout SCM PR-132 with default customisation from the Item. [2021-07-07T10:33:52.732Z] [INFO] Override default checkout [2021-07-07T10:33:52.763Z] Sleeping for 10 sec [2021-07-07T10:34:02.785Z] The recommended git tool is: NONE [2021-07-07T10:34:04.890Z] using credential f6c7695a-671e-4f4f-a331-acdce44ff9ba [2021-07-07T10:34:04.901Z] Wiping out workspace first. [2021-07-07T10:34:04.916Z] Cloning the remote Git repository [2021-07-07T10:34:04.916Z] Using shallow clone with depth 3 [2021-07-07T10:34:04.916Z] Avoid fetching tags [2021-07-07T10:34:04.946Z] Cloning repository git@github.com:elastic/ecs-logging-java.git [2021-07-07T10:34:05.023Z] > git init /var/lib/jenkins/workspace/java_ecs-logging-java-mbp_PR-132/src/github.com/elastic/ecs-logging-java # timeout=10 [2021-07-07T10:34:05.051Z] Fetching upstream changes from git@github.com:elastic/ecs-logging-java.git [2021-07-07T10:34:05.051Z] > git --version # timeout=10 [2021-07-07T10:34:05.059Z] > git --version # 'git version 2.17.1' [2021-07-07T10:34:05.059Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key [2021-07-07T10:34:05.079Z] > git fetch --no-tags --progress -- git@github.com:elastic/ecs-logging-java.git +refs/heads/*:refs/remotes/origin/* # timeout=15 [2021-07-07T10:34:05.817Z] Cleaning workspace [2021-07-07T10:34:05.832Z] Using shallow fetch with depth 3 [2021-07-07T10:34:05.833Z] Pruning obsolete local branches [2021-07-07T10:34:05.798Z] > git config remote.origin.url git@github.com:elastic/ecs-logging-java.git # timeout=10 [2021-07-07T10:34:05.803Z] > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 [2021-07-07T10:34:05.811Z] > git config remote.origin.url git@github.com:elastic/ecs-logging-java.git # timeout=10 [2021-07-07T10:34:05.819Z] > git rev-parse --verify HEAD # timeout=10 [2021-07-07T10:34:05.825Z] No valid HEAD. Skipping the resetting [2021-07-07T10:34:05.825Z] > git clean -fdx # timeout=10 [2021-07-07T10:34:05.838Z] Fetching upstream changes from git@github.com:elastic/ecs-logging-java.git [2021-07-07T10:34:05.838Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key [2021-07-07T10:34:05.841Z] > git fetch --no-tags --progress --prune -- git@github.com:elastic/ecs-logging-java.git +refs/pull/132/head:refs/remotes/origin/PR-132 +refs/heads/master:refs/remotes/origin/master # timeout=15 [2021-07-07T10:34:06.458Z] Merging remotes/origin/master commit 0f8c44cf406ea117d30bbbd5f9691b1aaec34e30 into PR head commit 4189e802ef57854683d053f8b0bead9ba6e6f01a [2021-07-07T10:34:06.556Z] Merge succeeded, producing f547183bdbc63817389dccbd7a7040f4c602d6a6 [2021-07-07T10:34:06.557Z] Checking out Revision f547183bdbc63817389dccbd7a7040f4c602d6a6 (PR-132) [2021-07-07T10:34:06.465Z] > git config core.sparsecheckout # timeout=10 [2021-07-07T10:34:06.470Z] > git checkout -f 4189e802ef57854683d053f8b0bead9ba6e6f01a # timeout=15 [2021-07-07T10:34:06.499Z] > git remote # timeout=10 [2021-07-07T10:34:06.507Z] > git config --get remote.origin.url # timeout=10 [2021-07-07T10:34:06.517Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key [2021-07-07T10:34:06.521Z] > git merge 0f8c44cf406ea117d30bbbd5f9691b1aaec34e30 # timeout=10 [2021-07-07T10:34:06.546Z] > git rev-parse HEAD^{commit} # timeout=10 [2021-07-07T10:34:06.559Z] > git config core.sparsecheckout # timeout=10 [2021-07-07T10:34:06.562Z] > git checkout -f f547183bdbc63817389dccbd7a7040f4c602d6a6 # timeout=15 [2021-07-07T10:34:10.054Z] Commit message: "Merge commit '0f8c44cf406ea117d30bbbd5f9691b1aaec34e30' into HEAD" [2021-07-07T10:34:10.058Z] > git rev-list --no-walk 4189e802ef57854683d053f8b0bead9ba6e6f01a # timeout=10 [2021-07-07T10:34:10.086Z] Cleaning workspace [2021-07-07T10:34:10.928Z] Masking supported pattern matches of $GIT_USERNAME or $GIT_PASSWORD [2021-07-07T10:34:10.089Z] > git rev-parse --verify HEAD # timeout=10 [2021-07-07T10:34:10.095Z] Resetting working tree [2021-07-07T10:34:10.095Z] > git reset --hard # timeout=10 [2021-07-07T10:34:10.114Z] > git clean -fdx # timeout=10 [2021-07-07T10:34:11.349Z] + git fetch https://****:****@github.com/elastic/ecs-logging-java.git +refs/pull/*/head:refs/remotes/origin/pr/* [2021-07-07T10:34:11.654Z] Running in /var/lib/jenkins/workspace/java_ecs-logging-java-mbp_PR-132/src/github.com/elastic/ecs-logging-java/.git [2021-07-07T10:34:11.706Z] Archiving artifacts [2021-07-07T10:34:12.283Z] + git rev-parse HEAD [2021-07-07T10:34:12.606Z] + git rev-parse HEAD [2021-07-07T10:34:12.910Z] + git rev-parse origin/pr/132 [2021-07-07T10:34:12.945Z] [INFO] githubEnv: Found Git Build Cause: pr [2021-07-07T10:34:13.158Z] Masking supported pattern matches of $GITHUB_TOKEN [2021-07-07T10:34:14.238Z] [WARN] githubApiCall: The REST API call https://api.github.com/repos/elastic/ecs-logging-java/pulls/132/reviews return 0 elements [2021-07-07T10:34:14.265Z] [INFO] githubPrCheckApproved: Title: Adding service version - User: szisiu - Author Association: FIRST_TIME_CONTRIBUTOR [2021-07-07T10:34:14.512Z] ERROR: githubPrCheckApproved: The PR is not allowed to run in the CI yet [2021-07-07T10:34:14.512Z] ERROR: githubPrCheckApproved: The PR is not allowed to run in the CI yet. (Only users with write permissions can do so.) [2021-07-07T10:34:14.570Z] [INFO] Let's stop build #2. The PR is not allowed to run in the CI yet [2021-07-07T10:34:14.581Z] Sleeping for 5 sec [2021-07-07T10:34:15.620Z] Stage "Build" skipped due to earlier failure(s) [2021-07-07T10:34:15.684Z] Stage "Tests" skipped due to earlier failure(s) [2021-07-07T10:34:15.720Z] Stage "Unit Tests" skipped due to earlier failure(s) [2021-07-07T10:34:15.722Z] Stage "Javadoc" skipped due to earlier failure(s) [2021-07-07T10:34:15.722Z] Stage "Sanity checks" skipped due to earlier failure(s) [2021-07-07T10:34:15.744Z] Failed in branch Unit Tests [2021-07-07T10:34:15.745Z] Failed in branch Javadoc [2021-07-07T10:34:15.746Z] Failed in branch Sanity checks [2021-07-07T10:34:16.021Z] Running on worker-1095690 in /var/lib/jenkins/workspace/java_ecs-logging-java-mbp_PR-132 [2021-07-07T10:34:16.122Z] [INFO] getVaultSecret: Getting secrets [2021-07-07T10:34:16.164Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID [2021-07-07T10:34:18.715Z] + chmod 755 generate-build-data.sh [2021-07-07T10:34:18.715Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/ecs-logging-java-mbp/PR-132/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/ecs-logging-java-mbp/PR-132/runs/2 ABORTED 180384 [2021-07-07T10:34:18.715Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/ecs-logging-java-mbp/PR-132/runs/2/steps/?limit=10000 -o steps-info.json [2021-07-07T10:34:19.416Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/ecs-logging-java-mbp/PR-132/runs/2/tests/?status=FAILED -o tests-errors.json [2021-07-07T10:34:20.115Z] Retry 1/3 exited 22, retrying in 1 seconds... [2021-07-07T10:34:21.566Z] Retry 2/3 exited 22, retrying in 2 seconds... ```

eyalkoren commented 3 years ago

@szisiu Thanks for your input and proposed PR!

We try to be very selective on what we choose as a primary ecs-logging configuration, and so far we did not identify service.version as such. The rationale is that any field for which we don't expose a dedicated config can be set through the additionalField config (or KeyValuePair in log4j2).

Did you try that? Any reason this won't be good enough for this purpose?

szisiu commented 2 years ago

@szisiu Thanks for your input and proposed PR!

We try to be very selective on what we choose as a primary ecs-logging configuration, and so far we did not identify service.version as such. The rationale is that any field for which we don't expose a dedicated config can be set through the additionalField config (or KeyValuePair in log4j2).

Did you try that? Any reason this won't be good enough for this purpose?

Hi, @eyalkoren. I thought that it could be a good and convenient addition. I tried and still using now the additionalFields. It works too.

The final decision is yours, guys.

tobiasstadler commented 2 years ago

@eyalkoren Now that the Java agent integrated elastic/apm-agent-java#1726, elastic/apm-agent-java#1922 and elastic/apm-agent-java#2434 I think it makes sense to expose service.version as dedicated field. The agent can then automatically set the (auto discovered or explicitly set) service.version when using ECS reformatting or instrumenting the library (see elastic/apm-agent-java#1626).

eyalkoren commented 2 years ago

@tobiasstadler I agree! Do you have the capacity to bring this to be ready for review? If not, we can prioritize this when we get the chance.

tobiasstadler commented 2 years ago

I will have a look.

felixbarny commented 2 years ago

@szisiu Could please sign the CLA? See https://github.com/elastic/ecs-logging-java/pull/132#issuecomment-860194104. Unfortunately, we can't move forward with this PR, otherwise.

szisiu commented 2 years ago

@szisiu Could please sign the CLA? See #132 (comment). Unfortunately, we can't move forward with this PR, otherwise.

Hi @felixbarny, it will be hard at this moment.

What about pushing the code provided by @tobiasstadler in https://github.com/elastic/ecs-logging-java/pull/168?

felixbarny commented 2 years ago

Closing in favor of https://github.com/elastic/ecs-logging-java/pull/168