Add working default metrics dashboard for Python OTel (#213599)

## Summary

Create a custom metrics dashboard for OpenTelemetry Python since the
current one displays two empty charts by default. I've tested this with
some data ingested from the otel native path.

This is how it is rendered:
 
![Schermata del 2025-03-10
14-26-21](https://github.com/user-attachments/assets/766eef8a-def8-45f8-8df1-d601b235fd47)

While working on this I noticed something strange, sometimes the first
element of the triplet that is the data format is `otel_native` and
sometime it is `classic_apm` and in practice an entry with `otel_native`
is required to be present in `
existingDashboardFileNames` but the entry with `classic_apm` is used in
`loadDashboardFile`.

Added some console.log to the function:

![Schermata del 2025-03-10
14-26-57](https://github.com/user-attachments/assets/1236495e-9f56-4a90-b095-f92171cd351c)

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

I don't think this introduces any risk since there are no functioning dashboard at the moment.
This commit is contained in:
Riccardo Magliocchetti 2025-03-12 15:03:17 +01:00 committed by GitHub
parent bbc91a2691
commit 70b49b2084
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -15,6 +15,8 @@ export const existingDashboardFileNames = new Set([
'classic_apm-edot-nodejs',
'classic_apm-edot-java',
'classic_apm-edot-dotnet',
'classic_apm-edot-python',
'otel_native-edot-python',
]);
// The new dashboard files should be mapped here
@ -71,6 +73,18 @@ export async function loadDashboardFile(filename: string) {
'./opentelemetry_dotnet.json'
);
}
case 'classic_apm-edot-python': {
return import(
/* webpackChunkName: "lazyPythonOtelDashboard" */
'./opentelemetry_python.json'
);
}
case 'otel_native-edot-python': {
return import(
/* webpackChunkName: "lazyPythonOtelDashboard" */
'./opentelemetry_python.json'
);
}
default: {
break;
}

View file

@ -0,0 +1 @@
{"attributes":{"controlGroupInput":{"chainingSystem":"HIERARCHICAL","controlStyle":"oneLine","ignoreParentSettingsJSON":"{\"ignoreFilters\":false,\"ignoreQuery\":false,\"ignoreTimerange\":false,\"ignoreValidations\":false}","panelsJSON":"{}","showApplySelections":false},"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"kuery\"}}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"syncCursor\":true,\"syncTooltips\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"type\":\"lens\",\"title\":\"Memory usage\",\"embeddableConfig\":{\"enhancements\":{\"dynamicActions\":{\"events\":[]}},\"syncColors\":false,\"syncCursor\":true,\"syncTooltips\":false,\"filters\":[],\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"attributes\":{\"title\":\"\",\"description\":null,\"visualizationType\":\"lnsXY\",\"type\":\"lens\",\"references\":[{\"type\":\"index-pattern\",\"id\":\"apm_static_data_view_id_default\",\"name\":\"indexpattern-datasource-layer-fa5fc3d4-10d4-42ae-b66a-acacbede736a\"}],\"state\":{\"visualization\":{\"legend\":{\"isVisible\":true,\"position\":\"bottom\",\"isInside\":false,\"showSingleSeries\":false},\"valueLabels\":\"hide\",\"fittingFunction\":\"Linear\",\"axisTitlesVisibilitySettings\":{\"x\":true,\"yLeft\":true,\"yRight\":true},\"tickLabelsVisibilitySettings\":{\"x\":true,\"yLeft\":true,\"yRight\":true},\"labelsOrientation\":{\"x\":0,\"yLeft\":0,\"yRight\":0},\"gridlinesVisibilitySettings\":{\"x\":true,\"yLeft\":true,\"yRight\":true},\"preferredSeriesType\":\"line\",\"layers\":[{\"layerId\":\"fa5fc3d4-10d4-42ae-b66a-acacbede736a\",\"accessors\":[\"575956d5-ca18-46f9-8654-a24ec4b7ca40\"],\"position\":\"top\",\"seriesType\":\"line\",\"showGridlines\":false,\"layerType\":\"data\",\"colorMapping\":{\"assignments\":[],\"specialAssignments\":[{\"rule\":{\"type\":\"other\"},\"color\":{\"type\":\"loop\"},\"touched\":false}],\"paletteId\":\"default\",\"colorMode\":{\"type\":\"categorical\"}},\"xAccessor\":\"a2e00bae-d7b4-4902-a57c-b4137b343052\",\"splitAccessor\":\"185b1386-ca0e-45a9-81a5-3174d7ba88bb\"}]},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"datasourceStates\":{\"formBased\":{\"layers\":{\"fa5fc3d4-10d4-42ae-b66a-acacbede736a\":{\"columns\":{\"a2e00bae-d7b4-4902-a57c-b4137b343052\":{\"label\":\"@timestamp\",\"dataType\":\"date\",\"operationType\":\"date_histogram\",\"sourceField\":\"@timestamp\",\"isBucketed\":true,\"scale\":\"interval\",\"params\":{\"interval\":\"auto\",\"includeEmptyRows\":true,\"dropPartials\":false}},\"185b1386-ca0e-45a9-81a5-3174d7ba88bb\":{\"label\":\"Top 5 values of service.node.name\",\"dataType\":\"string\",\"operationType\":\"terms\",\"scale\":\"ordinal\",\"sourceField\":\"service.node.name\",\"isBucketed\":true,\"params\":{\"size\":5,\"orderBy\":{\"type\":\"column\",\"columnId\":\"575956d5-ca18-46f9-8654-a24ec4b7ca40\"},\"orderDirection\":\"desc\",\"otherBucket\":true,\"missingBucket\":false,\"parentFormat\":{\"id\":\"terms\"},\"include\":[],\"exclude\":[],\"includeIsRegex\":false,\"excludeIsRegex\":false}},\"575956d5-ca18-46f9-8654-a24ec4b7ca40\":{\"label\":\"Usage[Bytes]\",\"dataType\":\"number\",\"operationType\":\"median\",\"sourceField\":\"process.runtime.cpython.memory\",\"isBucketed\":false,\"scale\":\"ratio\",\"filter\":{\"query\":\"\",\"language\":\"kuery\"},\"params\":{\"emptyAsNull\":true,\"format\":{\"id\":\"bytes\",\"params\":{\"decimals\":0}}},\"customLabel\":true}},\"columnOrder\":[\"a2e00bae-d7b4-4902-a57c-b4137b343052\",\"185b1386-ca0e-45a9-81a5-3174d7ba88bb\",\"575956d5-ca18-46f9-8654-a24ec4b7ca40\"],\"incompleteColumns\":{},\"sampling\":1}}}},\"internalReferences\":[],\"adHocDataViews\":{}}}},\"panelIndex\":\"e6b321f4-9791-4ba3-baad-d085bbf1b4d6\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"e6b321f4-9791-4ba3-baad-d085bbf1b4d6\"}}]","timeRestore":false,"title":"Otel Python dashboard","version":3},"coreMigrationVersion":"8.8.0","created_at":"2025-03-07T10:29:47.831Z","created_by":"u_UjHMUlg245SmMi9Mb8ArrX-n6okxXgK_Mis-QLMJsBA_0","id":"7f5bd781-145e-45a4-a8a5-69cc487e3551","managed":false,"references":[{"id":"apm_static_data_view_id_default","name":"e6b321f4-9791-4ba3-baad-d085bbf1b4d6:indexpattern-datasource-layer-fa5fc3d4-10d4-42ae-b66a-acacbede736a","type":"index-pattern"}],"type":"dashboard","typeMigrationVersion":"10.2.0","updated_at":"2025-03-07T14:09:32.387Z","updated_by":"u_UjHMUlg245SmMi9Mb8ArrX-n6okxXgK_Mis-QLMJsBA_0","version":"WzExOSwxXQ=="}