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

cannot get property correctly #3793

Closed
I075818 opened this issue Sep 11, 2023 · 4 comments
Closed

cannot get property correctly #3793

I075818 opened this issue Sep 11, 2023 · 4 comments
Labels
bug For bugs or other software errors

Comments

@I075818
Copy link

I075818 commented Sep 11, 2023

Use VIGA edit tool,run the below json, it will get error message "Cannot read properties of undefined (reading ‘attributes’)" .
If the ‘metric.attributes.pod_id’ is replaced with ‘pod_id’, it works.

{
  "$schema": "https://vega.github.io/schema/vega/v5.json",
  "description": "A timeline visualization of the lives of the first five U.S. presidents.",
  "data": [
    {
      "name": "testdata",
      "values": [
        {
  "_index": "metrics-otel-v1-2023.09.06",
  "_type": "_doc",
  "_id": "_YH3aIoBwqxJSF1N_aqW",
  "_version": 1,
  "_score": null,
  "_source": {
    "kind": "SUMMARY",
    "count": 5,
    "flags": 0,
    "description": "POC metrics for outbound request",
    "sum": 7.003,
    "serviceName": "mcs",
    "schemaUrl": "",
    "quantiles": [
      {
        "quantile": 0.5,
        "value": 0
      },
      {
        "quantile": 0.95,
        "value": 0
      }
    ],
    "unit": "",
    "name": "outbound_request_seconds",
    "startTime": "2023-09-06T04:35:22.773Z",
    "quantileValuesCount": 2,
    "time": "2023-09-06T05:29:52.773Z",
    "metric.attributes.pod_id": "p2",
    "resource.attributes.net@host@name": "10.236.136.67",
    "metric.attributes.uri": "https://hello-app-jiedong.c-5c85d6f.kyma.ondemand.com/random",
    "resource.attributes.service@instance@id": "10.236.136.67:9090",
    "resource.attributes.service@name": "mcs",
    "resource.attributes.http@scheme": "http",
    "instrumentationScope.version": "0.82.0",
    "resource.attributes.net@host@port": "9090",
    "instrumentationScope.name": "otelcol/prometheusreceiver",
    "metric.attributes.method": "POST",
    "[metric.attributes.com](http://metric.attributes.com/)_sap_hybris_telemetry_flag": "customer_facing",
    "[metric.attributes.com](http://metric.attributes.com/)_sap_hybris_extensibility_type": "synchronous",
    "metric.attributes.status": "200",
    "metric.attributes.exception": "None",
    "metric.attributes.pod_name": "-",
    "[metric.attributes.com](http://metric.attributes.com/)_sap_hybris_extensibility_point_type": "remove-from-cart"
  },
  "fields": {
    "startTime": [
      "2023-09-06T04:35:22.773Z"
    ],
    "time": [
      "2023-09-06T05:29:52.773Z"
    ]
  },
  "sort": [
    1693978192773,
    2070754
  ]
},
{
  "_index": "metrics-otel-v1-2023.09.06",
  "_type": "_doc",
  "_id": "_4H3aIoBwqxJSF1N_aqW",
  "_version": 1,
  "_score": null,
  "_source": {
    "kind": "SUMMARY",
    "count": 5,
    "flags": 0,
    "description": "POC metrics for outbound request",
    "sum": 5.563,
    "serviceName": "mcs",
    "schemaUrl": "",
    "quantiles": [
      {
        "quantile": 0.5,
        "value": 0
      },
      {
        "quantile": 0.95,
        "value": 0
      }
    ],
    "unit": "",
    "name": "outbound_request_seconds",
    "startTime": "2023-09-06T05:03:22.773Z",
    "quantileValuesCount": 2,
    "time": "2023-09-06T05:29:52.773Z",
    "metric.attributes.pod_id": "p1",
    "resource.attributes.net@host@name": "10.236.136.67",
    "metric.attributes.uri": "https://hello-app-jiedong.c-5c85d6f.kyma.ondemand.com/random",
    "resource.attributes.service@instance@id": "10.236.136.67:9090",
    "resource.attributes.service@name": "mcs",
    "resource.attributes.http@scheme": "http",
    "instrumentationScope.version": "0.82.0",
    "resource.attributes.net@host@port": "9090",
    "instrumentationScope.name": "otelcol/prometheusreceiver",
    "metric.attributes.method": "POST",
    "[metric.attributes.com](http://metric.attributes.com/)_sap_hybris_telemetry_flag": "customer_facing",
    "[metric.attributes.com](http://metric.attributes.com/)_sap_hybris_extensibility_type": "synchronous",
    "metric.attributes.status": "500",
    "metric.attributes.exception": "None",
    "metric.attributes.pod_name": "-",
    "[metric.attributes.com](http://metric.attributes.com/)_sap_hybris_extensibility_point_type": "remove-from-cart"
  },
  "fields": {
    "startTime": [
      "2023-09-06T05:03:22.773Z"
    ],
    "time": [
      "2023-09-06T05:29:52.773Z"
    ]
  },
  "sort": [
    1693978192773,
    1494437
  ],
  "$$_isAnchor": true
}
  ] ,
  "transform":[
    { "type": "filter", "expr": "datum._source.name == 'outbound_request_seconds'"}
    
  ]
},
{"name": "groupbyPod",
  "source":"testdata",
  "transform": [
    {"type": "aggregate",
     "ops":["sum"],
     "fields":["_source.count"],
     "as":["s1"],
    "groupby":["_source.metric.attributes.pod_id"]
    }
  ]}
]
  
}
@I075818 I075818 added the bug For bugs or other software errors label Sep 11, 2023
@domoritz
Copy link
Member

Thanks for the report. Can you provide a minimal reproducible example that demonstrates the issue?

@I075818
Copy link
Author

I075818 commented Sep 11, 2023

Hi domoritz,
Please use this json to debug.

{
    "$schema": "https://vega.github.io/schema/vega/v5.json",
    "description": "A timeline visualization of the lives of the first five U.S. presidents.",
    "data": [
        {
            "name": "testdata",
            "values": [
                {
                    "_index": "metrics-otel-v1-2023.09.06",
                    "_type": "_doc",
                    "_id": "_YH3aIoBwqxJSF1N_aqW",
                    "_source": {
                        "kind": "SUMMARY",
                        "count": 5,
                        "flags": 0,
                        "description": "POC metrics for outbound request",
                        "sum": 7.003,
                        "name": "outbound_request_seconds",
                        "startTime": "2023-09-06T04:35:22.773Z",
                        "quantileValuesCount": 2,
                        "time": "2023-09-06T05:29:52.773Z",
                        "metric.attributes.pod_id": "p2"
                    }
                },
                {
                    "_index": "metrics-otel-v1-2023.09.06",
                    "_type": "_doc",
                    "_id": "_4H3aIoBwqxJSF1N_aqW",
                    "_source": {
                        "kind": "SUMMARY",
                        "count": 5,
                        "flags": 0,
                        "description": "POC metrics for outbound request",
                        "sum": 5.563,
                        "name": "outbound_request_seconds",
                        "startTime": "2023-09-06T05:03:22.773Z",
                        "quantileValuesCount": 2,
                        "time": "2023-09-06T05:29:52.773Z",
                        "metric.attributes.pod_id": "p1"
                    }
                }
            ],
            "transform": [
                {
                    "type": "filter",
                    "expr": "datum._source.name == 'outbound_request_seconds'"
                }
            ]
        },
        {
            "name": "groupbyPod",
            "source": "testdata",
            "transform": [
                {
                    "type": "aggregate",
                    "ops": [
                        "sum"
                    ],
                    "fields": [
                        "_source.count"
                    ],
                    "as": [
                        "s1"
                    ],
                    "groupby": [
                        "_source.metric.attributes.pod_id"
                    ]
                }
            ]
        }
    ]
}

@PBI-David
Copy link
Contributor

PBI-David commented Sep 11, 2023

There are no marks in your sample spec. Regardless, I think you just need to escape any property names containing . with \\.

e.g. "_source\\.metric\\.attributes\\.pod_id"

@I075818
Copy link
Author

I075818 commented Sep 11, 2023

Thank you very much!

@I075818 I075818 closed this as completed Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For bugs or other software errors
Projects
None yet
Development

No branches or pull requests

3 participants