orchestracities / ngsi-timeseries-api

QuantumLeap: a FIWARE Generic Enabler to support the usage of NGSIv2 (and NGSI-LD experimentally) data in time-series databases
https://quantumleap.rtfd.io/
MIT License
37 stars 49 forks source link

Data not properly logged when fiware-service header is not present (CrateDB) #728

Closed solucca closed 1 year ago

solucca commented 1 year ago

When using Orion-LD (NSGI-LD) to set up a subscription to an entity, quantum leaps does not recognise the right service name and logs the data in the "doc" database instead of creating one corresponding to the fiware-service

To Reproduce Steps to reproduce the behavior: Set up subscription:

curl --location --request POST 'http://orion:1026/ngsi-ld/v1/subscriptions/' \
--header 'NGSILD-Tenant: openiot' \
--header 'Content-Type: application/json' \
--header 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
--data-raw '{
  "description": "Notify me of all weight changes",
  "type": "Subscription",
  "throttling": 10,
  "entities": [ {
    "type": "Device",
    "id": "urn:ngsi-ld:Device:weight001"
    }
    ],
  "watchedAttributes": ["weight"],
  "notification": {
    "attributes": ["weight", "weightClass", "price"],
    "format": "normalized",
    "endpoint": {
      "uri": "http://quantumleap:8668/v2/notify",
      "accept": "application/json"
    }
  }
}'

After the weight attribute is changed this is the result in CrateDB: image

We can hotfix this problem by adding a new attribute to "endpoint":

"endpoint": {
      "uri": "http://quantumleap:8668/v2/notify",
      "accept": "application/json",
      "receiverInfo" : [
        { 
          "key":"fiware-service",
          "value":"openiot"
        }
       ]
    }

Expected behavior Quantum leap was supposed to create a new database for the corresponding fiware-service: image

Environment :

c0c0n3 commented 1 year ago

hi @solucca :-)

Quantum Leap 0.8.3 doesn't support the NGSILD-Tenant header, it only supports the v2 fiware-service header, which explains the behaviour you reported. But @rohit-vrrr contributed this feature (#721), we merged into the mainline but haven't cut a release for it yet. If this is blocking you, I suggest you pull the master or edge image from DockerHub until we release 0.9.0 which will support the NGSILD-Tenant header.