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

Json Exporter not being able to parse through the labels and values into the child level data without using index #241

Open
KaranJaju09 opened this issue Jun 22, 2023 · 0 comments

Comments

@KaranJaju09
Copy link

Hi,

I am from Ericsson & we're using the Json Exporter in our project.

The Json Exporter is not being able to parse the child level data. It is possible only using index number, whereas it's not possible in any form (as explored) yet it seems using the sub-parameter id or any tags to make it dynamic. I would request if it is possible to do the same then someone from the community can guide us with the appropriate syntax for the same, and if not, we would like to raise a request for this as a new feature with the upcoming updates.

To explain the issue further in details with an example:

We take the below json data, where I want to get "name": "xyz-001" in my metrics labels - subscriber where the "service_id": 245084 we are able to fetch it only with the following configuration-

metrics:
- name: aci_pool
type: object
path: '{.result[*]}'
labels:
name: '{.name}'
life_cycle_status: '{.life_cycle_status.name}'
logical_site: '{.logical_site.name}'
service_provider: '{.service.name}'
consumer: '{.consumer.name}'
organizational_unit: '{.consumer.organizational_unit.name}'
subscriber: '{.depends_on_instance[1].name}'
subscriptions: '{.custom_data[42].data}'
values:
subs: 1
workers: '{.custom_data[5].data}'
worker_disk: '{.custom_data[8].data}'
vcpu: '{.custom_data[41].data}'
memory: '{.custom_data[46].data}'
master_disk: '{.custom_data[49].data}'
director_disk: '{.custom_data[28].data}'

Now, we're getting subscriber = "xyz-001" with subscriber: '{.depends_on_instance[1].name}'. But, if the data gets shuffled and comes, and this time some of my required data is in depends_on_instance[0] and some in depends_on_instance[1], my code breaks. So we want to make this dynamic using the sub parameter into the child level where we can we able to filter out and not using hard coded index number.

{
"paginator": {
"total": 200,
"limit": 1000,
"current_page": 1,
"last_page": 1
},
"result": [
{
"id": 304521,
"name": "abcd-aaa-xyz10222",
"description": null,
"service_id": 245312,
"life_cycle_status_id": 15,
"logical_site_id": 3,
"service_version_id": 502,
"service_level_agreement_id": null,
"created_at": "2021-09-03T15:15:21.774323Z",
"updated_at": "2022-11-15T18:31:04.405826Z",
"deleted_at": null,
"depends_on_instance": [
{
"id": 276550,
"name": "User Group - ALab Services Team",
"description": "User group for ALab Services Team",
"service_id": 933,
"life_cycle_status_id": 1,
"logical_site_id": 9,
"service_version_id": 250,
"service_level_agreement_id": null,
"created_at": "2021-04-19T13:32:17.617999Z",
"updated_at": "2022-10-26T08:43:58.034323Z",
"deleted_at": null,
"pivot": {
"life_cycle_status_id": 1,
"instance_id": 304521,
"instance_relations_id": 276550,
"instance_relations_type": "Instance",
"id": 1001089790,
"relation_type_id": 3,
"created_at": "2022-11-21T18:58:26.999155Z",
"updated_at": "2022-11-21T18:58:26.999155Z"
},
"tenant_id": 269,
"consumer_id": 1935
},
{
"id": 268934,
"name": "xyz-001",
"description": "ALab xyz Consumer",
"service_id": 245084,
"life_cycle_status_id": 1,
"logical_site_id": 3,
"service_version_id": 407,
"service_level_agreement_id": null,
"created_at": "2021-02-23T22:12:28.754358Z",
"updated_at": "2022-02-19T17:50:54.910971Z",
"deleted_at": null,
"pivot": {
"life_cycle_status_id": 1,
"instance_id": 304521,
"instance_relations_id": 268934,
"instance_relations_type": "Instance",
"id": 1001251408,
"relation_type_id": 3,
"created_at": "2023-06-05T12:05:45.766696Z",
"updated_at": "2023-06-05T12:05:45.766696Z"
},
"tenant_id": 4,
"consumer_id": 67
}
],
"custom_data": [
{
"id": 1745117,
"custom_field_id": 12978,
"instance_id": 304521,
"data": null,
"created_at": "2021-09-03T15:15:21.785982Z",
"updated_at": "2021-12-14T12:55:09.803671Z",
"deleted_at": null,
"life_cycle_status_id": 15
},
{
"id": 1745118,
"custom_field_id": 12979,
"instance_id": 304521,
"data": "ipv4",
"created_at": "2021-09-03T15:15:21.787749Z",
"updated_at": "2021-12-14T12:55:09.809812Z",
"deleted_at": null,
"life_cycle_status_id": 15
},
{
"id": 1745119,
"custom_field_id": 12980,
"instance_id": 304521,
"data": null,
"created_at": "2021-09-03T15:15:21.789477Z",
"updated_at": "2021-12-14T12:55:09.816814Z",
"deleted_at": null,
"life_cycle_status_id": 15
},
{
"id": 1745120,
"custom_field_id": 12981,
"instance_id": 304521,
"data": null,
"created_at": "2021-09-03T15:15:21.791193Z",
"updated_at": "2021-12-14T12:55:09.821742Z",
"deleted_at": null,
"life_cycle_status_id": 15
}
],
"life_cycle_status": {
"id": 15,
"name": "Frozen",
"created_at": "2018-08-14T09:12:26.000000Z",
"updated_at": "2018-08-14T09:12:26.000000Z",
"deleted_at": null
},
"logical_site": {
"id": 3,
"name": "ACI Location1",
"created_at": "1970-01-01T01:00:01.000000Z",
"updated_at": "2022-06-03T10:00:56.620836Z",
"deleted_at": null,
"life_cycle_status_id": 1,
"physical_site_id": 50,
"description": null
},
"service": {
"id": 245312,
"name": "ALab CaaS",
"service_level_id": 6,
"description": "This is the CaaS service offered by the ALab organization",
"created_at": "2021-01-27T12:54:20.689817Z",
"updated_at": "2021-06-23T06:01:03.828146Z",
"deleted_at": null,
"life_cycle_status_id": 1,
"tenant_id": 269,
"provider_id": 1935
},
"tenant_id": 269,
"consumer_id": 2148,
"consumer": {
"id": 2148,
"name": "GMT - ALab Services",
"authority_id": 1,
"created_at": "2021-04-19T13:42:45.914830Z",
"updated_at": "2022-12-01T16:29:03.477801Z",
"deleted_at": null,
"key": "GMTALabservices",
"description": "New team is providing user facing services.",
"life_cycle_status_id": 1,
"organizational_unit_id": 8,
"organizational_unit": {
"id": 8,
"name": "ABCC JCE SPS Shared Verification Cloud",
"business_area_id": 2,
"life_cycle_status_id": 1,
"deleted_at": null,
"created_at": "2022-12-01T16:25:12.150563Z",
"updated_at": "2023-05-05T08:55:00.976839Z"
}
}
}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant