Skip to content

Commit d25d8bb

Browse files
loki converter and connector added (#86)
* loki converter and connector added * readme update of components status Co-authored-by: Max Stenke <[email protected]>
1 parent 2e949ff commit d25d8bb

27 files changed

+146
-58
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616

1717
| component | variant | status |
1818
| ----------------|----------------|---------|
19-
| reader | BAL | [WIP](https://github.com/abap-observability-tools/abap-log-exporter/issues?q=is%3Aopen+is%3Aissue+label%3ABAL) |
19+
| reader | BAL | :heavy_check_mark: |
2020
| | SMICM | open |
2121
| | SM21 | [#41](https://github.com/abap-observability-tools/abap-log-exporter/issues/41) |
22-
| converter | GELF | WIP |
23-
| | Loki | open |
24-
| | Tempo | open |
22+
| converter | GELF | :heavy_check_mark: |
23+
| | Loki | :heavy_check_mark: |
2524
| connector | GELF | :heavy_check_mark: |
26-
| | Loki | open |
27-
| | Tempo | open |
25+
| | Loki | :heavy_check_mark: |
2826

2927

3028
## customizing
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<DEVC>
6+
<CTEXT>ale connector</CTEXT>
7+
</DEVC>
8+
</asx:values>
9+
</asx:abap>
10+
</abapGit>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
CLASS zcl_ale_log_connector_loki DEFINITION
2+
PUBLIC
3+
FINAL
4+
CREATE PUBLIC .
5+
6+
PUBLIC SECTION.
7+
8+
INTERFACES zif_ale_log_connector.
9+
10+
PROTECTED SECTION.
11+
PRIVATE SECTION.
12+
ENDCLASS.
13+
14+
15+
16+
CLASS zcl_ale_log_connector_loki IMPLEMENTATION.
17+
METHOD zif_ale_log_connector~connect.
18+
19+
DATA(loki_url) = customizing->get_connector_url( ).
20+
21+
LOOP AT converted_logs ASSIGNING FIELD-SYMBOL(<converted_log>).
22+
23+
cl_http_client=>create_by_url(
24+
EXPORTING
25+
url = CONV #( loki_url )
26+
IMPORTING
27+
client = DATA(client)
28+
EXCEPTIONS
29+
argument_not_found = 1
30+
plugin_not_active = 2
31+
internal_error = 3
32+
OTHERS = 4 ).
33+
IF sy-subrc <> 0.
34+
ASSERT 1 = 2.
35+
ENDIF.
36+
37+
client->request->set_method( 'POST' ).
38+
client->request->set_content_type( 'application/json' ).
39+
40+
TRY.
41+
DATA(xjson) = cl_binary_convert=>string_to_xstring_utf8( iv_string = <converted_log>-json ).
42+
CATCH cx_sy_conversion_error.
43+
ASSERT 1 = 2.
44+
ENDTRY.
45+
46+
client->request->set_data( xjson ).
47+
48+
client->send(
49+
EXCEPTIONS
50+
http_communication_failure = 1
51+
http_invalid_state = 2
52+
http_processing_failed = 3
53+
http_invalid_timeout = 4
54+
OTHERS = 5 ).
55+
IF sy-subrc <> 0.
56+
ASSERT 1 = 2.
57+
ENDIF.
58+
59+
client->receive(
60+
EXCEPTIONS
61+
http_communication_failure = 1
62+
http_invalid_state = 2
63+
http_processing_failed = 3
64+
OTHERS = 4 ).
65+
IF sy-subrc <> 0.
66+
client->response->get_status( IMPORTING
67+
code = DATA(http_code)
68+
reason = DATA(reason) ).
69+
ASSERT 1 = 2.
70+
ENDIF.
71+
ENDLOOP.
72+
ENDMETHOD.
73+
74+
ENDCLASS.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<DEVC>
6+
<CTEXT>converting logs</CTEXT>
7+
</DEVC>
8+
</asx:values>
9+
</asx:abap>
10+
</abapGit>

0 commit comments

Comments
 (0)