fluent-plugin-openlineage-light 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. checksums.yaml +7 -0
  2. data/.github/dependabot.yml +6 -0
  3. data/.github/workflows/linux.yml +30 -0
  4. data/.gitignore +16 -0
  5. data/.idea/.gitignore +8 -0
  6. data/.idea/fluentd.iml +204 -0
  7. data/.idea/misc.xml +4 -0
  8. data/.idea/modules/benchmark-memory-0.2.iml +12 -0
  9. data/.idea/modules/bigdecimal-3.1.iml +11 -0
  10. data/.idea/modules/certstore_c-0.1.iml +15 -0
  11. data/.idea/modules/concurrent-ruby-1.3.iml +18 -0
  12. data/.idea/modules/concurrent-ruby-1.31.iml +15 -0
  13. data/.idea/modules/connection_pool-2.4.iml +11 -0
  14. data/.idea/modules/cool.io-1.8.iml +16 -0
  15. data/.idea/modules/drb-2.2.iml +14 -0
  16. data/.idea/modules/drb-2.21.iml +11 -0
  17. data/.idea/modules/ffi-1.17.iml +20 -0
  18. data/.idea/modules/ffi-win32-extensions-1.0.iml +19 -0
  19. data/.idea/modules/fluentd-1.17.iml +43 -0
  20. data/.idea/modules/http_parser.rb-0.8.iml +17 -0
  21. data/.idea/modules/json-2.7.iml +14 -0
  22. data/.idea/modules/json-2.71.iml +11 -0
  23. data/.idea/modules/msgpack-1.7.iml +15 -0
  24. data/.idea/modules/mutex_m-0.2.iml +15 -0
  25. data/.idea/modules/new_gem.iml +15 -0
  26. data/.idea/modules/power_assert-2.0.iml +19 -0
  27. data/.idea/modules/rake-13.2.iml +18 -0
  28. data/.idea/modules/rake-13.21.iml +15 -0
  29. data/.idea/modules/rake-compiler-1.2.iml +13 -0
  30. data/.idea/modules/rusty_json_schema-0.15.iml +15 -0
  31. data/.idea/modules/serverengine-2.3.iml +17 -0
  32. data/.idea/modules/sigdump-0.2.iml +16 -0
  33. data/.idea/modules/specifications.iml +14 -0
  34. data/.idea/modules/specifications1.iml +11 -0
  35. data/.idea/modules/strptime-0.2.iml +16 -0
  36. data/.idea/modules/thermite-0.13.iml +17 -0
  37. data/.idea/modules/webrick-1.8.iml +18 -0
  38. data/.idea/modules/win32-event-0.6.iml +21 -0
  39. data/.idea/modules/win32-ipc-0.7.iml +20 -0
  40. data/.idea/modules/yajl-ruby-1.4.iml +779 -0
  41. data/.idea/modules.xml +41 -0
  42. data/.rspec +2 -0
  43. data/ChangeLog +3 -0
  44. data/Gemfile +3 -0
  45. data/LICENSE +202 -0
  46. data/README.md +41 -0
  47. data/Rakefile +13 -0
  48. data/fluent-plugin-openlineage-light.gemspec +28 -0
  49. data/lib/fluent/plugin/parser_openlineage.rb +203 -0
  50. data/misc/fluent.conf +101 -0
  51. data/misc/test-complete.json +73 -0
  52. data/misc/test-start.json +73 -0
  53. data/spec/Naming.md +500 -0
  54. data/spec/OpenLineage.json +304 -0
  55. data/spec/Versioning.md +49 -0
  56. data/spec/events/event_full.json +206 -0
  57. data/spec/events/event_invalid_dataset_facet.json +31 -0
  58. data/spec/events/event_invalid_input_dataset_facet.json +29 -0
  59. data/spec/events/event_invalid_job_facet.json +26 -0
  60. data/spec/events/event_invalid_output_dataset_facet.json +29 -0
  61. data/spec/events/event_invalid_run_facet.json +28 -0
  62. data/spec/events/event_no_run_id.json +28 -0
  63. data/spec/events/event_simple.json +29 -0
  64. data/spec/facets/ColumnLineageDatasetFacet.json +96 -0
  65. data/spec/facets/ColumnLineageDatasetFacet.md +106 -0
  66. data/spec/facets/DataQualityAssertionsDatasetFacet.json +49 -0
  67. data/spec/facets/DataQualityMetricsInputDatasetFacet.json +76 -0
  68. data/spec/facets/DatasetVersionDatasetFacet.json +31 -0
  69. data/spec/facets/DatasourceDatasetFacet.json +32 -0
  70. data/spec/facets/DocumentationDatasetFacet.json +31 -0
  71. data/spec/facets/DocumentationJobFacet.json +30 -0
  72. data/spec/facets/ErrorMessageRunFacet.json +41 -0
  73. data/spec/facets/ExternalQueryRunFacet.json +36 -0
  74. data/spec/facets/ExternalQueryRunFacet.md +49 -0
  75. data/spec/facets/ExtractionErrorRunFacet.json +58 -0
  76. data/spec/facets/JobTypeJobFacet.json +41 -0
  77. data/spec/facets/LifecycleStateChangeDatasetFacet.json +46 -0
  78. data/spec/facets/NominalTimeRunFacet.json +38 -0
  79. data/spec/facets/OutputStatisticsOutputDatasetFacet.json +36 -0
  80. data/spec/facets/OwnershipDatasetFacet.json +45 -0
  81. data/spec/facets/OwnershipJobFacet.json +45 -0
  82. data/spec/facets/ParentRunFacet.json +54 -0
  83. data/spec/facets/ProcessingEngineRunFacet.json +41 -0
  84. data/spec/facets/SQLJobFacet.json +30 -0
  85. data/spec/facets/SchemaDatasetFacet.json +59 -0
  86. data/spec/facets/SourceCodeJobFacet.json +34 -0
  87. data/spec/facets/SourceCodeLocationJobFacet.json +60 -0
  88. data/spec/facets/StorageDatasetFacet.json +35 -0
  89. data/spec/facets/SymlinksDatasetFacet.json +47 -0
  90. data/spec/fluent/plugin/test_parser_openlineage.rb +141 -0
  91. data/spec/registry/core/registry.json +31 -0
  92. data/spec/registry/gcp/facets/GcpCommonJobFacet.json +43 -0
  93. data/spec/registry/gcp/registry.json +6 -0
  94. data/spec/spec_helper.rb +8 -0
  95. data/spec/tests/ColumnLineageDatasetFacet/1.json +172 -0
  96. data/spec/tests/DataQualityAssertionsDatasetFacet/1.json +58 -0
  97. data/spec/tests/DataQualityMetricsInputDatasetFacet/1.json +23 -0
  98. data/spec/tests/DatasetVersionDatasetFacet/1.json +7 -0
  99. data/spec/tests/DatasourceDatasetFacet/1.json +7 -0
  100. data/spec/tests/DocumentationDatasetFacet/1.json +7 -0
  101. data/spec/tests/DocumentationJobFacet/1.json +7 -0
  102. data/spec/tests/ErrorMessageRunFacet/1.json +9 -0
  103. data/spec/tests/ExternalQueryRunFacet/1.json +8 -0
  104. data/spec/tests/ExtractionErrorRunFacet/1.json +15 -0
  105. data/spec/tests/JobTypeJobFacet/1.json +9 -0
  106. data/spec/tests/LifecycleStateChangeDatasetFacet/1.json +11 -0
  107. data/spec/tests/NominalTimeRunFacet/1.json +8 -0
  108. data/spec/tests/OutputStatisticsOutputDatasetFacet/1.json +9 -0
  109. data/spec/tests/OwnershipDatasetFacet/1.json +11 -0
  110. data/spec/tests/OwnershipJobFacet/1.json +11 -0
  111. data/spec/tests/ParentRunFacet/1.json +13 -0
  112. data/spec/tests/ProcessingEngineRunFacet/1.json +9 -0
  113. data/spec/tests/SQLJobFacet/1.json +7 -0
  114. data/spec/tests/SchemaDatasetFacet/1.json +92 -0
  115. data/spec/tests/SourceCodeJobFacet/1.json +8 -0
  116. data/spec/tests/SourceCodeLocationJobFacet/1.json +8 -0
  117. data/spec/tests/StorageDatasetFacet/1.json +8 -0
  118. data/spec/tests/SymlinksDatasetFacet/1.json +13 -0
  119. data/spec/tests/example_full_event.json +24 -0
  120. metadata +304 -0
data/.idea/modules.xml ADDED
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/benchmark-memory-0.2.iml" filepath="$PROJECT_DIR$/.idea/modules/benchmark-memory-0.2.iml" />
6
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/bigdecimal-3.1.iml" filepath="$PROJECT_DIR$/.idea/modules/bigdecimal-3.1.iml" />
7
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/certstore_c-0.1.iml" filepath="$PROJECT_DIR$/.idea/modules/certstore_c-0.1.iml" />
8
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/concurrent-ruby-1.3.iml" filepath="$PROJECT_DIR$/.idea/modules/concurrent-ruby-1.3.iml" />
9
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/concurrent-ruby-1.31.iml" filepath="$PROJECT_DIR$/.idea/modules/concurrent-ruby-1.31.iml" />
10
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/connection_pool-2.4.iml" filepath="$PROJECT_DIR$/.idea/modules/connection_pool-2.4.iml" />
11
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/cool.io-1.8.iml" filepath="$PROJECT_DIR$/.idea/modules/cool.io-1.8.iml" />
12
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/drb-2.2.iml" filepath="$PROJECT_DIR$/.idea/modules/drb-2.2.iml" />
13
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/drb-2.21.iml" filepath="$PROJECT_DIR$/.idea/modules/drb-2.21.iml" />
14
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/ffi-1.17.iml" filepath="$PROJECT_DIR$/.idea/modules/ffi-1.17.iml" />
15
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/ffi-win32-extensions-1.0.iml" filepath="$PROJECT_DIR$/.idea/modules/ffi-win32-extensions-1.0.iml" />
16
+ <module fileurl="file://$PROJECT_DIR$/.idea/fluentd.iml" filepath="$PROJECT_DIR$/.idea/fluentd.iml" />
17
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/fluentd-1.17.iml" filepath="$PROJECT_DIR$/.idea/modules/fluentd-1.17.iml" />
18
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/http_parser.rb-0.8.iml" filepath="$PROJECT_DIR$/.idea/modules/http_parser.rb-0.8.iml" />
19
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/json-2.7.iml" filepath="$PROJECT_DIR$/.idea/modules/json-2.7.iml" />
20
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/json-2.71.iml" filepath="$PROJECT_DIR$/.idea/modules/json-2.71.iml" />
21
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/msgpack-1.7.iml" filepath="$PROJECT_DIR$/.idea/modules/msgpack-1.7.iml" />
22
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/mutex_m-0.2.iml" filepath="$PROJECT_DIR$/.idea/modules/mutex_m-0.2.iml" />
23
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/new_gem.iml" filepath="$PROJECT_DIR$/.idea/modules/new_gem.iml" />
24
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/power_assert-2.0.iml" filepath="$PROJECT_DIR$/.idea/modules/power_assert-2.0.iml" />
25
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/rake-13.2.iml" filepath="$PROJECT_DIR$/.idea/modules/rake-13.2.iml" />
26
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/rake-13.21.iml" filepath="$PROJECT_DIR$/.idea/modules/rake-13.21.iml" />
27
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/rake-compiler-1.2.iml" filepath="$PROJECT_DIR$/.idea/modules/rake-compiler-1.2.iml" />
28
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/rusty_json_schema-0.15.iml" filepath="$PROJECT_DIR$/.idea/modules/rusty_json_schema-0.15.iml" />
29
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/serverengine-2.3.iml" filepath="$PROJECT_DIR$/.idea/modules/serverengine-2.3.iml" />
30
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/sigdump-0.2.iml" filepath="$PROJECT_DIR$/.idea/modules/sigdump-0.2.iml" />
31
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/specifications.iml" filepath="$PROJECT_DIR$/.idea/modules/specifications.iml" />
32
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/specifications1.iml" filepath="$PROJECT_DIR$/.idea/modules/specifications1.iml" />
33
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/strptime-0.2.iml" filepath="$PROJECT_DIR$/.idea/modules/strptime-0.2.iml" />
34
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/thermite-0.13.iml" filepath="$PROJECT_DIR$/.idea/modules/thermite-0.13.iml" />
35
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/webrick-1.8.iml" filepath="$PROJECT_DIR$/.idea/modules/webrick-1.8.iml" />
36
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/win32-event-0.6.iml" filepath="$PROJECT_DIR$/.idea/modules/win32-event-0.6.iml" />
37
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/win32-ipc-0.7.iml" filepath="$PROJECT_DIR$/.idea/modules/win32-ipc-0.7.iml" />
38
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/yajl-ruby-1.4.iml" filepath="$PROJECT_DIR$/.idea/modules/yajl-ruby-1.4.iml" />
39
+ </modules>
40
+ </component>
41
+ </project>
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/ChangeLog ADDED
@@ -0,0 +1,3 @@
1
+ Release 0.1.0 - 2024/08/02
2
+
3
+ * Project_level: Reseased
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Fluent-plugin-openlineage-light, a plugin for [Fluentd](https://www.fluentd.org)
2
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-openlineage.svg)](https://badge.fury.io/rb/fluent-plugin-openlineage)
3
+
4
+ fluent-plugin-openlineage-light is a Fluentd plugin that verifies if a JSON matches the OpenLineage schema, but doesn't go deeper into the verification. This plugin is ideal for companies that have recently joined the lineage idea but haven't been able to apply all of its feature yet.
5
+ It is intended to be used together with a [Fluentd Application](https://github.com/fluent/fluentd).
6
+
7
+ ## Requirements
8
+
9
+ | fluent-plugin-prometheus | fluentd | ruby |
10
+ |--------------------------|------------|--------|
11
+ | 1.x.y | >= v1.9.1 | >= 2.4 |
12
+ | 1.[0-7].y | >= v0.14.8 | >= 2.1 |
13
+ | 0.x.y | >= v0.12.0 | >= 1.9 |
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'fluent-plugin-openlineage-light'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself using one of the following:
28
+
29
+ $ gem install fluent-plugin-openlineage-light
30
+
31
+ $ fluent-gem install fluent-plugin-openlineage-light
32
+
33
+ ## Usage
34
+
35
+ fluentd-plugin-openlineage-light include only one plugin.
36
+
37
+ - `openlineage` parse plugin
38
+
39
+
40
+
41
+ For any additional information, you can check out Fluentd official documentation on https://docs.fluentd.org/monitoring-fluentd/monitoring-prometheus#example-prometheus-queries# fluentd-openlineage-parser
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs.push("lib", "test")
8
+ t.test_files = FileList["spec/test/**/test_*.rb"]
9
+ t.verbose = true
10
+ t.warning = true
11
+ end
12
+
13
+ task default: [:test]
@@ -0,0 +1,28 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "fluent-plugin-openlineage-light"
6
+ spec.version = "0.1.0"
7
+ spec.authors = ["Pawel Leszczynski"]
8
+ spec.email = ["leszczynski.pawel@gmail.com"]
9
+
10
+ spec.summary = %q{Parser to validate Openlineage events.}
11
+ spec.description = %q{Fluentd parser that validates if JSON is a valid Openlineage event.}
12
+ spec.homepage = "http://openlineage.io"
13
+ spec.license = "Apache-2.0"
14
+
15
+ test_files, files = `git ls-files -z`.split("\x0").partition do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ spec.files = files
19
+ spec.executables = files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = test_files
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "test-unit"
26
+ spec.add_runtime_dependency "fluentd", [">= 0.14.10", "< 2"]
27
+ spec.add_dependency "rusty_json_schema"
28
+ end
@@ -0,0 +1,203 @@
1
+ require "fluent/plugin/parser"
2
+ require 'fluent/plugin/parser_json'
3
+ require 'json'
4
+ require "rusty_json_schema"
5
+
6
+ module Fluent
7
+ module Plugin
8
+ class OpenlineageParser < Fluent::Plugin::JSONParser
9
+ Fluent::Plugin.register_parser("openlineage", self)
10
+
11
+ DEFAULT_SPEC_DIRECTORY="/etc/spec"
12
+
13
+ def configure(conf)
14
+ if conf.has_key?('spec_directory')
15
+ @spec_directory = conf['spec_directory']
16
+ else
17
+ @spec_directory = DEFAULT_SPEC_DIRECTORY
18
+ end
19
+ if (not @spec_directory.end_with?("/"))
20
+ @spec_directory += "/"
21
+ end
22
+ @validate_input_dataset_facets = conf.fetch('validate_input_dataset_facets', false)
23
+ @validate_output_dataset_facets = conf.fetch('validate_output_dataset_facets', false)
24
+ @validate_dataset_facets = conf.fetch('validate_dataset_facets', false)
25
+ @validate_run_facets = conf.fetch('validate_run_facets', true)
26
+ @validate_job_facets = conf.fetch('validate_job_facets', true)
27
+ @schema = load_schema()
28
+ @validator = RustyJSONSchema.build(@schema)
29
+ super
30
+ end
31
+
32
+ # https://docs.fluentd.org/plugin-development/api-plugin-parser
33
+ def parse(text)
34
+ # parse JSON with default JSONParser
35
+ super(text) { | time, json |
36
+ validate_openlineage(json)
37
+ yield time, json
38
+ }
39
+ end
40
+
41
+ private
42
+
43
+ # Check if json contains null values in paths
44
+ def contains_null_values?(json, paths)
45
+ validate_required_fields(json)
46
+ paths.any? { |path| json.dig(*path.split('/')) == nil }
47
+ end
48
+ # Check if json contains required fields
49
+ def validate_required_fields(json)
50
+ required_fields = ["producer", "eventTime", "schemaURL", "eventType", "run", "job"]
51
+ missing_fields = required_fields.select do |field|
52
+ value = json[field]
53
+ value.nil? || value.empty?
54
+ end
55
+ unless missing_fields.empty?
56
+ raise ParserError, "Openlineage validation failed: invalid json provided", 422
57
+ end
58
+ end
59
+
60
+ def validate_openlineage(json)
61
+ if json == nil
62
+ raise ParserError, "Openlineage validation failed: invalid json provided"
63
+ end
64
+
65
+ # Check if json contains required fields
66
+ if contains_null_values?(json, ["RunEvent", "DatasetEvent", "JobEvent"])
67
+ return
68
+ end
69
+
70
+ # https://github.com/driv3r/rusty_json_schema
71
+ # Rust json parser ported to ruby that supports Draft 2020-12
72
+ errors = @validator.validate(json)
73
+
74
+ if errors.join(", ").include? "is not valid under any of the given schemas"
75
+ errors = enrich_oneOf_errors(json)
76
+ end
77
+ if !errors.empty?
78
+ raise ParserError, "Openlineage validation failed: " + errors.join(", ")
79
+ end
80
+ end
81
+
82
+ # Validator returns very generic OneOfNotValid error message
83
+ # We try to find better reason for mismatch with each candidate.
84
+ def enrich_oneOf_errors(json)
85
+ errors = []
86
+ @schema["oneOf"].each { |ref|
87
+ changed_schema = Marshal.load(Marshal.dump(@schema))
88
+ changed_schema.delete("oneOf")
89
+ changed_schema["$ref"] = ref["$ref"]
90
+ validator = RustyJSONSchema.build(changed_schema)
91
+ error = validator.validate(json)
92
+ if !error.empty?
93
+ errors.append("#{ref}: #{error.join(", ")}")
94
+ end
95
+ }
96
+ return errors
97
+ end
98
+
99
+ def load_schema()
100
+ schemaFile = @spec_directory + "OpenLineage.json"
101
+
102
+ if (not File.exist?(schemaFile))
103
+ raise ParserError, "Couldn't find Openlineage.json file within a defined spec directory: " + schemaFile
104
+ end
105
+
106
+ schema = File.read(schemaFile)
107
+ schema = rewrite_schema_to_include_facets(schema)
108
+ return schema
109
+ end
110
+
111
+ # Current Openlineage schema contains references to facets' definitions stored in files
112
+ # in facets directory which are not valid schemas for json_schema.
113
+ # In this step we rewrite Openlineage schema to contain facets definitions within it
114
+ def rewrite_schema_to_include_facets(schema)
115
+ # replace all the refs in schema to local refs
116
+ # "facets/ColumnLineageDatasetFacet.json" -> "#/defs/ColumnLineageDatasetFacet"
117
+ schema = schema.gsub(
118
+ /"facets\/([a-zA-Z]+)\.json"/,
119
+ '"#/$defs/\1"'
120
+ )
121
+ schema_json = JSON.parse(schema)
122
+ facets_path = @spec_directory + "facets/"
123
+
124
+
125
+ # list all the facets
126
+ Dir.glob("#{facets_path}/*.json").each { |facet_file|
127
+ facet_schema = JSON.parse(
128
+ File.read(facet_file).gsub(
129
+ /"https:\/\/openlineage\.io\/spec\/\d-\d-\d\/OpenLineage\.json#\/\$defs\/([a-zA-Z]+)"/,
130
+ '"#/$defs/\1"'
131
+ )
132
+ )
133
+
134
+ facet_schema["properties"].each { |property, ref|
135
+ facet_name = ref["$ref"]&.gsub("#/$defs/", "")
136
+ parents = []
137
+ facet_schema["$defs"][facet_name]["allOf"]&.each { |definition|
138
+ unless definition["$ref"].nil?
139
+ parents.append(definition["$ref"].gsub("#/$defs/", ""))
140
+ end
141
+ }
142
+ parents.each {|parent|
143
+ add_ref_as_parent_property(schema_json, parent, facet_name, property)
144
+ }
145
+ }
146
+ # include facets' definitions within schema
147
+ schema_json["$defs"] = schema_json["$defs"].merge(facet_schema["$defs"])
148
+ }
149
+ return schema_json
150
+ end
151
+
152
+ def add_ref_as_parent_property(schema, parent, facet_name, property)
153
+ getter = find_parent_object_getter(parent)
154
+ if getter.nil?
155
+ return
156
+ end
157
+ properties = getter.call(schema)["properties"] || {}
158
+ properties[property] = {"$ref" => "#/$defs/" + facet_name}
159
+ getter.call(schema)["properties"] = properties
160
+ end
161
+
162
+ # Based on facet name find path to object facets
163
+ def find_parent_object_getter(parent)
164
+ getter = nil
165
+ case parent
166
+ when "JobFacet"
167
+ if @validate_job_facets
168
+ getter = ->(schema) { schema["$defs"]["Job"]["properties"]["facets"] }
169
+ end
170
+ when "RunFacet"
171
+ if @validate_run_facets
172
+ getter = ->(schema) { schema["$defs"]["Run"]["properties"]["facets"] }
173
+ end
174
+ when "DatasetFacet"
175
+ if @validate_dataset_facets
176
+ getter = ->(schema) { schema["$defs"]["Dataset"]["properties"]["facets"] }
177
+ end
178
+ when "OutputDatasetFacet"
179
+ if @validate_output_dataset_facets
180
+ getter = ->(schema) { schema \
181
+ ["$defs"] \
182
+ ["OutputDataset"] \
183
+ ["allOf"].select {|el| el.key?("type") } \
184
+ [0] \
185
+ ["properties"] \
186
+ ["outputFacets"] }
187
+ end
188
+ when "InputDatasetFacet"
189
+ if @validate_input_dataset_facets
190
+ getter = ->(schema) { schema \
191
+ ["$defs"] \
192
+ ["InputDataset"] \
193
+ ["allOf"].select {|el| el.key?("type") } \
194
+ [0] \
195
+ ["properties"] \
196
+ ["inputFacets"] }
197
+ end
198
+ end
199
+ return getter
200
+ end
201
+ end
202
+ end
203
+ end
data/misc/fluent.conf ADDED
@@ -0,0 +1,101 @@
1
+ <source>
2
+ @type http
3
+ port 9880
4
+ <parse>
5
+ @type openlineage
6
+ </parse>
7
+ </source>
8
+
9
+
10
+ # https://docs.fluentd.org/output/http
11
+ <match api.v1.lineage> # tag should match fluentd input endpoint url http://localhost:9880/api/v1/lineage
12
+ @type copy
13
+ <store>
14
+ @type http
15
+ endpoint_url "#{ENV['MARQUEZ_HTTP_ENDPOINT']}"
16
+ content_type application/json
17
+ bulk_request false # available since using https://github.com/fluent-plugins-nursery/fluent-plugin-out-http
18
+ buffered true
19
+ serializer json
20
+ retryable_response_codes 408, 429, 500, 502, 503
21
+
22
+ <buffer>
23
+ @type file
24
+ path /tmp/openlineage/buf/chunk-*
25
+ flush_mode immediate
26
+ </buffer>
27
+ </store>
28
+
29
+ <store>
30
+ @type stdout # testing purpose to demonstrate that copy is working
31
+ </store>
32
+
33
+ # other output stores can be put
34
+ </match>
35
+
36
+
37
+ # source for prometheus metrics
38
+ <source>
39
+ @type forward
40
+ bind 0.0.0.0
41
+ port 24224
42
+ </source>
43
+
44
+ # count the number of incoming records per tag
45
+ <filter company.*>
46
+ @type prometheus
47
+ <metric>
48
+ name fluentd_input_status_num_records_total
49
+ type counter
50
+ desc The total number of incoming records
51
+ <labels>
52
+ tag ${tag}
53
+ hostname ${hostname}
54
+ </labels>
55
+ </metric>
56
+ </filter>
57
+
58
+ # count the number of outgoing records per tag
59
+ <match company.*>
60
+ @type copy
61
+
62
+ <store>
63
+ @type forward
64
+ <server>
65
+ name myserver1
66
+ host 192.168.1.3
67
+ port 24224
68
+ weight 60
69
+ </server>
70
+ </store>
71
+
72
+ <store>
73
+ @type prometheus
74
+ <metric>
75
+ name fluentd_output_status_num_records_total
76
+ type counter
77
+ desc The total number of outgoing records
78
+ <labels>
79
+ tag ${tag}
80
+ hostname ${hostname}
81
+ </labels>
82
+ </metric>
83
+ </store>
84
+
85
+ </match>
86
+
87
+ # expose metrics in prometheus format
88
+ <source>
89
+ @type prometheus
90
+ bind 0.0.0.0
91
+ port 24231
92
+ metrics_path /metrics
93
+ </source>
94
+
95
+ <source>
96
+ @type prometheus_output_monitor
97
+ interval 10
98
+ <labels>
99
+ hostname ${hostname}
100
+ </labels>
101
+ </source>