url_attributes.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Copyright The OpenTelemetry Authors
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from typing import Final
  15. URL_FRAGMENT: Final = "url.fragment"
  16. """
  17. The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component.
  18. """
  19. URL_FULL: Final = "url.full"
  20. """
  21. Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986).
  22. Note: For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment
  23. is not transmitted over HTTP, but if it is known, it SHOULD be included nevertheless.
  24. `url.full` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`.
  25. In such case username and password SHOULD be redacted and attribute's value SHOULD be `https://REDACTED:REDACTED@www.example.com/`.
  26. `url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed).
  27. Sensitive content provided in `url.full` SHOULD be scrubbed when instrumentations can identify it.
  28. ![Development](https://img.shields.io/badge/-development-blue)
  29. Query string values for the following keys SHOULD be redacted by default and replaced by the
  30. value `REDACTED`:
  31. * [`AWSAccessKeyId`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)
  32. * [`Signature`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)
  33. * [`sig`](https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token)
  34. * [`X-Goog-Signature`](https://cloud.google.com/storage/docs/access-control/signed-urls)
  35. This list is subject to change over time.
  36. When a query string value is redacted, the query string key SHOULD still be preserved, e.g.
  37. `https://www.example.com/path?color=blue&sig=REDACTED`.
  38. """
  39. URL_PATH: Final = "url.path"
  40. """
  41. The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component.
  42. Note: Sensitive content provided in `url.path` SHOULD be scrubbed when instrumentations can identify it.
  43. """
  44. URL_QUERY: Final = "url.query"
  45. """
  46. The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component.
  47. Note: Sensitive content provided in `url.query` SHOULD be scrubbed when instrumentations can identify it.
  48. ![Development](https://img.shields.io/badge/-development-blue)
  49. Query string values for the following keys SHOULD be redacted by default and replaced by the value `REDACTED`:
  50. * [`AWSAccessKeyId`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)
  51. * [`Signature`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)
  52. * [`sig`](https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token)
  53. * [`X-Goog-Signature`](https://cloud.google.com/storage/docs/access-control/signed-urls)
  54. This list is subject to change over time.
  55. When a query string value is redacted, the query string key SHOULD still be preserved, e.g.
  56. `q=OpenTelemetry&sig=REDACTED`.
  57. """
  58. URL_SCHEME: Final = "url.scheme"
  59. """
  60. The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.
  61. """