Skip to content

Commit

Permalink
add schemas version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova committed Mar 1, 2024
1 parent 6fddf17 commit 7d1bb68
Show file tree
Hide file tree
Showing 76 changed files with 1,274 additions and 566 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -33,12 +32,11 @@
If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes),
it's RECOMMENDED to:
* Use a domain-specific attribute
* Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
"""
* Use a domain-specific attribute
* Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
"""

class ErrorTypeValues(Enum):
OTHER = "_OTHER"
"""A fallback error value to be used when the instrumentation doesn't define a custom value."""

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -30,7 +29,6 @@
Note: The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.
"""


class AndroidStateValues(Enum):
CREATED = "created"
"""Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time."""
Expand All @@ -40,4 +38,3 @@ class AndroidStateValues(Enum):

FOREGROUND = "foreground"
"""Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states."""

Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright The OpenTelemetry Authors
#
# 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.

# pylint: disable=too-many-lines

from enum import Enum


ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = "aspnetcore.diagnostics.exception.result"
"""
ASP.NET Core exception middleware handling result.
"""


ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = "aspnetcore.diagnostics.handler.type"
"""
Full type name of the [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception.
"""


ASPNETCORE_RATE_LIMITING_POLICY = "aspnetcore.rate_limiting.policy"
"""
Rate limiting policy name.
"""


ASPNETCORE_RATE_LIMITING_RESULT = "aspnetcore.rate_limiting.result"
"""
Rate-limiting result, shows whether the lease was acquired or contains a rejection reason.
"""


ASPNETCORE_REQUEST_IS_UNHANDLED = "aspnetcore.request.is_unhandled"
"""
Flag indicating if request was handled by the application pipeline.
"""


ASPNETCORE_ROUTING_IS_FALLBACK = "aspnetcore.routing.is_fallback"
"""
A value that indicates whether the matched route is a fallback route.
"""


ASPNETCORE_ROUTING_MATCH_STATUS = "aspnetcore.routing.match_status"
"""
Match result - success or failure.
"""

class AspnetcoreDiagnosticsExceptionResultValues(Enum):
HANDLED = "handled"
"""Exception was handled by the exception handling middleware."""

UNHANDLED = "unhandled"
"""Exception was not handled by the exception handling middleware."""

SKIPPED = "skipped"
"""Exception handling was skipped because the response had started."""

ABORTED = "aborted"
"""Exception handling didn't run because the request was aborted."""
class AspnetcoreRateLimitingResultValues(Enum):
ACQUIRED = "acquired"
"""Lease was acquired."""

ENDPOINT_LIMITER = "endpoint_limiter"
"""Lease request was rejected by the endpoint limiter."""

GLOBAL_LIMITER = "global_limiter"
"""Lease request was rejected by the global limiter."""

REQUEST_CANCELED = "request_canceled"
"""Lease request was canceled."""
class AspnetcoreRoutingMatchStatusValues(Enum):
SUCCESS = "success"
"""Match succeeded."""

FAILURE = "failure"
"""Match failed."""
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Copyright The OpenTelemetry Authors
#
# 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.

from opentelemetry.metrics import (
Counter,
Histogram,
Meter,
UpDownCounter,
ObservableGauge,
)
from typing import Callable, Sequence

class AspnetcoreMetrics:

"""
Number of exceptions caught by exception handling middleware
"""
@staticmethod
def create_aspnetcore_diagnostics_exceptions(meter: Meter) -> Counter:
return meter.create_counter(
name="aspnetcore.diagnostics.exceptions",
description="Number of exceptions caught by exception handling middleware.",
unit="{exception}",
)


"""
Number of requests that are currently active on the server that hold a rate limiting lease
"""
@staticmethod
def create_aspnetcore_rate_limiting_active_request_leases(meter: Meter) -> UpDownCounter:
return meter.create_up_down_counter(
name="aspnetcore.rate_limiting.active_request_leases",
description="Number of requests that are currently active on the server that hold a rate limiting lease.",
unit="{request}",
)


"""
Number of requests that are currently queued, waiting to acquire a rate limiting lease
"""
@staticmethod
def create_aspnetcore_rate_limiting_queued_requests(meter: Meter) -> UpDownCounter:
return meter.create_up_down_counter(
name="aspnetcore.rate_limiting.queued_requests",
description="Number of requests that are currently queued, waiting to acquire a rate limiting lease.",
unit="{request}",
)


"""
The time the request spent in a queue waiting to acquire a rate limiting lease
"""
@staticmethod
def create_aspnetcore_rate_limiting_request_time_in_queue(meter: Meter) -> Histogram:
return meter.create_histogram(
name="aspnetcore.rate_limiting.request.time_in_queue",
description="The time the request spent in a queue waiting to acquire a rate limiting lease.",
unit="s",
)


"""
The duration of rate limiting lease held by requests on the server
"""
@staticmethod
def create_aspnetcore_rate_limiting_request_lease_duration(meter: Meter) -> Histogram:
return meter.create_histogram(
name="aspnetcore.rate_limiting.request_lease.duration",
description="The duration of rate limiting lease held by requests on the server.",
unit="s",
)


"""
Number of requests that tried to acquire a rate limiting lease
"""
@staticmethod
def create_aspnetcore_rate_limiting_requests(meter: Meter) -> Counter:
return meter.create_counter(
name="aspnetcore.rate_limiting.requests",
description="Number of requests that tried to acquire a rate limiting lease.",
unit="{request}",
)


"""
Number of requests that were attempted to be matched to an endpoint
"""
@staticmethod
def create_aspnetcore_routing_match_attempts(meter: Meter) -> Counter:
return meter.create_counter(
name="aspnetcore.routing.match_attempts",
description="Number of requests that were attempted to be matched to an endpoint.",
unit="{match_attempt}",
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -307,11 +306,9 @@
- [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html).
"""


class AwsEcsLaunchtypeValues(Enum):
EC2 = "ec2"
"""ec2."""

FARGATE = "fargate"
"""fargate."""

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -73,7 +72,6 @@
a TracerProvider.
"""


class CloudPlatformValues(Enum):
ALIBABA_CLOUD_ECS = "alibaba_cloud_ecs"
"""Alibaba Cloud Elastic Compute Service."""
Expand Down Expand Up @@ -155,8 +153,6 @@ class CloudPlatformValues(Enum):

TENCENT_CLOUD_SCF = "tencent_cloud_scf"
"""Tencent Cloud Serverless Cloud Function (SCF)."""


class CloudProviderValues(Enum):
ALIBABA_CLOUD = "alibaba_cloud"
"""Alibaba Cloud."""
Expand All @@ -178,4 +174,3 @@ class CloudProviderValues(Enum):

TENCENT_CLOUD = "tencent_cloud"
"""Tencent Cloud."""

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -45,3 +44,9 @@
The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit.
"""


CODE_STACKTRACE = "code.stacktrace"
"""
A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.
"""

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -56,7 +55,7 @@

DB_CASSANDRA_TABLE = "db.cassandra.table"
"""
The name of the primary table that the operation is acting upon, including the keyspace name (if applicable).
The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable).
Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.
"""

Expand Down Expand Up @@ -134,6 +133,12 @@
"""


DB_INSTANCE_ID = "db.instance.id"
"""
An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`.
"""


DB_JDBC_DRIVER_CLASSNAME = "db.jdbc.driver_classname"
"""
The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect.
Expand All @@ -142,7 +147,7 @@

DB_MONGODB_COLLECTION = "db.mongodb.collection"
"""
The collection being accessed within the database stated in `db.name`.
The MongoDB collection being accessed within the database stated in `db.name`.
"""


Expand Down Expand Up @@ -197,7 +202,6 @@
Username for accessing the database.
"""


class DbCassandraConsistencyLevelValues(Enum):
ALL = "all"
"""all."""
Expand Down Expand Up @@ -231,16 +235,12 @@ class DbCassandraConsistencyLevelValues(Enum):

LOCAL_SERIAL = "local_serial"
"""local_serial."""


class DbCosmosdbConnectionModeValues(Enum):
GATEWAY = "gateway"
"""Gateway (HTTP) connections mode."""

DIRECT = "direct"
"""Direct connection."""


class DbCosmosdbOperationTypeValues(Enum):
INVALID = "Invalid"
"""invalid."""
Expand Down Expand Up @@ -286,8 +286,6 @@ class DbCosmosdbOperationTypeValues(Enum):

EXECUTE_JAVASCRIPT = "ExecuteJavaScript"
"""execute_javascript."""


class DbSystemValues(Enum):
OTHER_SQL = "other_sql"
"""Some other SQL database. Fallback only. See notes."""
Expand Down Expand Up @@ -444,4 +442,3 @@ class DbSystemValues(Enum):

TRINO = "trino"
"""Trino."""

Loading

0 comments on commit 7d1bb68

Please sign in to comment.