Skip to content

Commit 19e447e

Browse files
pchilaTylerHelmuth
andauthored
[pkg/ottl] add User Agent parsing (#34172)
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> Added a new ottl converter `UserAgent`: it parses an input string and matches against a [set of known UA regexes](https://github.com/ua-parser/uap-core/blob/master/regexes.yaml) to correctly identify user agent and its version **Link to tracking Issue:** #32434 **Testing:** Unit tests, E2E tests **Documentation:** <Describe the documentation added.> Added UserAgent description in `pkg/ottl/ottlfuncs/README.md` --------- Co-authored-by: Tyler Helmuth <[email protected]>
1 parent b7b2d93 commit 19e447e

File tree

44 files changed

+382
-0
lines changed

Some content is hidden

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

44 files changed

+382
-0
lines changed

.chloggen/user-agent-parsing.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: pkg/ottl
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Introduce `UserAgent` converter to parse UserAgent strings
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [32434]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

cmd/otelcontribcol/go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@ require (
738738
github.com/tinylib/msgp v1.2.0 // indirect
739739
github.com/tklauser/go-sysconf v0.3.14 // indirect
740740
github.com/tklauser/numcpus v0.8.0 // indirect
741+
github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect
741742
github.com/valyala/fastjson v1.6.4 // indirect
742743
github.com/vincent-petithory/dataurl v1.0.0 // indirect
743744
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852 // indirect

cmd/otelcontribcol/go.sum

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/oteltestbedcol/go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ require (
222222
github.com/tinylib/msgp v1.2.0 // indirect
223223
github.com/tklauser/go-sysconf v0.3.12 // indirect
224224
github.com/tklauser/numcpus v0.6.1 // indirect
225+
github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect
225226
github.com/valyala/fastjson v1.6.4 // indirect
226227
github.com/vultr/govultr/v2 v2.17.2 // indirect
227228
github.com/yusufpapurcu/wmi v1.2.4 // indirect

cmd/oteltestbedcol/go.sum

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connector/countconnector/go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ require (
3232
github.com/gogo/protobuf v1.3.2 // indirect
3333
github.com/google/uuid v1.6.0 // indirect
3434
github.com/hashicorp/go-version v1.7.0 // indirect
35+
github.com/hashicorp/golang-lru v0.5.4 // indirect
3536
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
3637
github.com/iancoleman/strcase v0.3.0 // indirect
3738
github.com/json-iterator/go v1.1.12 // indirect
@@ -50,6 +51,7 @@ require (
5051
github.com/prometheus/client_model v0.6.1 // indirect
5152
github.com/prometheus/common v0.55.0 // indirect
5253
github.com/prometheus/procfs v0.15.1 // indirect
54+
github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect
5355
go.opentelemetry.io/collector v0.107.1-0.20240816132030-9fd84668bb02 // indirect
5456
go.opentelemetry.io/collector/component/componentprofiles v0.107.1-0.20240816132030-9fd84668bb02 // indirect
5557
go.opentelemetry.io/collector/config/configtelemetry v0.107.1-0.20240816132030-9fd84668bb02 // indirect
@@ -72,6 +74,7 @@ require (
7274
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
7375
google.golang.org/grpc v1.65.0 // indirect
7476
google.golang.org/protobuf v1.34.2 // indirect
77+
gopkg.in/yaml.v2 v2.4.0 // indirect
7578
gopkg.in/yaml.v3 v3.0.1 // indirect
7679
)
7780

connector/countconnector/go.sum

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connector/datadogconnector/go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ require (
146146
github.com/hashicorp/errwrap v1.1.0 // indirect
147147
github.com/hashicorp/go-multierror v1.1.1 // indirect
148148
github.com/hashicorp/go-version v1.7.0 // indirect
149+
github.com/hashicorp/golang-lru v1.0.2 // indirect
149150
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
150151
github.com/hashicorp/hcl v1.0.0 // indirect
151152
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 // indirect
@@ -211,6 +212,7 @@ require (
211212
github.com/tinylib/msgp v1.1.9 // indirect
212213
github.com/tklauser/go-sysconf v0.3.12 // indirect
213214
github.com/tklauser/numcpus v0.6.1 // indirect
215+
github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect
214216
github.com/x448/float16 v0.8.4 // indirect
215217
github.com/yusufpapurcu/wmi v1.2.4 // indirect
216218
go.opentelemetry.io/collector v0.107.1-0.20240816132030-9fd84668bb02 // indirect

connector/datadogconnector/go.sum

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connector/routingconnector/go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ require (
2828
github.com/gogo/protobuf v1.3.2 // indirect
2929
github.com/google/uuid v1.6.0 // indirect
3030
github.com/hashicorp/go-version v1.7.0 // indirect
31+
github.com/hashicorp/golang-lru v0.5.4 // indirect
3132
github.com/iancoleman/strcase v0.3.0 // indirect
3233
github.com/json-iterator/go v1.1.12 // indirect
3334
github.com/knadh/koanf/maps v0.1.1 // indirect
@@ -45,6 +46,7 @@ require (
4546
github.com/prometheus/client_model v0.6.1 // indirect
4647
github.com/prometheus/common v0.55.0 // indirect
4748
github.com/prometheus/procfs v0.15.1 // indirect
49+
github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect
4850
go.opentelemetry.io/collector v0.107.1-0.20240816132030-9fd84668bb02 // indirect
4951
go.opentelemetry.io/collector/component/componentprofiles v0.107.1-0.20240816132030-9fd84668bb02 // indirect
5052
go.opentelemetry.io/collector/config/configtelemetry v0.107.1-0.20240816132030-9fd84668bb02 // indirect
@@ -67,6 +69,7 @@ require (
6769
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
6870
google.golang.org/grpc v1.65.0 // indirect
6971
google.golang.org/protobuf v1.34.2 // indirect
72+
gopkg.in/yaml.v2 v2.4.0 // indirect
7073
gopkg.in/yaml.v3 v3.0.1 // indirect
7174
)
7275

connector/routingconnector/go.sum

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connector/sumconnector/go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ require (
2929
github.com/gogo/protobuf v1.3.2 // indirect
3030
github.com/google/uuid v1.6.0 // indirect
3131
github.com/hashicorp/go-version v1.7.0 // indirect
32+
github.com/hashicorp/golang-lru v0.5.4 // indirect
3233
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
3334
github.com/iancoleman/strcase v0.3.0 // indirect
3435
github.com/json-iterator/go v1.1.12 // indirect
@@ -47,6 +48,7 @@ require (
4748
github.com/prometheus/client_model v0.6.1 // indirect
4849
github.com/prometheus/common v0.55.0 // indirect
4950
github.com/prometheus/procfs v0.15.1 // indirect
51+
github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect
5052
go.opentelemetry.io/collector v0.107.1-0.20240816132030-9fd84668bb02 // indirect
5153
go.opentelemetry.io/collector/component/componentprofiles v0.107.1-0.20240816132030-9fd84668bb02 // indirect
5254
go.opentelemetry.io/collector/config/configtelemetry v0.107.1-0.20240816132030-9fd84668bb02 // indirect
@@ -69,6 +71,7 @@ require (
6971
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
7072
google.golang.org/grpc v1.65.0 // indirect
7173
google.golang.org/protobuf v1.34.2 // indirect
74+
gopkg.in/yaml.v2 v2.4.0 // indirect
7275
gopkg.in/yaml.v3 v3.0.1 // indirect
7376
)
7477

connector/sumconnector/go.sum

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/datadogexporter/go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ require (
304304
github.com/tinylib/msgp v1.1.9 // indirect
305305
github.com/tklauser/go-sysconf v0.3.12 // indirect
306306
github.com/tklauser/numcpus v0.6.1 // indirect
307+
github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect
307308
github.com/valyala/fastjson v1.6.4 // indirect
308309
github.com/vultr/govultr/v2 v2.17.2 // indirect
309310
github.com/x448/float16 v0.8.4 // indirect

0 commit comments

Comments
 (0)