Skip to content

Commit 94f1a47

Browse files
robbkiddhannahramadankaylareopelle
committed
generate separate attrs and metrics files
Each root namespace gets separate attributes and metrics files. Include examples of possible values for attributes. Include a usage example of the template attributes as lambdas. Fix links in doc comments referencing stable constants. Co-authored-by: Hannah Ramadan <[email protected]> Co-authored-by: Kayla Reopelle <[email protected]>
1 parent 6765934 commit 94f1a47

File tree

93 files changed

+3986
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3986
-285
lines changed

semantic_conventions/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ end
5151
task generate: %i[update_gem_version check_out_semconv_version] do
5252
puts "\n+++ Removing previously generated semantic conventions code.\n"
5353
semconv_output_dir
54-
.glob('*.rb')
54+
.glob('**/*.rb')
5555
.then { |files| FileUtils.rm(files) }
5656

5757
puts "\n+++ Generating semantic conventions code.\n"

semantic_conventions/lib/opentelemetry/semconv/aspnetcore.rb renamed to semantic_conventions/lib/opentelemetry/semconv/aspnetcore/attributes.rb

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,72 @@ module ASPNETCORE
2626
# ASP.NET Core exception middleware handling result
2727
#
2828
# @note Stability Level: stable
29+
#
30+
# @example Sample Values
31+
# handled
32+
# unhandled
33+
#
2934
ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = 'aspnetcore.diagnostics.exception.result'
3035

3136
# Full type name of the [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception.
3237
#
3338
# @note Stability Level: stable
39+
#
40+
# @example Sample Values
41+
# Contoso.MyHandler
42+
#
3443
ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = 'aspnetcore.diagnostics.handler.type'
3544

3645
# Rate limiting policy name.
3746
#
3847
# @note Stability Level: stable
48+
#
49+
# @example Sample Values
50+
# fixed
51+
# sliding
52+
# token
53+
#
3954
ASPNETCORE_RATE_LIMITING_POLICY = 'aspnetcore.rate_limiting.policy'
4055

4156
# Rate-limiting result, shows whether the lease was acquired or contains a rejection reason
4257
#
4358
# @note Stability Level: stable
59+
#
60+
# @example Sample Values
61+
# acquired
62+
# request_canceled
63+
#
4464
ASPNETCORE_RATE_LIMITING_RESULT = 'aspnetcore.rate_limiting.result'
4565

4666
# Flag indicating if request was handled by the application pipeline.
4767
#
4868
# @note Stability Level: stable
69+
#
70+
# @example Sample Values
71+
# true
72+
#
4973
ASPNETCORE_REQUEST_IS_UNHANDLED = 'aspnetcore.request.is_unhandled'
5074

5175
# A value that indicates whether the matched route is a fallback route.
5276
#
5377
# @note Stability Level: stable
78+
#
79+
# @example Sample Values
80+
# true
81+
#
5482
ASPNETCORE_ROUTING_IS_FALLBACK = 'aspnetcore.routing.is_fallback'
5583

5684
# Match result - success or failure
5785
#
5886
# @note Stability Level: stable
87+
#
88+
# @example Sample Values
89+
# success
90+
# failure
91+
#
5992
ASPNETCORE_ROUTING_MATCH_STATUS = 'aspnetcore.routing.match_status'
6093

6194
# @!endgroup
62-
63-
# @!group Metric Names
64-
# @!endgroup
6595
end
6696
end
6797
end
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright The OpenTelemetry Authors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# SPDX-License-Identifier: Apache-2.0
18+
#
19+
# This file was autogenerated. Do not edit it by hand.
20+
21+
module OpenTelemetry
22+
module SemConv
23+
module ASPNETCORE
24+
# @!group Metrics Names
25+
26+
# Number of exceptions caught by exception handling middleware.
27+
#
28+
# Meter name: `Microsoft.AspNetCore.Diagnostics`; Added in: ASP.NET Core 8.0
29+
#
30+
# @note Stability Level: stable
31+
ASPNETCORE_DIAGNOSTICS_EXCEPTIONS = 'aspnetcore.diagnostics.exceptions'
32+
33+
# Number of requests that are currently active on the server that hold a rate limiting lease.
34+
#
35+
# Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0
36+
#
37+
# @note Stability Level: stable
38+
ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES = 'aspnetcore.rate_limiting.active_request_leases'
39+
40+
# Number of requests that are currently queued, waiting to acquire a rate limiting lease.
41+
#
42+
# Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0
43+
#
44+
# @note Stability Level: stable
45+
ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS = 'aspnetcore.rate_limiting.queued_requests'
46+
47+
# The time the request spent in a queue waiting to acquire a rate limiting lease.
48+
#
49+
# Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0
50+
#
51+
# @note Stability Level: stable
52+
ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE = 'aspnetcore.rate_limiting.request.time_in_queue'
53+
54+
# The duration of rate limiting lease held by requests on the server.
55+
#
56+
# Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0
57+
#
58+
# @note Stability Level: stable
59+
ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION = 'aspnetcore.rate_limiting.request_lease.duration'
60+
61+
# Number of requests that tried to acquire a rate limiting lease.
62+
#
63+
# Requests could be:
64+
#
65+
# - Rejected by global or endpoint rate limiting policies
66+
# - Canceled while waiting for the lease.
67+
#
68+
# Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0
69+
#
70+
# @note Stability Level: stable
71+
ASPNETCORE_RATE_LIMITING_REQUESTS = 'aspnetcore.rate_limiting.requests'
72+
73+
# Number of requests that were attempted to be matched to an endpoint.
74+
#
75+
# Meter name: `Microsoft.AspNetCore.Routing`; Added in: ASP.NET Core 8.0
76+
#
77+
# @note Stability Level: stable
78+
ASPNETCORE_ROUTING_MATCH_ATTEMPTS = 'aspnetcore.routing.match_attempts'
79+
80+
# @!endgroup
81+
end
82+
end
83+
end

semantic_conventions/lib/opentelemetry/semconv/client.rb renamed to semantic_conventions/lib/opentelemetry/semconv/client/attributes.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,26 @@ module CLIENT
2828
# When observed from the server side, and when communicating through an intermediary, `client.address` SHOULD represent the client address behind any intermediaries, for example proxies, if it's available.
2929
#
3030
# @note Stability Level: stable
31+
#
32+
# @example Sample Values
33+
# client.example.com
34+
# 10.1.2.80
35+
# /tmp/my.sock
36+
#
3137
CLIENT_ADDRESS = 'client.address'
3238

3339
# Client port number.
3440
#
3541
# When observed from the server side, and when communicating through an intermediary, `client.port` SHOULD represent the client port behind any intermediaries, for example proxies, if it's available.
3642
#
3743
# @note Stability Level: stable
44+
#
45+
# @example Sample Values
46+
# 65123
47+
#
3848
CLIENT_PORT = 'client.port'
3949

4050
# @!endgroup
41-
42-
# @!group Metric Names
43-
# @!endgroup
4451
end
4552
end
4653
end

semantic_conventions/lib/opentelemetry/semconv/error.rb renamed to semantic_conventions/lib/opentelemetry/semconv/error/attributes.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,16 @@ module ERROR
4646
# - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
4747
#
4848
# @note Stability Level: stable
49+
#
50+
# @example Sample Values
51+
# timeout
52+
# java.net.UnknownHostException
53+
# server_certificate_invalid
54+
# 500
55+
#
4956
ERROR_TYPE = 'error.type'
5057

5158
# @!endgroup
52-
53-
# @!group Metric Names
54-
# @!endgroup
5559
end
5660
end
5761
end

semantic_conventions/lib/opentelemetry/semconv/incubating/exception.rb renamed to semantic_conventions/lib/opentelemetry/semconv/exception/attributes.rb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
module OpenTelemetry
2222
module SemConv
23-
module Incubating
2423
module EXCEPTION
2524
# @!group Attribute Names
2625

@@ -44,36 +43,38 @@ module EXCEPTION
4443
# clear whether the exception will escape.
4544
#
4645
# @note Stability Level: stable
47-
#
48-
# @deprecated Now available in the stable namespace at {OpenTelemetry::SemConv::Exception::EXCEPTION_ESCAPED}.
4946
EXCEPTION_ESCAPED = 'exception.escaped'
5047

5148
# The exception message.
5249
#
5350
# @note Stability Level: stable
5451
#
55-
# @deprecated Now available in the stable namespace at {OpenTelemetry::SemConv::Exception::EXCEPTION_MESSAGE}.
52+
# @example Sample Values
53+
# Division by zero
54+
# Can't convert 'int' object to str implicitly
55+
#
5656
EXCEPTION_MESSAGE = 'exception.message'
5757

5858
# 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.
5959
#
6060
# @note Stability Level: stable
6161
#
62-
# @deprecated Now available in the stable namespace at {OpenTelemetry::SemConv::Exception::EXCEPTION_STACKTRACE}.
62+
# @example Sample Values
63+
# Exception in thread "main" java.lang.RuntimeException: Test exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5)
64+
#
6365
EXCEPTION_STACKTRACE = 'exception.stacktrace'
6466

6567
# The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.
6668
#
6769
# @note Stability Level: stable
6870
#
69-
# @deprecated Now available in the stable namespace at {OpenTelemetry::SemConv::Exception::EXCEPTION_TYPE}.
71+
# @example Sample Values
72+
# java.net.ConnectException
73+
# OSError
74+
#
7075
EXCEPTION_TYPE = 'exception.type'
7176

7277
# @!endgroup
73-
74-
# @!group Metric Names
75-
# @!endgroup
7678
end
7779
end
78-
end
7980
end

semantic_conventions/lib/opentelemetry/semconv/http.rb renamed to semantic_conventions/lib/opentelemetry/semconv/http/attributes.rb

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,24 @@ module SemConv
2323
module HTTP
2424
# @!group Attribute Names
2525

26+
# Must be called with a key for the full attribute name. See notes below about the expectations
27+
# for the state of the key.
28+
#
29+
# @example Usage
30+
# HTTP_REQUEST_HEADER_LAMBDA.call('some-cool-key') #=> 'http.request.header.some-cool-key'
31+
#
2632
# HTTP request headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.
2733
#
2834
# Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.
2935
# The `User-Agent` header is already captured in the `user_agent.original` attribute. Users MAY explicitly configure instrumentations to capture them even though it is not recommended.
3036
# The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.
3137
#
3238
# @note Stability Level: stable
39+
#
40+
# @example Sample Values
41+
# http.request.header.content-type=["application/json"]
42+
# http.request.header.x-forwarded-for=["1.2.3.4", "1.2.3.5"]
43+
#
3344
HTTP_REQUEST_HEADER_LAMBDA = ->(key) { "http.request.header.#{key}" }
3445

3546
# HTTP request method.
@@ -50,32 +61,63 @@ module HTTP
5061
# Tracing instrumentations that do so, MUST also set `http.request.method_original` to the original value.
5162
#
5263
# @note Stability Level: stable
64+
#
65+
# @example Sample Values
66+
# GET
67+
# POST
68+
# HEAD
69+
#
5370
HTTP_REQUEST_METHOD = 'http.request.method'
5471

5572
# Original HTTP method sent by the client in the request line.
5673
#
5774
# @note Stability Level: stable
75+
#
76+
# @example Sample Values
77+
# GeT
78+
# ACL
79+
# foo
80+
#
5881
HTTP_REQUEST_METHOD_ORIGINAL = 'http.request.method_original'
5982

6083
# The ordinal number of request resending attempt (for any reason, including redirects).
6184
#
6285
# The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).
6386
#
6487
# @note Stability Level: stable
88+
#
89+
# @example Sample Values
90+
# 3
91+
#
6592
HTTP_REQUEST_RESEND_COUNT = 'http.request.resend_count'
6693

94+
# Must be called with a key for the full attribute name. See notes below about the expectations
95+
# for the state of the key.
96+
#
97+
# @example Usage
98+
# HTTP_RESPONSE_HEADER_LAMBDA.call('some-cool-key') #=> 'http.response.header.some-cool-key'
99+
#
67100
# HTTP response headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.
68101
#
69102
# Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.
70103
# Users MAY explicitly configure instrumentations to capture them even though it is not recommended.
71104
# The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.
72105
#
73106
# @note Stability Level: stable
107+
#
108+
# @example Sample Values
109+
# http.response.header.content-type=["application/json"]
110+
# http.response.header.my-custom-header=["abc", "def"]
111+
#
74112
HTTP_RESPONSE_HEADER_LAMBDA = ->(key) { "http.response.header.#{key}" }
75113

76114
# [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
77115
#
78116
# @note Stability Level: stable
117+
#
118+
# @example Sample Values
119+
# 200
120+
#
79121
HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code'
80122

81123
# The matched route, that is, the path template in the format used by the respective server framework.
@@ -84,12 +126,14 @@ module HTTP
84126
# SHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.
85127
#
86128
# @note Stability Level: stable
129+
#
130+
# @example Sample Values
131+
# /users/:userID?
132+
# {controller}/{action}/{id?}
133+
#
87134
HTTP_ROUTE = 'http.route'
88135

89136
# @!endgroup
90-
91-
# @!group Metric Names
92-
# @!endgroup
93137
end
94138
end
95139
end

0 commit comments

Comments
 (0)