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

[Synthetics] adjust run_from.id #6047

Merged

Conversation

dominiqueclarke
Copy link
Contributor

@dominiqueclarke dominiqueclarke commented May 2, 2023

  • Bug

What does this PR do?

Resolves elastic/kibana#156320

Adjusts the run_from.id to reflect the id of the location, not the name.

@dominiqueclarke dominiqueclarke changed the title synthetics - adjust run_from.id [Synthetics] adjust run_from.id May 2, 2023
@dominiqueclarke dominiqueclarke added Team:obs-ux-infra_services Label for the Obs UX: Infra & Services team [elastic/obs-ux-infra_services-team] v8.8.0 labels May 2, 2023
@dominiqueclarke dominiqueclarke marked this pull request as ready for review May 2, 2023 00:05
@dominiqueclarke dominiqueclarke requested a review from a team as a code owner May 2, 2023 00:05
@elasticmachine
Copy link

Pinging @elastic/uptime (Team:Uptime)

@elasticmachine
Copy link

elasticmachine commented May 2, 2023

💚 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-05-12T18:13:22.156+0000

  • Duration: 13 min 57 sec

Test stats 🧪

Test Results
Failed 0
Passed 6
Skipped 0
Total 6

🤖 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
Copy link

elasticmachine commented May 2, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (0/0) 💚
Files 100.0% (0/0) 💚 6.25
Classes 100.0% (0/0) 💚 6.25
Methods 33.333% (6/18) 👎 -52.798
Lines 100.0% (0/0) 💚 14.075
Conditionals 100.0% (0/0) 💚

Comment on lines +10 to +11
{{#if location_id}}
run_from.id: {{location_id}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{#if location_id}}
run_from.id: {{location_id}}
{{#if location_id}}
run_from.id: {{location_id}}
{{else if location_name}}
run_from.id: {{location_name}}

Copy link
Contributor

Choose a reason for hiding this comment

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

do we need a migration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest with you, I'm not sure if a migration is truly necessary here. Plus, it's also impossible if you remember because we can't actually get the location ids in the migration function because we can't perform async operations.

But anyway, the main reason I don't think we need a migration here is because we haven't truly started using this anywhere. It'll help us to get rid of some tech debt in the future though.

Plus, once we get time for this issue elastic/kibana#153812, we'll not have to worry as much about saved object migrations for package policies because we'll get the opportunity to resave monitors to update to newer versions, and can apply custom "migrations" if necessary, like resaving if there's a missing field or something.

@dominiqueclarke dominiqueclarke force-pushed the fix/synthetics-run-from-id branch from 3b07275 to d850be1 Compare May 12, 2023 18:13
@dominiqueclarke dominiqueclarke merged commit 032b1b6 into elastic:main May 12, 2023
@dominiqueclarke dominiqueclarke deleted the fix/synthetics-run-from-id branch May 12, 2023 18:28
dominiqueclarke added a commit to elastic/kibana that referenced this pull request May 12, 2023
## Summary

Resolves #156320

Adjust the value of the `run_from.id` field.

Before
Both the `run_from.id` and the `run_from.name` were the same value.

After
<img width="543" alt="Screen Shot 2023-05-01 at 7 55 24 PM"
src="https://user-images.githubusercontent.com/11356435/235551964-bb9c419d-2ada-4a39-bd08-ce6f5021747b.png">

### Testing
1. Check out this PR from integrations
elastic/integrations#6047
2. In the integrations repo `cd packages/synthetics`
3. Run `elastic-package clean` then `elastic-package build` (You may
need to upgrade elastic package if you're significantly behind)
4. In your `kibana.dev.yml` file add `xpack.fleet.registryUrl:
https://localhost:8080`
5. Start kibana with
`NODE_EXTRA_CA_CERTS=$HOME/.elastic-package/profiles/default/certs/kibana/ca-cert.pem
yarn start --no-base-path`
6. Create a private location
7. Create a monitor assigned to that private location
8. Inspect the agent policy for that private location, then find the
integration policy for that monitor. Ensure the `run_from.id` is the id
of the location, and the `run_from.name` is the name of the location.

(If you run into problems setting up your local kibana connected to
elastic-package registry, see
https://github.com/elastic/security-team/blob/main/docs/cloud-security-posture-team/kibana/local-setup-using-elastic-package.mdx)

---------

Co-authored-by: shahzad31 <shahzad31comp@gmail.com>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 12, 2023
## Summary

Resolves elastic#156320

Adjust the value of the `run_from.id` field.

Before
Both the `run_from.id` and the `run_from.name` were the same value.

After
<img width="543" alt="Screen Shot 2023-05-01 at 7 55 24 PM"
src="https://user-images.githubusercontent.com/11356435/235551964-bb9c419d-2ada-4a39-bd08-ce6f5021747b.png">

### Testing
1. Check out this PR from integrations
elastic/integrations#6047
2. In the integrations repo `cd packages/synthetics`
3. Run `elastic-package clean` then `elastic-package build` (You may
need to upgrade elastic package if you're significantly behind)
4. In your `kibana.dev.yml` file add `xpack.fleet.registryUrl:
https://localhost:8080`
5. Start kibana with
`NODE_EXTRA_CA_CERTS=$HOME/.elastic-package/profiles/default/certs/kibana/ca-cert.pem
yarn start --no-base-path`
6. Create a private location
7. Create a monitor assigned to that private location
8. Inspect the agent policy for that private location, then find the
integration policy for that monitor. Ensure the `run_from.id` is the id
of the location, and the `run_from.name` is the name of the location.

(If you run into problems setting up your local kibana connected to
elastic-package registry, see
https://github.com/elastic/security-team/blob/main/docs/cloud-security-posture-team/kibana/local-setup-using-elastic-package.mdx)

---------

Co-authored-by: shahzad31 <shahzad31comp@gmail.com>
(cherry picked from commit f59471b)
@elasticmachine
Copy link

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

kibanamachine added a commit to elastic/kibana that referenced this pull request May 15, 2023
…#157531)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Synthetics] adjust run_from.id for private locations
(#156324)](#156324)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dominique
Clarke","email":"dominique.clarke@elastic.co"},"sourceCommit":{"committedDate":"2023-05-12T18:30:53Z","message":"[Synthetics]
adjust run_from.id for private locations (#156324)\n\n##
Summary\r\n\r\nResolves
https://github.com/elastic/kibana/issues/156320\r\n\r\nAdjust the value
of the `run_from.id` field.\r\n\r\nBefore\r\nBoth the `run_from.id` and
the `run_from.name` were the same value.\r\n\r\nAfter\r\n<img
width=\"543\" alt=\"Screen Shot 2023-05-01 at 7 55 24
PM\"\r\nsrc=\"https://user-images.githubusercontent.com/11356435/235551964-bb9c419d-2ada-4a39-bd08-ce6f5021747b.png\">\r\n\r\n###
Testing\r\n1. Check out this PR from
integrations\r\nhttps://github.com/elastic/integrations/pull/6047\r\n2.
In the integrations repo `cd packages/synthetics`\r\n3. Run
`elastic-package clean` then `elastic-package build` (You may\r\nneed to
upgrade elastic package if you're significantly behind)\r\n4. In your
`kibana.dev.yml` file add
`xpack.fleet.registryUrl:\r\nhttps://localhost:8080`\r\n5. Start kibana
with\r\n`NODE_EXTRA_CA_CERTS=$HOME/.elastic-package/profiles/default/certs/kibana/ca-cert.pem\r\nyarn
start --no-base-path`\r\n6. Create a private location\r\n7. Create a
monitor assigned to that private location\r\n8. Inspect the agent policy
for that private location, then find the\r\nintegration policy for that
monitor. Ensure the `run_from.id` is the id\r\nof the location, and the
`run_from.name` is the name of the location.\r\n\r\n(If you run into
problems setting up your local kibana connected to\r\nelastic-package
registry,
see\r\nhttps://github.com/elastic/security-team/blob/main/docs/cloud-security-posture-team/kibana/local-setup-using-elastic-package.mdx)\r\n\r\n---------\r\n\r\nCo-authored-by:
shahzad31
<shahzad31comp@gmail.com>","sha":"f59471bcdc8d8fa156e7997749efe7d252457d77","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:uptime","release_note:skip","Team:Fleet","v8.8.0","v8.9.0"],"number":156324,"url":"https://github.com/elastic/kibana/pull/156324","mergeCommit":{"message":"[Synthetics]
adjust run_from.id for private locations (#156324)\n\n##
Summary\r\n\r\nResolves
https://github.com/elastic/kibana/issues/156320\r\n\r\nAdjust the value
of the `run_from.id` field.\r\n\r\nBefore\r\nBoth the `run_from.id` and
the `run_from.name` were the same value.\r\n\r\nAfter\r\n<img
width=\"543\" alt=\"Screen Shot 2023-05-01 at 7 55 24
PM\"\r\nsrc=\"https://user-images.githubusercontent.com/11356435/235551964-bb9c419d-2ada-4a39-bd08-ce6f5021747b.png\">\r\n\r\n###
Testing\r\n1. Check out this PR from
integrations\r\nhttps://github.com/elastic/integrations/pull/6047\r\n2.
In the integrations repo `cd packages/synthetics`\r\n3. Run
`elastic-package clean` then `elastic-package build` (You may\r\nneed to
upgrade elastic package if you're significantly behind)\r\n4. In your
`kibana.dev.yml` file add
`xpack.fleet.registryUrl:\r\nhttps://localhost:8080`\r\n5. Start kibana
with\r\n`NODE_EXTRA_CA_CERTS=$HOME/.elastic-package/profiles/default/certs/kibana/ca-cert.pem\r\nyarn
start --no-base-path`\r\n6. Create a private location\r\n7. Create a
monitor assigned to that private location\r\n8. Inspect the agent policy
for that private location, then find the\r\nintegration policy for that
monitor. Ensure the `run_from.id` is the id\r\nof the location, and the
`run_from.name` is the name of the location.\r\n\r\n(If you run into
problems setting up your local kibana connected to\r\nelastic-package
registry,
see\r\nhttps://github.com/elastic/security-team/blob/main/docs/cloud-security-posture-team/kibana/local-setup-using-elastic-package.mdx)\r\n\r\n---------\r\n\r\nCo-authored-by:
shahzad31
<shahzad31comp@gmail.com>","sha":"f59471bcdc8d8fa156e7997749efe7d252457d77"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/156324","number":156324,"mergeCommit":{"message":"[Synthetics]
adjust run_from.id for private locations (#156324)\n\n##
Summary\r\n\r\nResolves
https://github.com/elastic/kibana/issues/156320\r\n\r\nAdjust the value
of the `run_from.id` field.\r\n\r\nBefore\r\nBoth the `run_from.id` and
the `run_from.name` were the same value.\r\n\r\nAfter\r\n<img
width=\"543\" alt=\"Screen Shot 2023-05-01 at 7 55 24
PM\"\r\nsrc=\"https://user-images.githubusercontent.com/11356435/235551964-bb9c419d-2ada-4a39-bd08-ce6f5021747b.png\">\r\n\r\n###
Testing\r\n1. Check out this PR from
integrations\r\nhttps://github.com/elastic/integrations/pull/6047\r\n2.
In the integrations repo `cd packages/synthetics`\r\n3. Run
`elastic-package clean` then `elastic-package build` (You may\r\nneed to
upgrade elastic package if you're significantly behind)\r\n4. In your
`kibana.dev.yml` file add
`xpack.fleet.registryUrl:\r\nhttps://localhost:8080`\r\n5. Start kibana
with\r\n`NODE_EXTRA_CA_CERTS=$HOME/.elastic-package/profiles/default/certs/kibana/ca-cert.pem\r\nyarn
start --no-base-path`\r\n6. Create a private location\r\n7. Create a
monitor assigned to that private location\r\n8. Inspect the agent policy
for that private location, then find the\r\nintegration policy for that
monitor. Ensure the `run_from.id` is the id\r\nof the location, and the
`run_from.name` is the name of the location.\r\n\r\n(If you run into
problems setting up your local kibana connected to\r\nelastic-package
registry,
see\r\nhttps://github.com/elastic/security-team/blob/main/docs/cloud-security-posture-team/kibana/local-setup-using-elastic-package.mdx)\r\n\r\n---------\r\n\r\nCo-authored-by:
shahzad31
<shahzad31comp@gmail.com>","sha":"f59471bcdc8d8fa156e7997749efe7d252457d77"}}]}]
BACKPORT-->

Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
Co-authored-by: Shahzad <shahzad31comp@gmail.com>
jasonrhodes pushed a commit to elastic/kibana that referenced this pull request May 17, 2023
## Summary

Resolves #156320

Adjust the value of the `run_from.id` field.

Before
Both the `run_from.id` and the `run_from.name` were the same value.

After
<img width="543" alt="Screen Shot 2023-05-01 at 7 55 24 PM"
src="https://user-images.githubusercontent.com/11356435/235551964-bb9c419d-2ada-4a39-bd08-ce6f5021747b.png">

### Testing
1. Check out this PR from integrations
elastic/integrations#6047
2. In the integrations repo `cd packages/synthetics`
3. Run `elastic-package clean` then `elastic-package build` (You may
need to upgrade elastic package if you're significantly behind)
4. In your `kibana.dev.yml` file add `xpack.fleet.registryUrl:
https://localhost:8080`
5. Start kibana with
`NODE_EXTRA_CA_CERTS=$HOME/.elastic-package/profiles/default/certs/kibana/ca-cert.pem
yarn start --no-base-path`
6. Create a private location
7. Create a monitor assigned to that private location
8. Inspect the agent policy for that private location, then find the
integration policy for that monitor. Ensure the `run_from.id` is the id
of the location, and the `run_from.name` is the name of the location.

(If you run into problems setting up your local kibana connected to
elastic-package registry, see
https://github.com/elastic/security-team/blob/main/docs/cloud-security-posture-team/kibana/local-setup-using-elastic-package.mdx)

---------

Co-authored-by: shahzad31 <shahzad31comp@gmail.com>
@elasticmachine
Copy link

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

@andrewkroh andrewkroh added the Integration:synthetics Elastic Synthetics label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration:synthetics Elastic Synthetics Team:obs-ux-infra_services Label for the Obs UX: Infra & Services team [elastic/obs-ux-infra_services-team] v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Synthetics] Observer.name is wrong when using private locations
4 participants