[APM] Add agent central configuration for PHP agent (#97462)

* [APM] Add agent central configuration for PHP agent

* Fix failing test

* Fix "Check Types" test

* Undo changes to x-pack\plugins\apm\typings\es_schemas\ui\fields\agent.ts

* Undo changes to "x-pack\plugins\apm\common\agent_name.ts"

* Fix failing test

* updates telemetry mappings

* updates jest snapshot

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Oliver Gupte <olivergupte@gmail.com>
This commit is contained in:
Sergey Kleyman 2021-04-20 23:49:56 +03:00 committed by GitHub
parent a989c1fd20
commit e5754d772f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 164 additions and 9 deletions

View file

@ -46,7 +46,7 @@ Go Agent:: {apm-go-ref}/configuration.html[Configuration reference]
Java Agent:: {apm-java-ref}/configuration.html[Configuration reference]
.NET Agent:: {apm-dotnet-ref}/configuration.html[Configuration reference]
Node.js Agent:: {apm-node-ref}/configuration.html[Configuration reference]
PHP Agent:: _Not yet supported_
PHP Agent:: {apm-php-ref}/configuration.html[Configuration reference]
Python Agent:: {apm-py-ref}/configuration.html[Configuration reference]
Ruby Agent:: {apm-ruby-ref}/configuration.html[Configuration reference]
Real User Monitoring (RUM) Agent:: {apm-rum-ref}/configuration.html[Configuration reference]

View file

@ -28,6 +28,9 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
"nodejs": {
"type": "long"
},
"php": {
"type": "long"
},
"python": {
"type": "long"
},
@ -344,6 +347,60 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
}
}
},
"php": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "keyword"
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"name": {
"type": "keyword"
},
"version": {
"type": "keyword"
},
"composite": {
"type": "keyword"
}
}
},
"language": {
"properties": {
"name": {
"type": "keyword"
},
"version": {
"type": "keyword"
},
"composite": {
"type": "keyword"
}
}
},
"runtime": {
"properties": {
"name": {
"type": "keyword"
},
"version": {
"type": "keyword"
},
"composite": {
"type": "keyword"
}
}
}
}
}
}
},
"python": {
"properties": {
"agent": {

View file

@ -26,7 +26,7 @@ export const generalSettings: RawSettingDefinition[] = [
'The maximum total compressed size of the request body which is sent to the APM Server intake api via a chunked encoding (HTTP streaming).\nNote that a small overshoot is possible.\n\nAllowed byte units are `b`, `kb` and `mb`. `1kb` is equal to `1024b`.',
}
),
excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs'],
excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs', 'php'],
},
// API Request Time
@ -44,7 +44,7 @@ export const generalSettings: RawSettingDefinition[] = [
"Maximum time to keep an HTTP request to the APM Server open for.\n\nNOTE: This value has to be lower than the APM Server's `read_timeout` setting.",
}
),
excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs'],
excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs', 'php'],
},
// Capture body
@ -69,7 +69,7 @@ export const generalSettings: RawSettingDefinition[] = [
{ text: 'transactions', value: 'transactions' },
{ text: 'all', value: 'all' },
],
excludeAgents: ['js-base', 'rum-js'],
excludeAgents: ['js-base', 'rum-js', 'php'],
},
// Capture headers
@ -87,7 +87,7 @@ export const generalSettings: RawSettingDefinition[] = [
'If set to `true`, the agent will capture HTTP request and response headers (including cookies), as well as message headers/properties when using messaging frameworks (like Kafka).\n\nNOTE: Setting this to `false` reduces network bandwidth, disk space and object allocations.',
}
),
excludeAgents: ['js-base', 'rum-js', 'nodejs'],
excludeAgents: ['js-base', 'rum-js', 'nodejs', 'php'],
},
// LOG_LEVEL
@ -111,7 +111,7 @@ export const generalSettings: RawSettingDefinition[] = [
{ text: 'critical', value: 'critical' },
{ text: 'off', value: 'off' },
],
includeAgents: ['dotnet', 'ruby', 'java', 'python', 'nodejs', 'go'],
includeAgents: ['dotnet', 'ruby', 'java', 'python', 'nodejs', 'go', 'php'],
},
// Recording
@ -163,7 +163,7 @@ export const generalSettings: RawSettingDefinition[] = [
'In its default settings, the APM agent will collect a stack trace with every recorded span.\nWhile this is very helpful to find the exact place in your code that causes the span, collecting this stack trace does have some overhead. \nWhen setting this option to a negative value, like `-1ms`, stack traces will be collected for all spans. Setting it to a positive value, e.g. `5ms`, will limit stack trace collection to spans with durations equal to or longer than the given value, e.g. 5 milliseconds.\n\nTo disable stack trace collection for spans completely, set the value to `0ms`.',
}
),
excludeAgents: ['js-base', 'rum-js', 'nodejs'],
excludeAgents: ['js-base', 'rum-js', 'nodejs', 'php'],
},
// STACK_TRACE_LIMIT

View file

@ -157,9 +157,17 @@ describe('filterByAgent', () => {
]);
});
it('php', () => {
expect(getSettingKeysForAgent('php')).toEqual([
'log_level',
'recording',
'transaction_max_spans',
'transaction_sample_rate',
]);
});
it('"All" services (no agent name)', () => {
expect(getSettingKeysForAgent(undefined)).toEqual([
'capture_body',
'transaction_max_spans',
'transaction_sample_rate',
]);

View file

@ -78,6 +78,7 @@ const apmPerAgentSchema: Pick<
java: long,
'js-base': long,
nodejs: long,
php: long,
python: long,
ruby: long,
'rum-js': long,
@ -99,6 +100,7 @@ const apmPerAgentSchema: Pick<
java: agentSchema,
'js-base': agentSchema,
nodejs: agentSchema,
php: agentSchema,
python: agentSchema,
ruby: agentSchema,
'rum-js': agentSchema,

View file

@ -13,7 +13,8 @@ export type ElasticAgentName =
| 'nodejs'
| 'python'
| 'dotnet'
| 'ruby';
| 'ruby'
| 'php';
export type OpenTelemetryAgentName =
| 'otlp'

View file

@ -325,6 +325,9 @@
"nodejs": {
"type": "long"
},
"php": {
"type": "long"
},
"python": {
"type": "long"
},
@ -791,6 +794,90 @@
}
}
},
"php": {
"properties": {
"agent": {
"properties": {
"version": {
"type": "array",
"items": {
"type": "keyword"
}
}
}
},
"service": {
"properties": {
"framework": {
"properties": {
"name": {
"type": "array",
"items": {
"type": "keyword"
}
},
"version": {
"type": "array",
"items": {
"type": "keyword"
}
},
"composite": {
"type": "array",
"items": {
"type": "keyword"
}
}
}
},
"language": {
"properties": {
"name": {
"type": "array",
"items": {
"type": "keyword"
}
},
"version": {
"type": "array",
"items": {
"type": "keyword"
}
},
"composite": {
"type": "array",
"items": {
"type": "keyword"
}
}
}
},
"runtime": {
"properties": {
"name": {
"type": "array",
"items": {
"type": "keyword"
}
},
"version": {
"type": "array",
"items": {
"type": "keyword"
}
},
"composite": {
"type": "array",
"items": {
"type": "keyword"
}
}
}
}
}
}
}
},
"python": {
"properties": {
"agent": {