-
Notifications
You must be signed in to change notification settings - Fork 859
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement error.type attribute in HTTP semconv (#9466)
- Loading branch information
Mateusz Rzeszutek
authored
Oct 10, 2023
1 parent
64e1554
commit b6dd11a
Showing
25 changed files
with
540 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpStatusCodeConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.api.instrumenter.http; | ||
|
||
// https://github.com/open-telemetry/semantic-conventions/blob/v1.21.0/docs/http/http-spans.md#status | ||
enum HttpStatusCodeConverter { | ||
SERVER { | ||
@Override | ||
boolean isError(int responseStatusCode) { | ||
return responseStatusCode >= 500 | ||
|| | ||
// invalid status code, does not exists | ||
responseStatusCode < 100; | ||
} | ||
}, | ||
CLIENT { | ||
@Override | ||
boolean isError(int responseStatusCode) { | ||
return responseStatusCode >= 400 | ||
|| | ||
// invalid status code, does not exists | ||
responseStatusCode < 100; | ||
} | ||
}; | ||
|
||
abstract boolean isError(int responseStatusCode); | ||
} |
34 changes: 0 additions & 34 deletions
34
...main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpStatusConverter.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
.../java/io/opentelemetry/instrumentation/api/instrumenter/http/internal/HttpAttributes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.api.instrumenter.http.internal; | ||
|
||
import static io.opentelemetry.api.common.AttributeKey.stringKey; | ||
|
||
import io.opentelemetry.api.common.AttributeKey; | ||
|
||
/** | ||
* This class is internal and is hence not for public use. Its APIs are unstable and can change at | ||
* any time. | ||
*/ | ||
public final class HttpAttributes { | ||
|
||
// FIXME: remove this class and replace its usages with SemanticAttributes once schema 1.22 is | ||
// released | ||
|
||
public static final AttributeKey<String> ERROR_TYPE = stringKey("error.type"); | ||
|
||
private HttpAttributes() {} | ||
} |
94 changes: 0 additions & 94 deletions
94
...io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientStatusConverterTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.