You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: semantic-convention-utils/src/main/java/org/hypertrace/semantic/convention/utils/http/HttpSemanticConventionUtils.java
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -551,6 +551,24 @@ public static Optional<String> getHttpMethod(Event event) {
551
551
returnOptional.empty();
552
552
}
553
553
554
+
/**
555
+
* Returns the HTTP scheme associated with the given {@link Event}. The scheme is determined as
556
+
* follows:
557
+
* <ol>
558
+
* <li>If the event has an attribute like {@code http.url} that contains a full URL, the scheme
559
+
* from that URL is returned if it is https.
560
+
* <li>If the scheme from the full URL is not 'https', then other attributes like
561
+
* {@code x-forwarded-proto}, {@code forwarded}, {@code http.scheme} are checked. If any of
562
+
* these has the value 'https', then that is returned.
563
+
* <li>If none of the above steps yield a scheme of 'https', then the scheme from the full URL
564
+
* (which should be 'http') is returned.
565
+
* <li>If the event does not have a full URL attribute, then the other attributes are checked for
566
+
* the scheme.
567
+
* </ol>
568
+
*
569
+
* @param event the event to extract the scheme from
570
+
* @return an {@link Optional} containing the scheme if it could be determined, empty otherwise
0 commit comments