-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Debugging with apm - fixes and tutorial #127892
Conversation
const configPath = getConfigPath(); | ||
|
||
// Pick up settings from dev.yml as well | ||
return [configPath, configPath.replace('kibana.yml', 'kibana.dev.yml')]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If anyone has a better idea how to get configs from kibana.dev.yml
in a package, I'm open to it!
import { getConfiguration, shouldInstrumentClient } from '@kbn/apm-config-loader'; | ||
|
||
const OMIT_APM_CONFIG: Array<keyof AgentConfigOptions> = ['secretToken']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential simple solution for #118505
* Get the configuration from the apm.dev.js file, supersedes config | ||
* from the --config file, disabled when running the distributable | ||
*/ | ||
private getDevConfig(): AgentConfigOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using kibana.dev.yml
is a more standard and intuitive way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We knew we'd be changing where we read the config from eventually, just didn't have support for config in kibana.dev.yml
at the time the package was added.
@@ -136,6 +136,10 @@ export class ApmConfiguration { | |||
config.serverUrl = process.env.ELASTIC_APM_SERVER_URL; | |||
} | |||
|
|||
if (process.env.ELASTIC_APM_SECRET_TOKEN) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these environemnt values are also picked up automatically by apm-node-agent
.
However, we should be consistent, so I added this one here (ELASTIC_APM_SERVER_URL
was passed in but ELASTIC_APM_SECRET_TOKEN
was fetched by the agent)
@@ -24,7 +24,7 @@ const DEFAULT_CONFIG: AgentConfigOptions = { | |||
globalLabels: {}, | |||
}; | |||
|
|||
const CENTRALIZED_SERVICE_BASE_CONFIG: AgentConfigOptions | RUMAgentConfigOptions = { | |||
export const CENTRALIZED_SERVICE_BASE_CONFIG: AgentConfigOptions | RUMAgentConfigOptions = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported for tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on the APM side.
I don't know what is going on with GitHub, but I can't seem to find the place to LGTM! Doc changes look good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found it. Doc changes LGTM
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,
Thanks for the tutorial and docs update.
* Get the configuration from the apm.dev.js file, supersedes config | ||
* from the --config file, disabled when running the distributable | ||
*/ | ||
private getDevConfig(): AgentConfigOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We knew we'd be changing where we read the config from eventually, just didn't have support for config in kibana.dev.yml
at the time the package was added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine overall, I've suggested a few changes to the docs.
… debugging-with-apm
…ebugging-with-apm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pointed out two new typos but apart from that the changes look good to me. Please feel free to merge without another review round after addressing the changes.
|
||
Frontend (APM RUM): | ||
* `http-request`- tracks all outgoing API requests | ||
* `page-load` - tracks the inidial loading time of kibana |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - typo: inidial -> initial
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @lizozom |
* fixes + tutorial * cors config * omit secretToken so its not sent to FE Add config tests * lint * empty * swallow errors when parsing configs * read config test adjustment * apm docs review * new line * doc review Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit c97bfc8)
💔 Some backports could not be created
Manual backportTo create the backport manually run:
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
* fixes + tutorial * cors config * omit secretToken so its not sent to FE Add config tests * lint * empty * swallow errors when parsing configs * read config test adjustment * apm docs review * new line * doc review Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit c97bfc8) Co-authored-by: Liza Katz <[email protected]>
|
||
1. Create a secondary monitoring deployment to collect APM data. The easiest option is to use [Elastic Cloud](https://cloud.elastic.co/deployments) to create a new deployment. | ||
2. Open Kibana, go to `Integrations` and enable the Elastic APM integration. | ||
3. Scroll down and copy the server URL and secret token. You may also find them in your cloud console under APM & Fleet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you attach some screenshots to help identify them in UI?
|
||
* ELASTIC_APM_ACTIVE | ||
* ELASTIC_APM_SERVER_URL | ||
* ELASTIC_APM_SECRET_TOKEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add an example? ELASTIC_APM_ACTIVE=true; yarn start;...
?
const readYaml = (path: string) => { | ||
try { | ||
return safeLoad(readFileSync(path, 'utf8')); | ||
} catch (e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess safeLoad
function shouldn't throw an exception :D
* fixes + tutorial * cors config * omit secretToken so its not sent to FE Add config tests * lint * empty * swallow errors when parsing configs * read config test adjustment * apm docs review * new line * doc review Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit c97bfc8) # Conflicts: # packages/kbn-apm-config-loader/src/config.test.ts # packages/kbn-apm-config-loader/src/config.ts # src/core/server/http_resources/get_apm_config.ts
* Debugging with apm - fixes and tutorial (#127892) * fixes + tutorial * cors config * omit secretToken so its not sent to FE Add config tests * lint * empty * swallow errors when parsing configs * read config test adjustment * apm docs review * new line * doc review Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit c97bfc8) # Conflicts: # packages/kbn-apm-config-loader/src/config.test.ts # packages/kbn-apm-config-loader/src/config.ts # src/core/server/http_resources/get_apm_config.ts * fix merge
This automatically sets up APM in any Elasticsearch instance that Kibana starts through @elastic/kbn-es. This includes integration and e2e tests. It respects the same configuration as kibana and can be locally overridden in kibana.dev.yml as per elastic#127892. It will bootstrap `secret_token` and `api_key` in the local Elasticsearch secret store but as this appears to be broken for now these are passed directly to Elasticsearch as well.
Summary
Improve the APM-Kibana setup and documentation.
kibana.dev.yml
instead ofapm.dev.js
on local environmentssecretToken
from the configurations sent to the client (APM RUM doesn't need it)process.env.ELASTIC_APM_SERVER_URL
inpackages/kbn-apm-config-loader/src/config.ts
for consistencyChecklist
Delete any items that are not applicable to this PR.
Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers