mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
update caddy vendor dependency to v1.0.1
This commit is contained in:
parent
0304cda3e3
commit
9657240197
418
Godeps/LICENSES
generated
418
Godeps/LICENSES
generated
@ -1438,6 +1438,215 @@ THE SOFTWARE.
|
|||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
= vendor/github.com/caddyserver/caddy licensed under: =
|
||||||
|
|
||||||
|
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 {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
= vendor/github.com/caddyserver/caddy/LICENSE.txt e3fc50a88d0a364313df4b21ef20c29e
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
= vendor/github.com/cespare/prettybench licensed under: =
|
= vendor/github.com/cespare/prettybench licensed under: =
|
||||||
|
|
||||||
@ -12461,215 +12670,6 @@ SOFTWARE.
|
|||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
= vendor/github.com/mholt/caddy licensed under: =
|
|
||||||
|
|
||||||
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 {yyyy} {name of copyright owner}
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
= vendor/github.com/mholt/caddy/LICENSE.txt e3fc50a88d0a364313df4b21ef20c29e
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
= vendor/github.com/Microsoft/go-winio licensed under: =
|
= vendor/github.com/Microsoft/go-winio licensed under: =
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@
|
|||||||
"github.com/json-iterator/go",
|
"github.com/json-iterator/go",
|
||||||
"github.com/MakeNowJust/heredoc",
|
"github.com/MakeNowJust/heredoc",
|
||||||
"github.com/matttproud/golang_protobuf_extensions/pbutil",
|
"github.com/matttproud/golang_protobuf_extensions/pbutil",
|
||||||
"github.com/mholt/caddy/caddyfile",
|
"github.com/caddyserver/caddy/caddyfile",
|
||||||
"github.com/modern-go/concurrent",
|
"github.com/modern-go/concurrent",
|
||||||
"github.com/modern-go/reflect2",
|
"github.com/modern-go/reflect2",
|
||||||
"github.com/opencontainers/go-digest",
|
"github.com/opencontainers/go-digest",
|
||||||
|
@ -46,7 +46,7 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
||||||
"//vendor/github.com/mholt/caddy/caddyfile:go_default_library",
|
"//vendor/github.com/caddyserver/caddy/caddyfile:go_default_library",
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/net:go_default_library",
|
"//vendor/k8s.io/utils/net:go_default_library",
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mholt/caddy/caddyfile"
|
"github.com/caddyserver/caddy/caddyfile"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
apps "k8s.io/api/apps/v1"
|
apps "k8s.io/api/apps/v1"
|
||||||
|
6
go.mod
6
go.mod
@ -24,6 +24,7 @@ require (
|
|||||||
github.com/bazelbuild/buildtools v0.0.0-20180226164855-80c7f0d45d7e
|
github.com/bazelbuild/buildtools v0.0.0-20180226164855-80c7f0d45d7e
|
||||||
github.com/blang/semver v3.5.0+incompatible
|
github.com/blang/semver v3.5.0+incompatible
|
||||||
github.com/boltdb/bolt v1.3.1 // indirect
|
github.com/boltdb/bolt v1.3.1 // indirect
|
||||||
|
github.com/caddyserver/caddy v1.0.1
|
||||||
github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c
|
github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c
|
||||||
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5
|
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5
|
||||||
github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b // indirect
|
github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b // indirect
|
||||||
@ -95,7 +96,6 @@ require (
|
|||||||
github.com/magiconair/properties v1.8.1 // indirect
|
github.com/magiconair/properties v1.8.1 // indirect
|
||||||
github.com/mattn/go-shellwords v1.0.5 // indirect
|
github.com/mattn/go-shellwords v1.0.5 // indirect
|
||||||
github.com/mesos/mesos-go v0.0.9 // indirect
|
github.com/mesos/mesos-go v0.0.9 // indirect
|
||||||
github.com/mholt/caddy v1.0.0
|
|
||||||
github.com/miekg/dns v1.1.4
|
github.com/miekg/dns v1.1.4
|
||||||
github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2 // indirect
|
github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2 // indirect
|
||||||
github.com/mistifyio/go-zfs v2.1.1+incompatible // indirect
|
github.com/mistifyio/go-zfs v2.1.1+incompatible // indirect
|
||||||
@ -211,6 +211,7 @@ replace (
|
|||||||
github.com/bifurcation/mint => github.com/bifurcation/mint v0.0.0-20180715133206-93c51c6ce115
|
github.com/bifurcation/mint => github.com/bifurcation/mint v0.0.0-20180715133206-93c51c6ce115
|
||||||
github.com/blang/semver => github.com/blang/semver v3.5.0+incompatible
|
github.com/blang/semver => github.com/blang/semver v3.5.0+incompatible
|
||||||
github.com/boltdb/bolt => github.com/boltdb/bolt v1.3.1
|
github.com/boltdb/bolt => github.com/boltdb/bolt v1.3.1
|
||||||
|
github.com/caddyserver/caddy => github.com/caddyserver/caddy v1.0.1
|
||||||
github.com/cenkalti/backoff => github.com/cenkalti/backoff v2.1.1+incompatible
|
github.com/cenkalti/backoff => github.com/cenkalti/backoff v2.1.1+incompatible
|
||||||
github.com/cespare/prettybench => github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c
|
github.com/cespare/prettybench => github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c
|
||||||
github.com/chai2010/gettext-go => github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5
|
github.com/chai2010/gettext-go => github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5
|
||||||
@ -334,8 +335,7 @@ replace (
|
|||||||
github.com/mattn/go-shellwords => github.com/mattn/go-shellwords v1.0.5
|
github.com/mattn/go-shellwords => github.com/mattn/go-shellwords v1.0.5
|
||||||
github.com/matttproud/golang_protobuf_extensions => github.com/matttproud/golang_protobuf_extensions v1.0.1
|
github.com/matttproud/golang_protobuf_extensions => github.com/matttproud/golang_protobuf_extensions v1.0.1
|
||||||
github.com/mesos/mesos-go => github.com/mesos/mesos-go v0.0.9
|
github.com/mesos/mesos-go => github.com/mesos/mesos-go v0.0.9
|
||||||
github.com/mholt/caddy => github.com/mholt/caddy v1.0.0
|
github.com/mholt/certmagic => github.com/mholt/certmagic v0.6.2-0.20190624175158-6a42ef9fe8c2
|
||||||
github.com/mholt/certmagic => github.com/mholt/certmagic v0.5.0
|
|
||||||
github.com/miekg/dns => github.com/miekg/dns v1.1.4
|
github.com/miekg/dns => github.com/miekg/dns v1.1.4
|
||||||
github.com/mindprince/gonvml => github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2
|
github.com/mindprince/gonvml => github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2
|
||||||
github.com/mistifyio/go-zfs => github.com/mistifyio/go-zfs v2.1.1+incompatible
|
github.com/mistifyio/go-zfs => github.com/mistifyio/go-zfs v2.1.1+incompatible
|
||||||
|
6
go.sum
6
go.sum
@ -49,6 +49,8 @@ github.com/blang/semver v3.5.0+incompatible h1:CGxCgetQ64DKk7rdZ++Vfnb1+ogGNnB17
|
|||||||
github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||||
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
|
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
|
||||||
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
|
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
|
||||||
|
github.com/caddyserver/caddy v1.0.1 h1:oor6ep+8NoJOabpFXhvjqjfeldtw1XSzfISVrbfqTKo=
|
||||||
|
github.com/caddyserver/caddy v1.0.1/go.mod h1:G+ouvOY32gENkJC+jhgl62TyhvqEsFaDiZ4uw0RzP1E=
|
||||||
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||||
github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c h1:p8i+qCbr/dNhS2FoQhRpSS7X5+IlxTa94nRNYXu4fyo=
|
github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c h1:p8i+qCbr/dNhS2FoQhRpSS7X5+IlxTa94nRNYXu4fyo=
|
||||||
github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c/go.mod h1:Xe6ZsFhtM8HrDku0pxJ3/Lr51rwykrzgFwpmTzleatY=
|
github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c/go.mod h1:Xe6ZsFhtM8HrDku0pxJ3/Lr51rwykrzgFwpmTzleatY=
|
||||||
@ -279,9 +281,7 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j
|
|||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
github.com/mesos/mesos-go v0.0.9 h1:w8V5sOEnxzHZ2kAOy273v/HgbolyI6XI+qe5jx5u+Y0=
|
github.com/mesos/mesos-go v0.0.9 h1:w8V5sOEnxzHZ2kAOy273v/HgbolyI6XI+qe5jx5u+Y0=
|
||||||
github.com/mesos/mesos-go v0.0.9/go.mod h1:kPYCMQ9gsOXVAle1OsoY4I1+9kPu8GHkf88aV59fDr4=
|
github.com/mesos/mesos-go v0.0.9/go.mod h1:kPYCMQ9gsOXVAle1OsoY4I1+9kPu8GHkf88aV59fDr4=
|
||||||
github.com/mholt/caddy v1.0.0 h1:KI6RPGih2GFzWRPG8s9clKK28Ns4ZlVMKR/v7mxq6+c=
|
github.com/mholt/certmagic v0.6.2-0.20190624175158-6a42ef9fe8c2/go.mod h1:g4cOPxcjV0oFq3qwpjSA30LReKD8AoIfwAY9VvG35NY=
|
||||||
github.com/mholt/caddy v1.0.0/go.mod h1:PzUpQ3yGCTuEuy0KSxEeB4TZOi3zBZ8BR/zY0RBP414=
|
|
||||||
github.com/mholt/certmagic v0.5.0/go.mod h1:g4cOPxcjV0oFq3qwpjSA30LReKD8AoIfwAY9VvG35NY=
|
|
||||||
github.com/miekg/dns v1.1.4 h1:rCMZsU2ScVSYcAsOXgmC6+AKOK+6pmQTOcw03nfwYV0=
|
github.com/miekg/dns v1.1.4 h1:rCMZsU2ScVSYcAsOXgmC6+AKOK+6pmQTOcw03nfwYV0=
|
||||||
github.com/miekg/dns v1.1.4/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
github.com/miekg/dns v1.1.4/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2 h1:v3dy+FJr7gS7nLgYG7YjX/pmUWuFdudcpnoRNHt2heo=
|
github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2 h1:v3dy+FJr7gS7nLgYG7YjX/pmUWuFdudcpnoRNHt2heo=
|
||||||
|
3
vendor/BUILD
vendored
3
vendor/BUILD
vendored
@ -69,6 +69,7 @@ filegroup(
|
|||||||
"//vendor/github.com/bazelbuild/buildtools/wspace:all-srcs",
|
"//vendor/github.com/bazelbuild/buildtools/wspace:all-srcs",
|
||||||
"//vendor/github.com/beorn7/perks/quantile:all-srcs",
|
"//vendor/github.com/beorn7/perks/quantile:all-srcs",
|
||||||
"//vendor/github.com/blang/semver:all-srcs",
|
"//vendor/github.com/blang/semver:all-srcs",
|
||||||
|
"//vendor/github.com/caddyserver/caddy/caddyfile:all-srcs",
|
||||||
"//vendor/github.com/cespare/prettybench:all-srcs",
|
"//vendor/github.com/cespare/prettybench:all-srcs",
|
||||||
"//vendor/github.com/chai2010/gettext-go/gettext:all-srcs",
|
"//vendor/github.com/chai2010/gettext-go/gettext:all-srcs",
|
||||||
"//vendor/github.com/checkpoint-restore/go-criu/rpc:all-srcs",
|
"//vendor/github.com/checkpoint-restore/go-criu/rpc:all-srcs",
|
||||||
@ -290,8 +291,6 @@ filegroup(
|
|||||||
"//vendor/github.com/marstr/guid:all-srcs",
|
"//vendor/github.com/marstr/guid:all-srcs",
|
||||||
"//vendor/github.com/mattn/go-shellwords:all-srcs",
|
"//vendor/github.com/mattn/go-shellwords:all-srcs",
|
||||||
"//vendor/github.com/matttproud/golang_protobuf_extensions/pbutil:all-srcs",
|
"//vendor/github.com/matttproud/golang_protobuf_extensions/pbutil:all-srcs",
|
||||||
"//vendor/github.com/mholt/caddy/caddyfile:all-srcs",
|
|
||||||
"//vendor/github.com/mholt/caddy/telemetry:all-srcs",
|
|
||||||
"//vendor/github.com/miekg/dns:all-srcs",
|
"//vendor/github.com/miekg/dns:all-srcs",
|
||||||
"//vendor/github.com/mindprince/gonvml:all-srcs",
|
"//vendor/github.com/mindprince/gonvml:all-srcs",
|
||||||
"//vendor/github.com/mistifyio/go-zfs:all-srcs",
|
"//vendor/github.com/mistifyio/go-zfs:all-srcs",
|
||||||
|
@ -8,10 +8,9 @@ go_library(
|
|||||||
"lexer.go",
|
"lexer.go",
|
||||||
"parse.go",
|
"parse.go",
|
||||||
],
|
],
|
||||||
importmap = "k8s.io/kubernetes/vendor/github.com/mholt/caddy/caddyfile",
|
importmap = "k8s.io/kubernetes/vendor/github.com/caddyserver/caddy/caddyfile",
|
||||||
importpath = "github.com/mholt/caddy/caddyfile",
|
importpath = "github.com/caddyserver/caddy/caddyfile",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = ["//vendor/github.com/mholt/caddy/telemetry:go_default_library"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
@ -20,8 +20,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mholt/caddy/telemetry"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Parse parses the input just enough to group tokens, in
|
// Parse parses the input just enough to group tokens, in
|
||||||
@ -353,7 +351,6 @@ func (p *parser) directive() error {
|
|||||||
|
|
||||||
// The directive itself is appended as a relevant token
|
// The directive itself is appended as a relevant token
|
||||||
p.block.Tokens[dir] = append(p.block.Tokens[dir], p.tokens[p.cursor])
|
p.block.Tokens[dir] = append(p.block.Tokens[dir], p.tokens[p.cursor])
|
||||||
telemetry.AppendUnique("directives", dir)
|
|
||||||
|
|
||||||
for p.Next() {
|
for p.Next() {
|
||||||
if p.Val() == "{" {
|
if p.Val() == "{" {
|
27
vendor/github.com/mholt/caddy/telemetry/BUILD
generated
vendored
27
vendor/github.com/mholt/caddy/telemetry/BUILD
generated
vendored
@ -1,27 +0,0 @@
|
|||||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
|
||||||
|
|
||||||
go_library(
|
|
||||||
name = "go_default_library",
|
|
||||||
srcs = [
|
|
||||||
"collection.go",
|
|
||||||
"telemetry.go",
|
|
||||||
],
|
|
||||||
importmap = "k8s.io/kubernetes/vendor/github.com/mholt/caddy/telemetry",
|
|
||||||
importpath = "github.com/mholt/caddy/telemetry",
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
deps = ["//vendor/github.com/google/uuid:go_default_library"],
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "package-srcs",
|
|
||||||
srcs = glob(["**"]),
|
|
||||||
tags = ["automanaged"],
|
|
||||||
visibility = ["//visibility:private"],
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "all-srcs",
|
|
||||||
srcs = [":package-srcs"],
|
|
||||||
tags = ["automanaged"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
310
vendor/github.com/mholt/caddy/telemetry/collection.go
generated
vendored
310
vendor/github.com/mholt/caddy/telemetry/collection.go
generated
vendored
@ -1,310 +0,0 @@
|
|||||||
// Copyright 2015 Light Code Labs, LLC
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
package telemetry
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"hash/fnv"
|
|
||||||
"log"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Init initializes this package so that it may
|
|
||||||
// be used. Do not call this function more than
|
|
||||||
// once. Init panics if it is called more than
|
|
||||||
// once or if the UUID value is empty. Once this
|
|
||||||
// function is called, the rest of the package
|
|
||||||
// may safely be used. If this function is not
|
|
||||||
// called, the collector functions may still be
|
|
||||||
// invoked, but they will be no-ops.
|
|
||||||
//
|
|
||||||
// Any metrics keys that are passed in the second
|
|
||||||
// argument will be permanently disabled for the
|
|
||||||
// lifetime of the process.
|
|
||||||
func Init(instanceID uuid.UUID, disabledMetricsKeys []string) {
|
|
||||||
if enabled {
|
|
||||||
panic("already initialized")
|
|
||||||
}
|
|
||||||
if str := instanceID.String(); str == "" ||
|
|
||||||
str == "00000000-0000-0000-0000-000000000000" {
|
|
||||||
panic("empty UUID")
|
|
||||||
}
|
|
||||||
instanceUUID = instanceID
|
|
||||||
disabledMetricsMu.Lock()
|
|
||||||
for _, key := range disabledMetricsKeys {
|
|
||||||
disabledMetrics[strings.TrimSpace(key)] = false
|
|
||||||
}
|
|
||||||
disabledMetricsMu.Unlock()
|
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// StartEmitting sends the current payload and begins the
|
|
||||||
// transmission cycle for updates. This is the first
|
|
||||||
// update sent, and future ones will be sent until
|
|
||||||
// StopEmitting is called.
|
|
||||||
//
|
|
||||||
// This function is non-blocking (it spawns a new goroutine).
|
|
||||||
//
|
|
||||||
// This function panics if it was called more than once.
|
|
||||||
// It is a no-op if this package was not initialized.
|
|
||||||
func StartEmitting() {
|
|
||||||
if !enabled {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
updateTimerMu.Lock()
|
|
||||||
if updateTimer != nil {
|
|
||||||
updateTimerMu.Unlock()
|
|
||||||
panic("updates already started")
|
|
||||||
}
|
|
||||||
updateTimerMu.Unlock()
|
|
||||||
updateMu.Lock()
|
|
||||||
if updating {
|
|
||||||
updateMu.Unlock()
|
|
||||||
panic("update already in progress")
|
|
||||||
}
|
|
||||||
updateMu.Unlock()
|
|
||||||
go logEmit(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// StopEmitting sends the current payload and terminates
|
|
||||||
// the update cycle. No more updates will be sent.
|
|
||||||
//
|
|
||||||
// It is a no-op if the package was never initialized
|
|
||||||
// or if emitting was never started.
|
|
||||||
//
|
|
||||||
// NOTE: This function is blocking. Run in a goroutine if
|
|
||||||
// you want to guarantee no blocking at critical times
|
|
||||||
// like exiting the program.
|
|
||||||
func StopEmitting() {
|
|
||||||
if !enabled {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
updateTimerMu.Lock()
|
|
||||||
if updateTimer == nil {
|
|
||||||
updateTimerMu.Unlock()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
updateTimerMu.Unlock()
|
|
||||||
logEmit(true) // likely too early; may take minutes to return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset empties the current payload buffer.
|
|
||||||
func Reset() {
|
|
||||||
resetBuffer()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set puts a value in the buffer to be included
|
|
||||||
// in the next emission. It overwrites any
|
|
||||||
// previous value.
|
|
||||||
//
|
|
||||||
// This function is safe for multiple goroutines,
|
|
||||||
// and it is recommended to call this using the
|
|
||||||
// go keyword after the call to SendHello so it
|
|
||||||
// doesn't block crucial code.
|
|
||||||
func Set(key string, val interface{}) {
|
|
||||||
if !enabled || isDisabled(key) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bufferMu.Lock()
|
|
||||||
if _, ok := buffer[key]; !ok {
|
|
||||||
if bufferItemCount >= maxBufferItems {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bufferItemCount++
|
|
||||||
}
|
|
||||||
buffer[key] = val
|
|
||||||
bufferMu.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNested puts a value in the buffer to be included
|
|
||||||
// in the next emission, nested under the top-level key
|
|
||||||
// as subkey. It overwrites any previous value.
|
|
||||||
//
|
|
||||||
// This function is safe for multiple goroutines,
|
|
||||||
// and it is recommended to call this using the
|
|
||||||
// go keyword after the call to SendHello so it
|
|
||||||
// doesn't block crucial code.
|
|
||||||
func SetNested(key, subkey string, val interface{}) {
|
|
||||||
if !enabled || isDisabled(key) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bufferMu.Lock()
|
|
||||||
if topLevel, ok1 := buffer[key]; ok1 {
|
|
||||||
topLevelMap, ok2 := topLevel.(map[string]interface{})
|
|
||||||
if !ok2 {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
log.Printf("[PANIC] Telemetry: key %s is already used for non-nested-map value", key)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, ok3 := topLevelMap[subkey]; !ok3 {
|
|
||||||
// don't exceed max buffer size
|
|
||||||
if bufferItemCount >= maxBufferItems {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bufferItemCount++
|
|
||||||
}
|
|
||||||
topLevelMap[subkey] = val
|
|
||||||
} else {
|
|
||||||
// don't exceed max buffer size
|
|
||||||
if bufferItemCount >= maxBufferItems {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bufferItemCount++
|
|
||||||
buffer[key] = map[string]interface{}{subkey: val}
|
|
||||||
}
|
|
||||||
bufferMu.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append appends value to a list named key.
|
|
||||||
// If key is new, a new list will be created.
|
|
||||||
// If key maps to a type that is not a list,
|
|
||||||
// a panic is logged, and this is a no-op.
|
|
||||||
func Append(key string, value interface{}) {
|
|
||||||
if !enabled || isDisabled(key) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bufferMu.Lock()
|
|
||||||
if bufferItemCount >= maxBufferItems {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// TODO: Test this...
|
|
||||||
bufVal, inBuffer := buffer[key]
|
|
||||||
sliceVal, sliceOk := bufVal.([]interface{})
|
|
||||||
if inBuffer && !sliceOk {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
log.Printf("[PANIC] Telemetry: key %s already used for non-slice value", key)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if sliceVal == nil {
|
|
||||||
buffer[key] = []interface{}{value}
|
|
||||||
} else if sliceOk {
|
|
||||||
buffer[key] = append(sliceVal, value)
|
|
||||||
}
|
|
||||||
bufferItemCount++
|
|
||||||
bufferMu.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
// AppendUnique adds value to a set named key.
|
|
||||||
// Set items are unordered. Values in the set
|
|
||||||
// are unique, but how many times they are
|
|
||||||
// appended is counted. The value must be
|
|
||||||
// hashable.
|
|
||||||
//
|
|
||||||
// If key is new, a new set will be created for
|
|
||||||
// values with that key. If key maps to a type
|
|
||||||
// that is not a counting set, a panic is logged,
|
|
||||||
// and this is a no-op.
|
|
||||||
func AppendUnique(key string, value interface{}) {
|
|
||||||
if !enabled || isDisabled(key) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bufferMu.Lock()
|
|
||||||
bufVal, inBuffer := buffer[key]
|
|
||||||
setVal, setOk := bufVal.(countingSet)
|
|
||||||
if inBuffer && !setOk {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
log.Printf("[PANIC] Telemetry: key %s already used for non-counting-set value", key)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if setVal == nil {
|
|
||||||
// ensure the buffer is not too full, then add new unique value
|
|
||||||
if bufferItemCount >= maxBufferItems {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
buffer[key] = countingSet{value: 1}
|
|
||||||
bufferItemCount++
|
|
||||||
} else if setOk {
|
|
||||||
// unique value already exists, so just increment counter
|
|
||||||
setVal[value]++
|
|
||||||
}
|
|
||||||
bufferMu.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add adds amount to a value named key.
|
|
||||||
// If it does not exist, it is created with
|
|
||||||
// a value of 1. If key maps to a type that
|
|
||||||
// is not an integer, a panic is logged,
|
|
||||||
// and this is a no-op.
|
|
||||||
func Add(key string, amount int) {
|
|
||||||
atomicAdd(key, amount)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increment is a shortcut for Add(key, 1)
|
|
||||||
func Increment(key string) {
|
|
||||||
atomicAdd(key, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// atomicAdd adds amount (negative to subtract)
|
|
||||||
// to key.
|
|
||||||
func atomicAdd(key string, amount int) {
|
|
||||||
if !enabled || isDisabled(key) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bufferMu.Lock()
|
|
||||||
bufVal, inBuffer := buffer[key]
|
|
||||||
intVal, intOk := bufVal.(int)
|
|
||||||
if inBuffer && !intOk {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
log.Printf("[PANIC] Telemetry: key %s already used for non-integer value", key)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !inBuffer {
|
|
||||||
if bufferItemCount >= maxBufferItems {
|
|
||||||
bufferMu.Unlock()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bufferItemCount++
|
|
||||||
}
|
|
||||||
buffer[key] = intVal + amount
|
|
||||||
bufferMu.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
// FastHash hashes input using a 32-bit hashing algorithm
|
|
||||||
// that is fast, and returns the hash as a hex-encoded string.
|
|
||||||
// Do not use this for cryptographic purposes.
|
|
||||||
func FastHash(input []byte) string {
|
|
||||||
h := fnv.New32a()
|
|
||||||
if _, err := h.Write(input); err != nil {
|
|
||||||
log.Println("[ERROR] failed to write bytes: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf("%x", h.Sum32())
|
|
||||||
}
|
|
||||||
|
|
||||||
// isDisabled returns whether key is
|
|
||||||
// a disabled metric key. ALL collection
|
|
||||||
// functions should call this and not
|
|
||||||
// save the value if this returns true.
|
|
||||||
func isDisabled(key string) bool {
|
|
||||||
// for keys that are augmented with data, such as
|
|
||||||
// "tls_client_hello_ua:<hash>", just
|
|
||||||
// check the prefix "tls_client_hello_ua"
|
|
||||||
checkKey := key
|
|
||||||
if idx := strings.Index(key, ":"); idx > -1 {
|
|
||||||
checkKey = key[:idx]
|
|
||||||
}
|
|
||||||
|
|
||||||
disabledMetricsMu.RLock()
|
|
||||||
_, ok := disabledMetrics[checkKey]
|
|
||||||
disabledMetricsMu.RUnlock()
|
|
||||||
return ok
|
|
||||||
}
|
|
428
vendor/github.com/mholt/caddy/telemetry/telemetry.go
generated
vendored
428
vendor/github.com/mholt/caddy/telemetry/telemetry.go
generated
vendored
@ -1,428 +0,0 @@
|
|||||||
// Copyright 2015 Light Code Labs, LLC
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
// Package telemetry implements the client for server-side telemetry
|
|
||||||
// of the network. Functions in this package are synchronous and blocking
|
|
||||||
// unless otherwise specified. For convenience, most functions here do
|
|
||||||
// not return errors, but errors are logged to the standard logger.
|
|
||||||
//
|
|
||||||
// To use this package, first call Init(). You can then call any of the
|
|
||||||
// collection/aggregation functions. Call StartEmitting() when you are
|
|
||||||
// ready to begin sending telemetry updates.
|
|
||||||
//
|
|
||||||
// When collecting metrics (functions like Set, AppendUnique, or Increment),
|
|
||||||
// it may be desirable and even recommended to invoke them in a new
|
|
||||||
// goroutine in case there is lock contention; they are thread-safe (unless
|
|
||||||
// noted), and you may not want them to block the main thread of execution.
|
|
||||||
// However, sometimes blocking may be necessary too; for example, adding
|
|
||||||
// startup metrics to the buffer before the call to StartEmitting().
|
|
||||||
//
|
|
||||||
// This package is designed to be as fast and space-efficient as reasonably
|
|
||||||
// possible, so that it does not disrupt the flow of execution.
|
|
||||||
package telemetry
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"math/rand"
|
|
||||||
"net/http"
|
|
||||||
"runtime"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
)
|
|
||||||
|
|
||||||
// logEmit calls emit and then logs the error, if any.
|
|
||||||
// See docs for emit.
|
|
||||||
func logEmit(final bool) {
|
|
||||||
err := emit(final)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("[ERROR] Sending telemetry: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// emit sends an update to the telemetry server.
|
|
||||||
// Set final to true if this is the last call to emit.
|
|
||||||
// If final is true, no future updates will be scheduled.
|
|
||||||
// Otherwise, the next update will be scheduled.
|
|
||||||
func emit(final bool) error {
|
|
||||||
if !enabled {
|
|
||||||
return fmt.Errorf("telemetry not enabled")
|
|
||||||
}
|
|
||||||
|
|
||||||
// some metrics are updated/set at time of emission
|
|
||||||
setEmitTimeMetrics()
|
|
||||||
|
|
||||||
// ensure only one update happens at a time;
|
|
||||||
// skip update if previous one still in progress
|
|
||||||
updateMu.Lock()
|
|
||||||
if updating {
|
|
||||||
updateMu.Unlock()
|
|
||||||
log.Println("[NOTICE] Skipping this telemetry update because previous one is still working")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
updating = true
|
|
||||||
updateMu.Unlock()
|
|
||||||
defer func() {
|
|
||||||
updateMu.Lock()
|
|
||||||
updating = false
|
|
||||||
updateMu.Unlock()
|
|
||||||
}()
|
|
||||||
|
|
||||||
// terminate any pending update if this is the last one
|
|
||||||
if final {
|
|
||||||
stopUpdateTimer()
|
|
||||||
}
|
|
||||||
|
|
||||||
payloadBytes, err := makePayloadAndResetBuffer()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// this will hold the server's reply
|
|
||||||
var reply Response
|
|
||||||
|
|
||||||
// transmit the payload - use a loop to retry in case of failure
|
|
||||||
for i := 0; i < 4; i++ {
|
|
||||||
if i > 0 && err != nil {
|
|
||||||
// don't hammer the server; first failure might have been
|
|
||||||
// a fluke, but back off more after that
|
|
||||||
log.Printf("[WARNING] Sending telemetry (attempt %d): %v - backing off and retrying", i, err)
|
|
||||||
time.Sleep(time.Duration((i+1)*(i+1)*(i+1)) * time.Second)
|
|
||||||
}
|
|
||||||
|
|
||||||
// send it
|
|
||||||
var resp *http.Response
|
|
||||||
resp, err = httpClient.Post(endpoint+instanceUUID.String(), "application/json", bytes.NewReader(payloadBytes))
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for any special-case response codes
|
|
||||||
if resp.StatusCode == http.StatusGone {
|
|
||||||
// the endpoint has been deprecated and is no longer servicing clients
|
|
||||||
err = fmt.Errorf("telemetry server replied with HTTP %d; upgrade required", resp.StatusCode)
|
|
||||||
if clen := resp.Header.Get("Content-Length"); clen != "0" && clen != "" {
|
|
||||||
bodyBytes, readErr := ioutil.ReadAll(resp.Body)
|
|
||||||
if readErr != nil {
|
|
||||||
log.Printf("[ERROR] Reading response body from server: %v", readErr)
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v - %s", err, bodyBytes)
|
|
||||||
}
|
|
||||||
resp.Body.Close()
|
|
||||||
reply.Stop = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if resp.StatusCode == http.StatusUnavailableForLegalReasons {
|
|
||||||
// the endpoint is unavailable, at least to this client, for legal reasons (!)
|
|
||||||
err = fmt.Errorf("telemetry server replied with HTTP %d %s: please consult the project website and developers for guidance", resp.StatusCode, resp.Status)
|
|
||||||
if clen := resp.Header.Get("Content-Length"); clen != "0" && clen != "" {
|
|
||||||
bodyBytes, readErr := ioutil.ReadAll(resp.Body)
|
|
||||||
if readErr != nil {
|
|
||||||
log.Printf("[ERROR] Reading response body from server: %v", readErr)
|
|
||||||
}
|
|
||||||
err = fmt.Errorf("%v - %s", err, bodyBytes)
|
|
||||||
}
|
|
||||||
resp.Body.Close()
|
|
||||||
reply.Stop = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
// okay, ensure we can interpret the response
|
|
||||||
if ct := resp.Header.Get("Content-Type"); (resp.StatusCode < 300 || resp.StatusCode >= 400) &&
|
|
||||||
!strings.Contains(ct, "json") {
|
|
||||||
err = fmt.Errorf("telemetry server replied with unknown content-type: '%s' and HTTP %s", ct, resp.Status)
|
|
||||||
resp.Body.Close()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// read the response body
|
|
||||||
err = json.NewDecoder(resp.Body).Decode(&reply)
|
|
||||||
resp.Body.Close() // close response body as soon as we're done with it
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the list of enabled/disabled keys, if any
|
|
||||||
for _, key := range reply.EnableKeys {
|
|
||||||
disabledMetricsMu.Lock()
|
|
||||||
// only re-enable this metric if it is temporarily disabled
|
|
||||||
if temp, ok := disabledMetrics[key]; ok && temp {
|
|
||||||
delete(disabledMetrics, key)
|
|
||||||
}
|
|
||||||
disabledMetricsMu.Unlock()
|
|
||||||
}
|
|
||||||
for _, key := range reply.DisableKeys {
|
|
||||||
disabledMetricsMu.Lock()
|
|
||||||
disabledMetrics[key] = true // all remotely-disabled keys are "temporarily" disabled
|
|
||||||
disabledMetricsMu.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure we didn't send the update too soon; if so,
|
|
||||||
// just wait and try again -- this is a special case of
|
|
||||||
// error that we handle differently, as you can see
|
|
||||||
if resp.StatusCode == http.StatusTooManyRequests {
|
|
||||||
if reply.NextUpdate <= 0 {
|
|
||||||
raStr := resp.Header.Get("Retry-After")
|
|
||||||
if ra, err := strconv.Atoi(raStr); err == nil {
|
|
||||||
reply.NextUpdate = time.Duration(ra) * time.Second
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !final {
|
|
||||||
log.Printf("[NOTICE] Sending telemetry: we were too early; waiting %s before trying again", reply.NextUpdate)
|
|
||||||
time.Sleep(reply.NextUpdate)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
} else if resp.StatusCode >= 400 {
|
|
||||||
err = fmt.Errorf("telemetry server returned status code %d", resp.StatusCode)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if err == nil && !final {
|
|
||||||
// (remember, if there was an error, we return it
|
|
||||||
// below, so it WILL get logged if it's supposed to)
|
|
||||||
log.Println("[INFO] Sending telemetry: success")
|
|
||||||
}
|
|
||||||
|
|
||||||
// even if there was an error after all retries, we should
|
|
||||||
// schedule the next update using our default update
|
|
||||||
// interval because the server might be healthy later
|
|
||||||
|
|
||||||
// ensure we won't slam the telemetry server; add a little variance
|
|
||||||
if reply.NextUpdate < 1*time.Second {
|
|
||||||
reply.NextUpdate = defaultUpdateInterval + time.Duration(rand.Int63n(int64(1*time.Minute)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// schedule the next update (if this wasn't the last one and
|
|
||||||
// if the remote server didn't tell us to stop sending)
|
|
||||||
if !final && !reply.Stop {
|
|
||||||
updateTimerMu.Lock()
|
|
||||||
updateTimer = time.AfterFunc(reply.NextUpdate, func() {
|
|
||||||
logEmit(false)
|
|
||||||
})
|
|
||||||
updateTimerMu.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func stopUpdateTimer() {
|
|
||||||
updateTimerMu.Lock()
|
|
||||||
updateTimer.Stop()
|
|
||||||
updateTimer = nil
|
|
||||||
updateTimerMu.Unlock()
|
|
||||||
}
|
|
||||||
|
|
||||||
// setEmitTimeMetrics sets some metrics that should
|
|
||||||
// be recorded just before emitting.
|
|
||||||
func setEmitTimeMetrics() {
|
|
||||||
Set("goroutines", runtime.NumGoroutine())
|
|
||||||
|
|
||||||
var mem runtime.MemStats
|
|
||||||
runtime.ReadMemStats(&mem)
|
|
||||||
SetNested("memory", "heap_alloc", mem.HeapAlloc)
|
|
||||||
SetNested("memory", "sys", mem.Sys)
|
|
||||||
}
|
|
||||||
|
|
||||||
// makePayloadAndResetBuffer prepares a payload
|
|
||||||
// by emptying the collection buffer. It returns
|
|
||||||
// the bytes of the payload to send to the server.
|
|
||||||
// Since the buffer is reset by this, if the
|
|
||||||
// resulting byte slice is lost, the payload is
|
|
||||||
// gone with it.
|
|
||||||
func makePayloadAndResetBuffer() ([]byte, error) {
|
|
||||||
bufCopy := resetBuffer()
|
|
||||||
|
|
||||||
// encode payload in preparation for transmission
|
|
||||||
payload := Payload{
|
|
||||||
InstanceID: instanceUUID.String(),
|
|
||||||
Timestamp: time.Now().UTC(),
|
|
||||||
Data: bufCopy,
|
|
||||||
}
|
|
||||||
return json.Marshal(payload)
|
|
||||||
}
|
|
||||||
|
|
||||||
// resetBuffer makes a local pointer to the buffer,
|
|
||||||
// then resets the buffer by assigning to be a newly-
|
|
||||||
// made value to clear it out, then sets the buffer
|
|
||||||
// item count to 0. It returns the copied pointer to
|
|
||||||
// the original map so the old buffer value can be
|
|
||||||
// used locally.
|
|
||||||
func resetBuffer() map[string]interface{} {
|
|
||||||
bufferMu.Lock()
|
|
||||||
bufCopy := buffer
|
|
||||||
buffer = make(map[string]interface{})
|
|
||||||
bufferItemCount = 0
|
|
||||||
bufferMu.Unlock()
|
|
||||||
return bufCopy
|
|
||||||
}
|
|
||||||
|
|
||||||
// Response contains the body of a response from the
|
|
||||||
// telemetry server.
|
|
||||||
type Response struct {
|
|
||||||
// NextUpdate is how long to wait before the next update.
|
|
||||||
NextUpdate time.Duration `json:"next_update"`
|
|
||||||
|
|
||||||
// Stop instructs the telemetry server to stop sending
|
|
||||||
// telemetry. This would only be done under extenuating
|
|
||||||
// circumstances, but we are prepared for it nonetheless.
|
|
||||||
Stop bool `json:"stop,omitempty"`
|
|
||||||
|
|
||||||
// Error will be populated with an error message, if any.
|
|
||||||
// This field should be empty if the status code is < 400.
|
|
||||||
Error string `json:"error,omitempty"`
|
|
||||||
|
|
||||||
// DisableKeys will contain a list of keys/metrics that
|
|
||||||
// should NOT be sent until further notice. The client
|
|
||||||
// must NOT store these items in its buffer or send them
|
|
||||||
// to the telemetry server while they are disabled. If
|
|
||||||
// this list and EnableKeys have the same value (which is
|
|
||||||
// not supposed to happen), this field should dominate.
|
|
||||||
DisableKeys []string `json:"disable_keys,omitempty"`
|
|
||||||
|
|
||||||
// EnableKeys will contain a list of keys/metrics that
|
|
||||||
// MAY be sent until further notice.
|
|
||||||
EnableKeys []string `json:"enable_keys,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Payload is the data that gets sent to the telemetry server.
|
|
||||||
type Payload struct {
|
|
||||||
// The universally unique ID of the instance
|
|
||||||
InstanceID string `json:"instance_id"`
|
|
||||||
|
|
||||||
// The UTC timestamp of the transmission
|
|
||||||
Timestamp time.Time `json:"timestamp"`
|
|
||||||
|
|
||||||
// The timestamp before which the next update is expected
|
|
||||||
// (NOT populated by client - the server fills this in
|
|
||||||
// before it stores the data)
|
|
||||||
ExpectNext time.Time `json:"expect_next,omitempty"`
|
|
||||||
|
|
||||||
// The metrics
|
|
||||||
Data map[string]interface{} `json:"data,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Int returns the value of the data keyed by key
|
|
||||||
// if it is an integer; otherwise it returns 0.
|
|
||||||
func (p Payload) Int(key string) int {
|
|
||||||
val, _ := p.Data[key]
|
|
||||||
switch p.Data[key].(type) {
|
|
||||||
case int:
|
|
||||||
return val.(int)
|
|
||||||
case float64: // after JSON-decoding, int becomes float64...
|
|
||||||
return int(val.(float64))
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// countingSet implements a set that counts how many
|
|
||||||
// times a key is inserted. It marshals to JSON in a
|
|
||||||
// way such that keys are converted to values next
|
|
||||||
// to their associated counts.
|
|
||||||
type countingSet map[interface{}]int
|
|
||||||
|
|
||||||
// MarshalJSON implements the json.Marshaler interface.
|
|
||||||
// It converts the set to an array so that the values
|
|
||||||
// are JSON object values instead of keys, since keys
|
|
||||||
// are difficult to query in databases.
|
|
||||||
func (s countingSet) MarshalJSON() ([]byte, error) {
|
|
||||||
type Item struct {
|
|
||||||
Value interface{} `json:"value"`
|
|
||||||
Count int `json:"count"`
|
|
||||||
}
|
|
||||||
var list []Item
|
|
||||||
|
|
||||||
for k, v := range s {
|
|
||||||
list = append(list, Item{Value: k, Count: v})
|
|
||||||
}
|
|
||||||
|
|
||||||
return json.Marshal(list)
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
// httpClient should be used for HTTP requests. It
|
|
||||||
// is configured with a timeout for reliability.
|
|
||||||
httpClient = http.Client{
|
|
||||||
Transport: &http.Transport{
|
|
||||||
TLSHandshakeTimeout: 30 * time.Second,
|
|
||||||
DisableKeepAlives: true,
|
|
||||||
},
|
|
||||||
Timeout: 1 * time.Minute,
|
|
||||||
}
|
|
||||||
|
|
||||||
// buffer holds the data that we are building up to send.
|
|
||||||
buffer = make(map[string]interface{})
|
|
||||||
bufferItemCount = 0
|
|
||||||
bufferMu sync.RWMutex // protects both the buffer and its count
|
|
||||||
|
|
||||||
// updating is used to ensure only one
|
|
||||||
// update happens at a time.
|
|
||||||
updating bool
|
|
||||||
updateMu sync.Mutex
|
|
||||||
|
|
||||||
// updateTimer fires off the next update.
|
|
||||||
// If no update is scheduled, this is nil.
|
|
||||||
updateTimer *time.Timer
|
|
||||||
updateTimerMu sync.Mutex
|
|
||||||
|
|
||||||
// disabledMetrics is a set of metric keys
|
|
||||||
// that should NOT be saved to the buffer
|
|
||||||
// or sent to the telemetry server. The value
|
|
||||||
// indicates whether the entry is temporary.
|
|
||||||
// If the value is true, it may be removed if
|
|
||||||
// the metric is re-enabled remotely later. If
|
|
||||||
// the value is false, it is permanent
|
|
||||||
// (presumably because the user explicitly
|
|
||||||
// disabled it) and can only be re-enabled
|
|
||||||
// with user consent.
|
|
||||||
disabledMetrics = make(map[string]bool)
|
|
||||||
disabledMetricsMu sync.RWMutex
|
|
||||||
|
|
||||||
// instanceUUID is the ID of the current instance.
|
|
||||||
// This MUST be set to emit telemetry.
|
|
||||||
// This MUST NOT be openly exposed to clients, for privacy.
|
|
||||||
instanceUUID uuid.UUID
|
|
||||||
|
|
||||||
// enabled indicates whether the package has
|
|
||||||
// been initialized and can be actively used.
|
|
||||||
enabled bool
|
|
||||||
|
|
||||||
// maxBufferItems is the maximum number of items we'll allow
|
|
||||||
// in the buffer before we start dropping new ones, in a
|
|
||||||
// rough (simple) attempt to keep memory use under control.
|
|
||||||
maxBufferItems = 100000
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// endpoint is the base URL to remote telemetry server;
|
|
||||||
// the instance ID will be appended to it.
|
|
||||||
endpoint = "https://telemetry.caddyserver.com/v1/update/"
|
|
||||||
|
|
||||||
// defaultUpdateInterval is how long to wait before emitting
|
|
||||||
// more telemetry data if all retires fail. This value is
|
|
||||||
// only used if the client receives a nonsensical value, or
|
|
||||||
// doesn't send one at all, or if a connection can't be made,
|
|
||||||
// likely indicating a problem with the server. Thus, this
|
|
||||||
// value should be a long duration to help alleviate extra
|
|
||||||
// load on the server.
|
|
||||||
defaultUpdateInterval = 1 * time.Hour
|
|
||||||
)
|
|
5
vendor/modules.txt
vendored
5
vendor/modules.txt
vendored
@ -131,6 +131,8 @@ github.com/bazelbuild/buildtools/wspace
|
|||||||
github.com/beorn7/perks/quantile
|
github.com/beorn7/perks/quantile
|
||||||
# github.com/blang/semver v3.5.0+incompatible => github.com/blang/semver v3.5.0+incompatible
|
# github.com/blang/semver v3.5.0+incompatible => github.com/blang/semver v3.5.0+incompatible
|
||||||
github.com/blang/semver
|
github.com/blang/semver
|
||||||
|
# github.com/caddyserver/caddy v1.0.1 => github.com/caddyserver/caddy v1.0.1
|
||||||
|
github.com/caddyserver/caddy/caddyfile
|
||||||
# github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c => github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c
|
# github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c => github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c
|
||||||
github.com/cespare/prettybench
|
github.com/cespare/prettybench
|
||||||
# github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 => github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5
|
# github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 => github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5
|
||||||
@ -593,9 +595,6 @@ github.com/marstr/guid
|
|||||||
github.com/mattn/go-shellwords
|
github.com/mattn/go-shellwords
|
||||||
# github.com/matttproud/golang_protobuf_extensions v1.0.1 => github.com/matttproud/golang_protobuf_extensions v1.0.1
|
# github.com/matttproud/golang_protobuf_extensions v1.0.1 => github.com/matttproud/golang_protobuf_extensions v1.0.1
|
||||||
github.com/matttproud/golang_protobuf_extensions/pbutil
|
github.com/matttproud/golang_protobuf_extensions/pbutil
|
||||||
# github.com/mholt/caddy v1.0.0 => github.com/mholt/caddy v1.0.0
|
|
||||||
github.com/mholt/caddy/caddyfile
|
|
||||||
github.com/mholt/caddy/telemetry
|
|
||||||
# github.com/miekg/dns v1.1.4 => github.com/miekg/dns v1.1.4
|
# github.com/miekg/dns v1.1.4 => github.com/miekg/dns v1.1.4
|
||||||
github.com/miekg/dns
|
github.com/miekg/dns
|
||||||
# github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2 => github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2
|
# github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2 => github.com/mindprince/gonvml v0.0.0-20171110221305-fee913ce8fb2
|
||||||
|
Loading…
Reference in New Issue
Block a user