-
-
Notifications
You must be signed in to change notification settings - Fork 2
implementation of the zipkin converter started #21
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0"> | ||
| <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> | ||
| <asx:values> | ||
| <DEVC> | ||
| <CTEXT>att instrumentation</CTEXT> | ||
| </DEVC> | ||
| </asx:values> | ||
| </asx:abap> | ||
| </abapGit> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| *&---------------------------------------------------------------------* | ||
| *& Report zatt_trace_example | ||
| *&---------------------------------------------------------------------* | ||
| *& | ||
| *&---------------------------------------------------------------------* | ||
| REPORT zatt_trace_example. | ||
|
|
||
| START-OF-SELECTION. | ||
|
|
||
| DATA(trace_transaction) = NEW zcl_att_trace_transaction( ). | ||
|
|
||
| DATA(root_span) = trace_transaction->get_root_span( ). | ||
|
|
||
| root_span->add_span( ). | ||
|
|
||
| root_span->add_span( ). | ||
|
|
||
| trace_transaction->push_trace( ). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0"> | ||
| <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> | ||
| <asx:values> | ||
| <PROGDIR> | ||
| <NAME>ZATT_TRACE_EXAMPLE</NAME> | ||
| <DBAPL>S</DBAPL> | ||
| <SUBC>1</SUBC> | ||
| <FIXPT>X</FIXPT> | ||
| <LDBNAME>D$S</LDBNAME> | ||
| <UCCHECK>X</UCCHECK> | ||
| </PROGDIR> | ||
| <TPOOL> | ||
| <item> | ||
| <ID>R</ID> | ||
| <ENTRY>trace example</ENTRY> | ||
| <LENGTH>13</LENGTH> | ||
| </item> | ||
| </TPOOL> | ||
| </asx:values> | ||
| </asx:abap> | ||
| </abapGit> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| CLASS zcl_att_span DEFINITION | ||
| PUBLIC | ||
| FINAL | ||
| CREATE PRIVATE | ||
| GLOBAL FRIENDS zcl_att_trace_transaction. | ||
|
|
||
| PUBLIC SECTION. | ||
|
|
||
| TYPES ty_span_id TYPE sysuuid_x16. | ||
|
|
||
| TYPES: BEGIN OF ty_span_child, | ||
| span_id TYPE ty_span_id, | ||
| span TYPE REF TO zcl_att_span, | ||
| END OF ty_span_child. | ||
|
|
||
| TYPES ty_span_childs TYPE STANDARD TABLE OF ty_span_child WITH KEY span_id. | ||
|
|
||
| METHODS constructor. | ||
| METHODS get_span_id | ||
| RETURNING VALUE(span_id) TYPE ty_span_id. | ||
| METHODS add_span. | ||
| METHODS get_span_childs | ||
| RETURNING VALUE(span_childs) TYPE ty_span_childs. | ||
|
|
||
| PROTECTED SECTION. | ||
| PRIVATE SECTION. | ||
|
|
||
| DATA span_id TYPE ty_span_id. | ||
| DATA span_childs TYPE ty_span_childs. | ||
|
|
||
| ENDCLASS. | ||
|
|
||
|
|
||
|
|
||
| CLASS zcl_att_span IMPLEMENTATION. | ||
|
|
||
| METHOD constructor. | ||
|
|
||
| TRY. | ||
| me->span_id = cl_system_uuid=>create_uuid_x16_static( ). | ||
| CATCH cx_uuid_error. | ||
| ASSERT 1 = 2. | ||
| ENDTRY. | ||
|
|
||
| ENDMETHOD. | ||
|
|
||
| METHOD add_span. | ||
|
|
||
| DATA(span) = NEW zcl_att_span( ). | ||
|
|
||
| span_childs = VALUE #( BASE span_childs ( span_id = span->get_span_id( ) | ||
| span = span ) ). | ||
|
|
||
| ENDMETHOD. | ||
|
|
||
| METHOD get_span_id. | ||
| span_id = me->span_id. | ||
| ENDMETHOD. | ||
|
|
||
| METHOD get_span_childs. | ||
| span_childs = me->span_childs. | ||
| ENDMETHOD. | ||
|
|
||
| ENDCLASS. |
File renamed without changes.
57 changes: 57 additions & 0 deletions
57
src/att_instrumentation/zcl_att_trace_transaction.clas.abap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| CLASS zcl_att_trace_transaction DEFINITION | ||
| PUBLIC | ||
| FINAL | ||
| CREATE PUBLIC . | ||
|
|
||
| PUBLIC SECTION. | ||
|
|
||
| TYPES ty_trace_id TYPE sysuuid_c32. | ||
|
|
||
| METHODS constructor. | ||
| METHODS get_trace_id RETURNING VALUE(trace_id) TYPE ty_trace_id. | ||
| METHODS get_root_span | ||
| RETURNING VALUE(span) TYPE REF TO zcl_att_span. | ||
| METHODS push_trace. | ||
|
|
||
| PROTECTED SECTION. | ||
| PRIVATE SECTION. | ||
|
|
||
| DATA root_span TYPE REF TO zcl_att_span. | ||
| DATA trace_id TYPE ty_trace_id. | ||
|
|
||
| ENDCLASS. | ||
|
|
||
|
|
||
|
|
||
| CLASS zcl_att_trace_transaction IMPLEMENTATION. | ||
|
|
||
| METHOD constructor. | ||
|
|
||
| TRY. | ||
| me->trace_id = cl_system_uuid=>create_uuid_c32_static( ). | ||
| CATCH cx_uuid_error. | ||
| ASSERT 1 = 2. | ||
| ENDTRY. | ||
|
|
||
| me->root_span = NEW #( ). | ||
|
|
||
| ENDMETHOD. | ||
|
|
||
| METHOD get_trace_id. | ||
| trace_id = me->trace_id. | ||
| ENDMETHOD. | ||
|
|
||
| METHOD get_root_span. | ||
| span = root_span. | ||
| ENDMETHOD. | ||
|
|
||
| METHOD push_trace. | ||
|
|
||
| DATA(customizing) = NEW zcl_att_customizing_base( scenario = 'example' ). | ||
| DATA(converter) = customizing->get_converter_class( ). | ||
|
|
||
| DATA(converted_trace) = converter->convert( trace = me | ||
| customizing = customizing ). | ||
| ENDMETHOD. | ||
|
|
||
| ENDCLASS. |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| CLASS zcl_att_conv_zipkin DEFINITION | ||
| PUBLIC | ||
| FINAL | ||
| CREATE PUBLIC . | ||
|
|
||
| PUBLIC SECTION. | ||
|
|
||
| INTERFACES zif_att_trace_converter. | ||
|
|
||
| PROTECTED SECTION. | ||
| PRIVATE SECTION. | ||
|
|
||
| METHODS compose_json_from_span | ||
| IMPORTING span TYPE REF TO zcl_att_span | ||
| RETURNING VALUE(json) TYPE string. | ||
|
|
||
| ENDCLASS. | ||
|
|
||
|
|
||
|
|
||
| CLASS zcl_att_conv_zipkin IMPLEMENTATION. | ||
|
|
||
|
|
||
|
|
||
| METHOD zif_att_trace_converter~convert. | ||
|
|
||
| DATA(trace_id) = trace->get_trace_id( ). | ||
| DATA(root_span) = trace->get_root_span( ). | ||
|
|
||
| DATA(span_json) = compose_json_from_span( root_span ). | ||
|
|
||
| DATA(zipkin_json) = |[\{ { span_json } \}]|. | ||
|
|
||
| converted_trace-trace_id = trace_id. | ||
| converted_trace-json = zipkin_json. | ||
|
|
||
|
|
||
| ENDMETHOD. | ||
|
|
||
| METHOD compose_json_from_span. | ||
|
|
||
| DATA(spans) = span->get_span_childs( ). | ||
|
|
||
| LOOP AT spans ASSIGNING FIELD-SYMBOL(<span>). | ||
| DATA(json_tmp) = compose_json_from_span( <span>-span ). | ||
| json = json && json_tmp. | ||
| ENDLOOP. | ||
| json = json && |\{ "span_id": "{ span->get_span_id( ) }"\}|. | ||
|
|
||
| * [{ | ||
| * "id": "11123456", | ||
| * "": "0123456789abcdef", | ||
| * "timestamp": 1608239395286533, | ||
| * "duration": 100000, | ||
| * "name": "span from ABAPTAG1!", | ||
| * "description": "description", | ||
| * "tags": { | ||
| * "http.method": "GET", | ||
| * "http.path": "/dummy", | ||
| * "tag1": "tag1", | ||
| * "tag2": "tag2" | ||
| * }, | ||
| * "localEndpoint": { | ||
| * "serviceName": "shell script" | ||
| * } | ||
| *}, | ||
| *{ | ||
| * "id": "111234567", | ||
| * "traceId": "0123456789abcdef", | ||
| * "timestamp": 1608239495287533, | ||
| * "duration": 100000, | ||
| * "name": "span from ABAPTAG2!", | ||
| * "kind": "SERVER", | ||
| * "tags": { | ||
| * "http.method": "GET", | ||
| * "http.path": "/dummy", | ||
| * "tag1": "tag1", | ||
| * "tag2": "tag2" | ||
| * }, | ||
| * "localEndpoint": { | ||
| * "serviceName": "shell script" | ||
| * } | ||
| *}, | ||
| *{ | ||
| * "id": "352bff9a74ca9ad2", | ||
| * "traceId": "0123456789abcdef", | ||
| * "parentId": "111234567", | ||
| * "name": "get /api", | ||
| * "timestamp": 1556604172355737, | ||
| * "duration": 1431, | ||
| * "kind": "SERVER", | ||
| * "localEndpoint": { | ||
| * "serviceName": "backend", | ||
| * "ipv4": "192.168.99.1", | ||
| * "port": 3306 | ||
| * }, | ||
| * "remoteEndpoint": { | ||
| * "ipv4": "172.19.0.2", | ||
| * "port": 58648 | ||
| * }, | ||
| * "tags": { | ||
| * "http.method": "GET", | ||
| * "http.path": "/api" | ||
| * } | ||
| * }] | ||
|
|
||
| ENDMETHOD. | ||
|
|
||
| ENDCLASS. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0"> | ||
| <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> | ||
| <asx:values> | ||
| <VSEOCLASS> | ||
| <CLSNAME>ZCL_ATT_CONV_ZIPKIN</CLSNAME> | ||
| <LANGU>E</LANGU> | ||
| <DESCRIPT>att converter zipkin</DESCRIPT> | ||
| <STATE>1</STATE> | ||
| <CLSCCINCL>X</CLSCCINCL> | ||
| <FIXPT>X</FIXPT> | ||
| <UNICODE>X</UNICODE> | ||
| </VSEOCLASS> | ||
| </asx:values> | ||
| </asx:abap> | ||
| </abapGit> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with all that json? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the reminder that it's not finished. Not good, but maybe better to have some progress.