diff --git a/NOTICE-fips.txt b/NOTICE-fips.txt index 42aeda2dd2e..0692799d283 100644 --- a/NOTICE-fips.txt +++ b/NOTICE-fips.txt @@ -2821,217 +2821,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -Dependency : go.elastic.co/apm/module/apmelasticsearch/v2 -Version: v2.7.1 -Licence type (autodetected): Apache-2.0 --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmelasticsearch/v2@v2.7.1/LICENSE: - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018 Elasticsearch BV - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -------------------------------------------------------------------------------- Dependency : go.elastic.co/apm/module/apmhttp/v2 Version: v2.7.1 @@ -13747,6 +13536,217 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-------------------------------------------------------------------------------- +Dependency : go.elastic.co/apm/module/apmelasticsearch/v2 +Version: v2.7.1 +Licence type (autodetected): Apache-2.0 +-------------------------------------------------------------------------------- + +Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmelasticsearch/v2@v2.7.1/LICENSE: + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 Elasticsearch BV + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + -------------------------------------------------------------------------------- Dependency : go.elastic.co/ecszap Version: v1.0.3 diff --git a/NOTICE.txt b/NOTICE.txt index b2c96d31e7a..0c7e37e3d13 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -2821,217 +2821,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -Dependency : go.elastic.co/apm/module/apmelasticsearch/v2 -Version: v2.7.1 -Licence type (autodetected): Apache-2.0 --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmelasticsearch/v2@v2.7.1/LICENSE: - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018 Elasticsearch BV - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -------------------------------------------------------------------------------- Dependency : go.elastic.co/apm/module/apmhttp/v2 Version: v2.7.1 @@ -15799,6 +15588,217 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-------------------------------------------------------------------------------- +Dependency : go.elastic.co/apm/module/apmelasticsearch/v2 +Version: v2.7.1 +Licence type (autodetected): Apache-2.0 +-------------------------------------------------------------------------------- + +Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmelasticsearch/v2@v2.7.1/LICENSE: + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 Elasticsearch BV + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + -------------------------------------------------------------------------------- Dependency : go.elastic.co/ecszap Version: v1.0.3 diff --git a/go.mod b/go.mod index 34a4c7308a0..c6cc4cd0a80 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,6 @@ require ( github.com/spf13/cobra v1.10.1 github.com/spf13/pflag v1.0.10 github.com/stretchr/testify v1.11.1 - go.elastic.co/apm/module/apmelasticsearch/v2 v2.7.1 go.elastic.co/apm/module/apmhttp/v2 v2.7.1 go.elastic.co/apm/module/apmotel/v2 v2.7.1 go.elastic.co/apm/v2 v2.7.1 @@ -224,6 +223,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect github.com/zclconf/go-cty v1.15.0 // indirect gitlab.com/digitalxero/go-conventional-commit v1.0.7 // indirect + go.elastic.co/apm/module/apmelasticsearch/v2 v2.7.1 // indirect go.elastic.co/ecszap v1.0.3 // indirect go.elastic.co/go-licence-detector v0.7.0 // indirect go.opentelemetry.io/auto/sdk v1.2.0 // indirect diff --git a/internal/beater/api/mux_intake_rum_test.go b/internal/beater/api/mux_intake_rum_test.go index 68e2b2e216c..290d48d2205 100644 --- a/internal/beater/api/mux_intake_rum_test.go +++ b/internal/beater/api/mux_intake_rum_test.go @@ -45,7 +45,7 @@ func TestOPTIONS(t *testing.T) { cfg := cfgEnabledRUM() cfg.RumConfig.AllowOrigins = []string{"*"} - authenticator, _ := auth.NewAuthenticator(cfg.AgentAuth, logptest.NewTestingLogger(t, "")) + authenticator, _ := auth.NewAuthenticator(cfg.AgentAuth, tracenoop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) lastMiddleware := func(h request.Handler) (request.Handler, error) { return func(c *request.Context) { diff --git a/internal/beater/api/mux_test.go b/internal/beater/api/mux_test.go index f0c0d4ae3a8..4c2a02ab6f7 100644 --- a/internal/beater/api/mux_test.go +++ b/internal/beater/api/mux_test.go @@ -173,7 +173,7 @@ func (m muxBuilder) build(cfg *config.Config) (sdkmetric.Reader, http.Handler, e nopBatchProcessor := modelpb.ProcessBatchFunc(func(context.Context, *modelpb.Batch) error { return nil }) ratelimitStore, _ := ratelimit.NewStore(1000, 1000, 1000) - authenticator, _ := auth.NewAuthenticator(cfg.AgentAuth, m.Logger) + authenticator, _ := auth.NewAuthenticator(cfg.AgentAuth, noop.NewTracerProvider(), m.Logger) r, err := NewMux( cfg, nopBatchProcessor, diff --git a/internal/beater/auth/anonymous_test.go b/internal/beater/auth/anonymous_test.go index 3a825aa79e2..195187449f7 100644 --- a/internal/beater/auth/anonymous_test.go +++ b/internal/beater/auth/anonymous_test.go @@ -25,6 +25,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/trace/noop" "github.com/elastic/apm-server/internal/beater/auth" "github.com/elastic/apm-server/internal/beater/config" @@ -133,7 +134,7 @@ func getAnonymousAuthorizer(t testing.TB, cfg config.AnonymousAgentAuth) auth.Au authenticator, err := auth.NewAuthenticator(config.AgentAuth{ SecretToken: "whatever", // required to enable anonymous auth Anonymous: cfg, - }, logptest.NewTestingLogger(t, "")) + }, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) _, authorizer, err := authenticator.Authenticate(context.Background(), "", "") require.NoError(t, err) diff --git a/internal/beater/auth/apikey_test.go b/internal/beater/auth/apikey_test.go index 80673e6c965..2b706541eef 100644 --- a/internal/beater/auth/apikey_test.go +++ b/internal/beater/auth/apikey_test.go @@ -27,6 +27,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/trace/noop" "github.com/elastic/apm-server/internal/beater/config" "github.com/elastic/apm-server/internal/beater/headers" @@ -52,7 +53,7 @@ func TestAPIKeyAuthorizer(t *testing.T) { esConfig := elasticsearch.DefaultConfig() esConfig.Hosts = elasticsearch.Hosts{srv.URL} apikeyAuthConfig := config.APIKeyAgentAuth{Enabled: true, LimitPerMin: 1, ESConfig: esConfig} - authenticator, err := NewAuthenticator(config.AgentAuth{APIKey: apikeyAuthConfig}, logptest.NewTestingLogger(t, "")) + authenticator, err := NewAuthenticator(config.AgentAuth{APIKey: apikeyAuthConfig}, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) credentials := base64.StdEncoding.EncodeToString([]byte("valid_id:key_value")) diff --git a/internal/beater/auth/authenticator.go b/internal/beater/auth/authenticator.go index d5593435d88..c72b67141f1 100644 --- a/internal/beater/auth/authenticator.go +++ b/internal/beater/auth/authenticator.go @@ -24,6 +24,8 @@ import ( "fmt" "time" + "go.opentelemetry.io/otel/trace" + "github.com/elastic/apm-server/internal/beater/config" "github.com/elastic/apm-server/internal/beater/headers" "github.com/elastic/apm-server/internal/elasticsearch" @@ -141,7 +143,7 @@ type APIKeyAuthenticationDetails struct { // NewAuthenticator creates an Authenticator with config, authenticating // clients with one of the allowed methods. -func NewAuthenticator(cfg config.AgentAuth, logger *logp.Logger) (*Authenticator, error) { +func NewAuthenticator(cfg config.AgentAuth, tp trace.TracerProvider, logger *logp.Logger) (*Authenticator, error) { b := Authenticator{secretToken: cfg.SecretToken} if cfg.APIKey.Enabled { // Do not use apm-server's credentials for API Key requests; @@ -150,7 +152,11 @@ func NewAuthenticator(cfg config.AgentAuth, logger *logp.Logger) (*Authenticator cfg.APIKey.ESConfig.Username = "" cfg.APIKey.ESConfig.Password = "" cfg.APIKey.ESConfig.APIKey = "" - client, err := elasticsearch.NewClient(cfg.APIKey.ESConfig, logger) + client, err := elasticsearch.NewClientParams(elasticsearch.ClientParams{ + Config: cfg.APIKey.ESConfig, + Logger: logger, + TracerProvider: tp, + }) if err != nil { return nil, err } diff --git a/internal/beater/auth/authenticator_test.go b/internal/beater/auth/authenticator_test.go index 2cbb85972cb..954b78974f4 100644 --- a/internal/beater/auth/authenticator_test.go +++ b/internal/beater/auth/authenticator_test.go @@ -25,12 +25,14 @@ import ( "net/http" "net/http/httptest" "strings" + "sync" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.elastic.co/apm/v2/apmtest" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/trace/noop" "github.com/elastic/apm-server/internal/beater/config" "github.com/elastic/apm-server/internal/beater/headers" @@ -39,7 +41,7 @@ import ( ) func TestAuthenticatorNone(t *testing.T) { - authenticator, err := NewAuthenticator(config.AgentAuth{}, logptest.NewTestingLogger(t, "")) + authenticator, err := NewAuthenticator(config.AgentAuth{}, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) // If the server has no configured auth methods, all requests are allowed. @@ -57,7 +59,7 @@ func TestAuthenticatorAuthRequired(t *testing.T) { APIKey: config.APIKeyAgentAuth{Enabled: true, ESConfig: elasticsearch.DefaultConfig()}, } for _, cfg := range []config.AgentAuth{withSecretToken, withAPIKey} { - authenticator, err := NewAuthenticator(cfg, logptest.NewTestingLogger(t, "")) + authenticator, err := NewAuthenticator(cfg, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) details, authz, err := authenticator.Authenticate(context.Background(), "", "") @@ -77,7 +79,7 @@ func TestAuthenticatorAuthRequired(t *testing.T) { } func TestAuthenticatorSecretToken(t *testing.T) { - authenticator, err := NewAuthenticator(config.AgentAuth{SecretToken: "valid"}, logptest.NewTestingLogger(t, "")) + authenticator, err := NewAuthenticator(config.AgentAuth{SecretToken: "valid"}, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) details, authz, err := authenticator.Authenticate(context.Background(), headers.Bearer, "invalid") @@ -115,7 +117,7 @@ func TestAuthenticatorAPIKey(t *testing.T) { esConfig.Hosts = elasticsearch.Hosts{srv.URL} authenticator, err := NewAuthenticator(config.AgentAuth{ APIKey: config.APIKeyAgentAuth{Enabled: true, LimitPerMin: 100, ESConfig: esConfig}, - }, logptest.NewTestingLogger(t, "")) + }, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) credentials := base64.StdEncoding.EncodeToString([]byte("id_value:key_value")) @@ -146,7 +148,7 @@ func TestAuthenticatorAPIKeyErrors(t *testing.T) { esConfig.Backoff.Max = time.Nanosecond authenticator, err := NewAuthenticator(config.AgentAuth{ APIKey: config.APIKeyAgentAuth{Enabled: true, LimitPerMin: 100, ESConfig: esConfig}, - }, logptest.NewTestingLogger(t, "")) + }, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) // Make sure that we can't auth with an empty secret token if secret token auth is not configured, but API Key auth is. @@ -186,7 +188,7 @@ func TestAuthenticatorAPIKeyErrors(t *testing.T) { esConfig.Hosts = elasticsearch.Hosts{srv.URL} authenticator, err = NewAuthenticator(config.AgentAuth{ APIKey: config.APIKeyAgentAuth{Enabled: true, LimitPerMin: 2, ESConfig: esConfig}, - }, logptest.NewTestingLogger(t, "")) + }, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) details, authz, err = authenticator.Authenticate(context.Background(), headers.APIKey, credentials) assert.Equal(t, ErrAuthFailed, err) @@ -206,7 +208,7 @@ func TestAuthenticatorAPIKeyErrors(t *testing.T) { esConfig.Hosts = elasticsearch.Hosts{srv.URL} authenticator, err = NewAuthenticator(config.AgentAuth{ APIKey: config.APIKeyAgentAuth{Enabled: true, LimitPerMin: 100, ESConfig: esConfig}, - }, logptest.NewTestingLogger(t, "")) + }, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) details, authz, err = authenticator.Authenticate(context.Background(), headers.APIKey, credentials) assert.Equal(t, ErrAuthFailed, err) @@ -241,35 +243,35 @@ func TestAuthenticatorAPIKeyCache(t *testing.T) { })) defer srv.Close() + exporter := &manualExporter{} + tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sdktrace.NewSimpleSpanProcessor(exporter))) + esConfig := elasticsearch.DefaultConfig() esConfig.Hosts = elasticsearch.Hosts{srv.URL} apikeyAuthConfig := config.APIKeyAgentAuth{Enabled: true, LimitPerMin: 2, ESConfig: esConfig} - authenticator, err := NewAuthenticator(config.AgentAuth{APIKey: apikeyAuthConfig}, logptest.NewTestingLogger(t, "")) + authenticator, err := NewAuthenticator(config.AgentAuth{APIKey: apikeyAuthConfig}, tp, logptest.NewTestingLogger(t, "")) require.NoError(t, err) - _, spans, _ := apmtest.WithTransaction(func(ctx context.Context) { - for i := 0; i < apikeyAuthConfig.LimitPerMin+1; i++ { - _, _, err := authenticator.Authenticate(ctx, headers.APIKey, validCredentials) - assert.NoError(t, err) - } - }) + for i := 0; i < apikeyAuthConfig.LimitPerMin+1; i++ { + _, _, err := authenticator.Authenticate(context.Background(), headers.APIKey, validCredentials) + assert.NoError(t, err) + } + spans := exporter.payloads() assert.Len(t, spans, 1) - assert.Equal(t, "elasticsearch", spans[0].Subtype) + assert.Equal(t, "Elasticsearch: GET _security/user/_has_privileges", spans[0].Name()) + exporter.clear() - _, spans, _ = apmtest.WithTransaction(func(ctx context.Context) { - // API Key checks are cached based on the API Key ID, not the full credential. - _, _, err := authenticator.Authenticate(ctx, headers.APIKey, validCredentials2) - assert.NoError(t, err) - }) - assert.Len(t, spans, 0) + // API Key checks are cached based on the API Key ID, not the full credential. + _, _, err = authenticator.Authenticate(context.Background(), headers.APIKey, validCredentials2) + assert.NoError(t, err) + assert.Len(t, exporter.payloads(), 0) + exporter.clear() - _, spans, _ = apmtest.WithTransaction(func(ctx context.Context) { - for i := 0; i < apikeyAuthConfig.LimitPerMin+1; i++ { - _, _, err = authenticator.Authenticate(ctx, headers.APIKey, invalidCredentials) - assert.Equal(t, ErrAuthFailed, err) - } - }) - assert.Len(t, spans, 1) + for i := 0; i < apikeyAuthConfig.LimitPerMin+1; i++ { + _, _, err = authenticator.Authenticate(context.Background(), headers.APIKey, invalidCredentials) + assert.Equal(t, ErrAuthFailed, err) + } + assert.Len(t, exporter.payloads(), 1) credentials := base64.StdEncoding.EncodeToString([]byte("id_value3:key_value")) _, _, err = authenticator.Authenticate(context.Background(), headers.APIKey, credentials) @@ -280,7 +282,7 @@ func TestAuthenticatorAnonymous(t *testing.T) { // Anonymous access is only effective when some other auth method is enabled. authenticator, err := NewAuthenticator(config.AgentAuth{ Anonymous: config.AnonymousAgentAuth{Enabled: true}, - }, logptest.NewTestingLogger(t, "")) + }, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) details, authz, err := authenticator.Authenticate(context.Background(), "", "") assert.NoError(t, err) @@ -290,10 +292,38 @@ func TestAuthenticatorAnonymous(t *testing.T) { authenticator, err = NewAuthenticator(config.AgentAuth{ SecretToken: "secret_token", Anonymous: config.AnonymousAgentAuth{Enabled: true}, - }, logptest.NewTestingLogger(t, "")) + }, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) details, authz, err = authenticator.Authenticate(context.Background(), "", "") assert.NoError(t, err) assert.Equal(t, AuthenticationDetails{Method: MethodAnonymous}, details) assert.Equal(t, newAnonymousAuth(nil, nil), authz) } + +type manualExporter struct { + mu sync.Mutex + spans []sdktrace.ReadOnlySpan +} + +func (e *manualExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error { + e.mu.Lock() + defer e.mu.Unlock() + e.spans = append(e.spans, spans...) + return nil +} + +func (e *manualExporter) Shutdown(ctx context.Context) error { + return nil +} + +func (e *manualExporter) payloads() []sdktrace.ReadOnlySpan { + e.mu.Lock() + defer e.mu.Unlock() + return e.spans +} + +func (e *manualExporter) clear() { + e.mu.Lock() + defer e.mu.Unlock() + e.spans = nil +} diff --git a/internal/beater/beater.go b/internal/beater/beater.go index e90c03b8ed8..445886ed79e 100644 --- a/internal/beater/beater.go +++ b/internal/beater/beater.go @@ -368,7 +368,7 @@ func (s *Runner) Run(ctx context.Context) error { // Create the runServer function. We start with newBaseRunServer, and then // wrap depending on the configuration in order to inject behaviour. runServer := newBaseRunServer(s.listener) - authenticator, err := auth.NewAuthenticator(s.config.AgentAuth, s.logger) + authenticator, err := auth.NewAuthenticator(s.config.AgentAuth, s.tracerProvider, s.logger) if err != nil { return err } @@ -663,7 +663,11 @@ func (s *Runner) waitReady( if err != nil { return err } - esOutputClient, err = elasticsearch.NewClient(esConfig, s.logger) + esOutputClient, err = elasticsearch.NewClientParams(elasticsearch.ClientParams{ + Config: esConfig, + Logger: s.logger, + TracerProvider: s.tracerProvider, + }) if err != nil { return err } diff --git a/internal/beater/interceptors/auth_test.go b/internal/beater/interceptors/auth_test.go index 89db01b5ffe..20070d7fd16 100644 --- a/internal/beater/interceptors/auth_test.go +++ b/internal/beater/interceptors/auth_test.go @@ -25,6 +25,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/trace/noop" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" @@ -117,7 +118,7 @@ func TestUnaryAuthenticator(t *testing.T) { } func TestAuthorizationMetadataAuthenticator(t *testing.T) { - authenticator, err := auth.NewAuthenticator(config.AgentAuth{SecretToken: "abc123"}, logptest.NewTestingLogger(t, "")) + authenticator, err := auth.NewAuthenticator(config.AgentAuth{SecretToken: "abc123"}, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) require.NoError(t, err) interceptor := interceptors.Auth(authenticator) diff --git a/internal/beater/otlp/http_test.go b/internal/beater/otlp/http_test.go index 97c97782848..eb4e11a1dd4 100644 --- a/internal/beater/otlp/http_test.go +++ b/internal/beater/otlp/http_test.go @@ -170,7 +170,7 @@ func newHTTPServer(t *testing.T, batchProcessor modelpb.BatchProcessor) (string, )) mp := sdkmetric.NewMeterProvider(sdkmetric.WithReader(reader)) cfg := &config.Config{} - auth, _ := auth.NewAuthenticator(cfg.AgentAuth, logptest.NewTestingLogger(t, "")) + auth, _ := auth.NewAuthenticator(cfg.AgentAuth, noop.NewTracerProvider(), logptest.NewTestingLogger(t, "")) ratelimitStore, _ := ratelimit.NewStore(1000, 1000, 1000) router, err := api.NewMux( cfg, diff --git a/internal/beater/tracing.go b/internal/beater/tracing.go index 9f6f8c7147e..106c3e9e3e9 100644 --- a/internal/beater/tracing.go +++ b/internal/beater/tracing.go @@ -42,7 +42,7 @@ func newTracerServer(cfg *config.Config, listener net.Listener, logger *logp.Log if err != nil { return nil, err } - authenticator, err := auth.NewAuthenticator(config.AgentAuth{}, logger) + authenticator, err := auth.NewAuthenticator(config.AgentAuth{}, nooptrace.NewTracerProvider(), logger) if err != nil { return nil, err } diff --git a/internal/elasticsearch/client.go b/internal/elasticsearch/client.go index d3dbcf59aa9..af51bf85976 100644 --- a/internal/elasticsearch/client.go +++ b/internal/elasticsearch/client.go @@ -24,9 +24,7 @@ import ( "io" "net/http" - "go.elastic.co/apm/module/apmelasticsearch/v2" "go.opentelemetry.io/otel/trace" - "go.opentelemetry.io/otel/trace/noop" "github.com/elastic/apm-server/internal/version" "github.com/elastic/elastic-agent-libs/logp" @@ -114,12 +112,7 @@ func NewClientParams(args ClientParams) (*Client, error) { apikey = base64.StdEncoding.EncodeToString([]byte(args.Config.APIKey)) } - if _, ok := args.TracerProvider.(noop.TracerProvider); !ok { - // only enable tracing with apm agent if a non-noop tracerprovider - // has been passed. - // TODO replace apmelasticsearch with otel (https://github.com/elastic/apm-server/issues/18949) - transport = apmelasticsearch.WrapRoundTripper(transport) - } + transport = WrapRoundTripper(transport, args.TracerProvider) return elastictransport.New(elastictransport.Config{ APIKey: apikey, diff --git a/internal/elasticsearch/tracing.go b/internal/elasticsearch/tracing.go new file mode 100644 index 00000000000..dab50176575 --- /dev/null +++ b/internal/elasticsearch/tracing.go @@ -0,0 +1,94 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package elasticsearch + +import ( + "net/http" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/noop" +) + +func WrapRoundTripper(r http.RoundTripper, tp trace.TracerProvider) http.RoundTripper { + if tp == nil { + tp = noop.NewTracerProvider() + } + rt := &roundTripper{ + r: r, + tracer: tp.Tracer("github.com/elastic/apm-server/internal/elasticsearch"), + } + return rt +} + +type roundTripper struct { + r http.RoundTripper + tracer trace.Tracer +} + +func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + name := requestName(req) + ctx, span := r.tracer.Start(req.Context(), name, trace.WithSpanKind(trace.SpanKindClient)) + defer span.End() + req = req.WithContext(ctx) + + propagation.TraceContext{}.Inject(ctx, propagation.HeaderCarrier(req.Header)) + + span.SetAttributes( + attribute.String("db.type", "elasticsearch"), + attribute.String("db.system", "elasticsearch"), + ) + + resp, err := r.r.RoundTrip(req) + + if resp != nil { + span.SetAttributes(attribute.Int("http.response.status_code", resp.StatusCode)) + + if clusterName := resp.Header.Get("X-Found-Handling-Cluster"); clusterName != "" { + span.SetAttributes(attribute.String("db.instance", clusterName)) + } + } + + return resp, err +} + +// CloseIdleConnections calls r.r.CloseIdleConnections if the method exists. +func (r *roundTripper) CloseIdleConnections() { + type closeIdler interface { + CloseIdleConnections() + } + if tr, ok := r.r.(closeIdler); ok { + tr.CloseIdleConnections() + } +} + +func requestName(req *http.Request) string { + const prefix = "Elasticsearch:" + path := strings.TrimLeft(req.URL.Path, "/") + + var b strings.Builder + b.Grow(len(prefix) + 1 + len(req.Method) + 1 + len(path)) + b.WriteString(prefix) + b.WriteRune(' ') + b.WriteString(req.Method) + b.WriteRune(' ') + b.WriteString(path) + return b.String() +}