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

Destination logs insert _ character #2108

Open
cesarjorgemartinez opened this issue Nov 3, 2021 · 9 comments
Open

Destination logs insert _ character #2108

cesarjorgemartinez opened this issue Nov 3, 2021 · 9 comments
Assignees

Comments

@cesarjorgemartinez
Copy link
Contributor

cesarjorgemartinez commented Nov 3, 2021

Example:

time=2021-11-03T10:23:14.718Z | lvl=INFO | corr=XYZ; cbnotif=1 | trans=ABC | srv=N/A | subsrv=N/A | op=processNewBatches | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.NGSISink[606] : Finishing internal transaction (DEF; cbnotif=1, FFF; cbnotif=1, ) Sink: com.telefonica.iot.cygnus.sinks.NGSIPostgisSink Destination: yyy_/_parking_onstreetparking

Must be:
Destination: yyy/parking_onstreetparking

Doubt: For all sink types?

@AlvaroVega
Copy link
Member

bug in a log ?

@cesarjorgemartinez
Copy link
Contributor Author

I think, because not exist something as yyy_/_parking_onstreetparking

@AlvaroVega
Copy link
Member

AlvaroVega commented Nov 18, 2021

Printed by

LOGGER.info("Finishing internal transaction (" + transactionIds + ")" + " Sink: " + this.getName() + " Destination: " + destination);

and

LOGGER.info("Finishing internal transaction (" + transactionIds + ")" + " Sink: " + this.getName() + " Destination: " + destination );

But tablename is build at (i.e. for postgis)

case DMBYENTITY:
String truncatedServicePath = NGSIUtils.encode(servicePath, true, false);
name = (truncatedServicePath.isEmpty() ? "" : truncatedServicePath + '_')
+ NGSIUtils.encode(entity, false, true);
break;
case DMBYENTITYTYPE:
truncatedServicePath = NGSIUtils.encode(servicePath, true, false);
name = (truncatedServicePath.isEmpty() ? "" : truncatedServicePath + '_')
+ NGSIUtils.encode(entityType, false, true);
break;
case DMBYATTRIBUTE:
truncatedServicePath = NGSIUtils.encode(servicePath, true, false);
name = (truncatedServicePath.isEmpty() ? "" : truncatedServicePath + '_')
+ NGSIUtils.encode(entity, false, true)
+ '_' + NGSIUtils.encode(attribute, false, true);
break;

and depends on datamodel configured for that sink

@smartcitydevops
Copy link
Collaborator

The issue is still ongong in our prouction environment with 2.16.0 cygnus_version

@AlvaroVega
Copy link
Member

AlvaroVega commented Feb 22, 2022

Could you provide for this case #2108 (comment) what is the name of service, subservice, entity_id, entity_type, database name and so on (not real, but with examples) ?

@smartcitydevops
Copy link
Collaborator

There are several cases:

  • postgis : xxxx_/yyyyyyyyyy o xxxx_/_zzzzzzzzz
  • mongo(sth): aaaaa_/bbbbbbb o kkkkk_/
  • ckan: ssss_/fffffff
  • arcgis: _ggggggg
  • mysql: lllllll_/ssssssss

@AlvaroVega
Copy link
Member

yyyyyyyyy is a subservice?
zzzzzzzzz is a entity_id, or an entity_type?

@AlvaroVega
Copy link
Member

AlvaroVega commented Feb 23, 2022

For example in a log with " Sink: mysql-sink Destination: smartcity_/_thing:dispB_thing" and default data model (dm-by-entity)
service: smartcity
subservice: /
enttiy_id: thing:dispB
enttiy_type: thing
And seems right to me

@AlvaroVega
Copy link
Member

AlvaroVega commented Feb 23, 2022

Summarizing character '_' is used by cygnus in destination (and then in logs where destination appears) to contact depending n datamodel used the several atoms:
<service>_<subservice>_<entity_id>_<entity_type>
<service>_<subservice>_<entity_type>
<service>_<subservice>_<entity_id>_<attribute>

having in account that subservice contains always '/'.

So destination word in logs should be read in this way

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

4 participants