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

[APM] Remove mentions of apm_user #132790

Merged
merged 3 commits into from May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/apm/apm-app-users.asciidoc
Expand Up @@ -125,9 +125,9 @@ Here are two examples:
<titleabbrev>Create an annotation user</titleabbrev>
++++

NOTE: By default, the `apm_user` built-in role provides access to Observability annotations.
You only need to create an annotation user if the default annotation index
defined in <<apm-settings-kb,`xpack.observability.annotations.index`>> has been customized.
NOTE: By default, the `viewer` and `editor` built-in roles provide read access to Observability annotations.
You only need to create an annotation user to write to the annotations index
(<<apm-settings-kb,`xpack.observability.annotations.index`>>).
Copy link
Member Author

Choose a reason for hiding this comment

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

@bmorelli25 fyi: We are removing all references to apm_user role since it is deprecated and we want users to use editor and viewer roles.


[[apm-app-annotation-user]]
==== Annotation user
Expand Down
17 changes: 11 additions & 6 deletions x-pack/plugins/apm/dev_docs/local_setup.md
Expand Up @@ -16,22 +16,25 @@ To access an Elasticsearch instance that has live data you have three options:
**Start Elasticsearch & Kibana**

Elasticsearch:

```
yarn es snapshot
```

Kibana:

```
yarn start
```


**Run Synthtrace**

```
node packages/elastic-apm-synthtrace/src/scripts/run packages/elastic-apm-synthtrace/src/scripts/examples/01_simple_trace.ts \
--local
```

The `--local` flag is a shortcut to specifying `--target` and `--kibana`. It autodiscovers the current kibana basepath and installs the appropiate APM package.
The `--local` flag is a shortcut to specifying `--target` and `--kibana`. It autodiscovers the current kibana basepath and installs the appropiate APM package.

**Connect Kibana to ES**
Update `config/kibana.dev.yml` with:
Expand Down Expand Up @@ -61,7 +64,9 @@ node packages/elastic-apm-synthtrace/src/scripts/run packages/elastic-apm-syntht
## 3. Local ES Cluster

### Start Elasticsearch and APM data generators

_Docker Compose is required_

```
git clone git@github.com:elastic/apm-integration-testing.git
cd apm-integration-testing/
Expand All @@ -80,16 +85,16 @@ elasticsearch.password: changeme

# Setup default APM users

APM behaves differently depending on which the role and permissions a logged in user has. To create the users run:
APM behaves differently depending on which role and permissions a logged in user has. To create APM users run:

```sh
node x-pack/plugins/apm/scripts/create_apm_users_and_roles.js --username admin --password changeme --kibana-url http://localhost:5601 --role-suffix <github-username-or-something-unique>
node x-pack/plugins/apm/scripts/create_apm_users.js --username admin --password changeme --kibana-url http://localhost:5601
```

This will create:

- **apm_read_user**: Read only user
- **apm_power_user**: Read+write user.
- **viewer_user**: User with `viewer` role (read-only)
- **editor_user**: User with `editor` role (read/write)

# Debugging Elasticsearch queries

Expand Down
44 changes: 22 additions & 22 deletions x-pack/plugins/apm/dev_docs/testing.md
Expand Up @@ -18,47 +18,47 @@ open target/coverage/jest/index.html

## API Tests

API tests are separated in two suites:
| Option | Description |
| --------- | ----------------------------------------------- |
| --basic | Run tests with basic license |
| --trial | Run tests with trial license |
| --server | Only start ES and Kibana |
| --runner | Only run tests |
| --grep | Specify the spec files to run |
| --inspect | Add --inspect-brk flag to the ftr for debugging |
| --times | Repeat the test n number of times |

- a basic license test suite [default]
- a trial license test suite (the equivalent of gold+)
The API tests are located in [`x-pack/test/apm_api_integration/`](/x-pack/test/apm_api_integration/).

### Run tests with [--trial] license
### Start server and run test in a single process

```
node scripts/test/api [--trial] [--help]
node scripts/test/api [--trial/--basic] [--help]
```

The above command will initiate an Elasticsearch instance on http://localhost:9220 and a kibana instance on http://localhost:5620 and will run the api test against these environments.
The above command will start an ES instance on http://localhost:9220, a Kibana instance on http://localhost:5620 and run the api tests.
Once the tests finish, the instances will be terminated.

### Start test server

```
node scripts/test/api --server
```
### Start server and run test in separate processes

Start Elasticsearch and Kibana instances.
```sh

### Run all tests
# start server
node scripts/test/api --server --basic

# run tests
node scripts/test/api --runner --basic
```
node scripts/test/api --runner
```

Run all tests. The test server needs to be running, see [Start Test Server](#start-test-server).

### Update snapshots (from Kibana root)

To update snapshots append `--updateSnapshots` to the `functional_test_runner` command
To update snapshots append `--updateSnapshots` to the `--runner` command:

```
node scripts/functional_test_runner --config x-pack/test/apm_api_integration/[basic | trial]/config.ts --quiet --updateSnapshots
node scripts/test/api --runner --basic --updateSnapshots
```

The test server needs to be running, see [Start Test Server](#start-test-server).

The API tests are located in [`x-pack/test/apm_api_integration/`](/x-pack/test/apm_api_integration/).
(The test server needs to be running)

**API Test tips**

Expand Down
Expand Up @@ -30,7 +30,7 @@ describe('Comparison feature flag', () => {
});

beforeEach(() => {
cy.loginAsPowerUser();
cy.loginAsEditorUser();
});

describe('when comparison feature is enabled', () => {
Expand Down
Expand Up @@ -32,7 +32,7 @@ describe('Infrastracture feature flag', () => {
});

beforeEach(() => {
cy.loginAsPowerUser();
cy.loginAsEditorUser();
});

describe('when infrastracture feature is disabled', () => {
Expand Down
Expand Up @@ -56,7 +56,7 @@ describe('when navigating to integration page', () => {
beforeEach(() => {
const integrationsPath = '/app/integrations/browse';

cy.loginAsPowerUser();
cy.loginAsEditorUser();
cy.visit(integrationsPath);

// open integration policy form
Expand Down
Expand Up @@ -10,7 +10,7 @@ const apmIndicesSaveURL = '/internal/apm/settings/apm-indices/save';
describe('No data screen', () => {
describe('bypass no data screen on settings pages', () => {
beforeEach(() => {
cy.loginAsPowerUser();
cy.loginAsEditorUser();
});

before(() => {
Expand All @@ -29,7 +29,7 @@ describe('No data screen', () => {
headers: {
'kbn-xsrf': true,
},
auth: { user: 'apm_power_user', pass: 'changeme' },
auth: { user: 'editor_user', pass: 'changeme' },
});
});

Expand Down Expand Up @@ -57,7 +57,7 @@ describe('No data screen', () => {
metric: '',
},
headers: { 'kbn-xsrf': true },
auth: { user: 'apm_power_user', pass: 'changeme' },
auth: { user: 'editor_user', pass: 'changeme' },
});
});
});
Expand Down
Expand Up @@ -37,7 +37,7 @@ describe('Rules', () => {
describe('when created from APM', () => {
describe('when created from Service Inventory', () => {
before(() => {
cy.loginAsPowerUser();
cy.loginAsEditorUser();
deleteAllRules();
});

Expand Down Expand Up @@ -68,7 +68,7 @@ describe('Rules', () => {

describe('when created from Stack management', () => {
before(() => {
cy.loginAsPowerUser();
cy.loginAsEditorUser();
deleteAllRules();
});

Expand Down
Expand Up @@ -72,7 +72,7 @@ describe('Agent configuration', () => {
});

beforeEach(() => {
cy.loginAsPowerUser();
cy.loginAsEditorUser();
cy.visit(agentConfigHref);
});

Expand Down
Expand Up @@ -9,7 +9,7 @@ const basePath = '/app/apm/settings/custom-links';

describe('Custom links', () => {
beforeEach(() => {
cy.loginAsPowerUser();
cy.loginAsEditorUser();
});

it('shows empty message and create button', () => {
Expand Down
Expand Up @@ -7,7 +7,7 @@

describe('APM deep links', () => {
before(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});
it('navigates to apm links on search elastic', () => {
cy.visit('/');
Expand Down
Expand Up @@ -31,7 +31,7 @@ describe('Dependencies', () => {
});

beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});

describe('top-level dependencies page', () => {
Expand Down
Expand Up @@ -23,7 +23,7 @@ const errorDetailsPageHref = url.format({

describe('Error details', () => {
beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});

describe('when data is loaded', () => {
Expand Down
Expand Up @@ -25,7 +25,7 @@ const nodeServiceErrorsPageHref = url.format({

describe('Errors page', () => {
beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});

describe('when data is loaded', () => {
Expand Down
Expand Up @@ -38,7 +38,7 @@ describe.skip('Home page', () => {
});

beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});

it('Redirects to service page with comparisonEnabled, environment, rangeFrom, rangeTo and offset added to the URL', () => {
Expand Down
Expand Up @@ -35,7 +35,7 @@ describe('Service inventory - header filters', () => {
});

beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});

describe('Filtering by kuerybar', () => {
Expand Down
Expand Up @@ -44,7 +44,7 @@ const mainAliasNames = mainApiRequestsToIntercept.map(

describe('When navigating to the service inventory', () => {
before(async () => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
cy.visit(serviceInventoryHref);

const { rangeFrom, rangeTo } = timeRange;
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('When navigating to the service inventory', () => {
}
);

cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
cy.visit(serviceInventoryHref);
});

Expand Down
Expand Up @@ -37,7 +37,7 @@ describe('Service overview - aws lambda', () => {
});

beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});

it('displays a cold start rate chart and not a transaction breakdown chart', () => {
Expand Down
Expand Up @@ -32,7 +32,7 @@ describe('Errors table', () => {
});

beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});

it('errors table is populated', () => {
Expand Down
Expand Up @@ -71,7 +71,7 @@ describe('Service overview - header filters', () => {

describe('Filtering by transaction type', () => {
beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});
it('changes url when selecting different value', () => {
cy.visit(serviceOverviewHref);
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('Service overview - header filters', () => {

describe('Filtering by kuerybar', () => {
beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});
it('filters by transaction.name', () => {
cy.visit(
Expand Down
Expand Up @@ -38,7 +38,7 @@ const apisToIntercept = [

describe('Instances table', () => {
beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});

// describe('when data is not loaded', () => {
Expand Down
Expand Up @@ -101,7 +101,7 @@ describe('Service Overview', () => {

describe('renders', () => {
before(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
cy.visit(baseUrl);
});

Expand All @@ -121,7 +121,7 @@ describe('Service Overview', () => {

describe('transactions', () => {
beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
cy.visit(baseUrl);
});

Expand Down Expand Up @@ -174,7 +174,7 @@ describe('Service Overview', () => {

describe('when RUM service', () => {
before(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
cy.visit(
url.format({
pathname: '/app/apm/services/opbeans-rum/overview',
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('Service Overview', () => {

describe('Calls APIs', () => {
beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
cy.visit(baseUrl);
apiRequestsToIntercept.map(({ endpoint, aliasName }) => {
cy.intercept('GET', endpoint).as(aliasName);
Expand Down
Expand Up @@ -65,7 +65,7 @@ describe.skip('Service overview: Time Comparison', () => {
});

beforeEach(() => {
cy.loginAsReadOnlyUser();
cy.loginAsViewerUser();
});

it('enables by default the time comparison feature with Last 24 hours selected', () => {
Expand Down