diff --git a/.chloggen/ottl_uri-parser.yaml b/.chloggen/ottl_uri-parser.yaml new file mode 100644 index 000000000000..dfa117899122 --- /dev/null +++ b/.chloggen/ottl_uri-parser.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: pkg/ottl + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Introducing `Uri` converter parsing URI string into SemConv + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [32433] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/connector/countconnector/go.mod b/connector/countconnector/go.mod index 1eb2789d91dc..7d981561b7cf 100644 --- a/connector/countconnector/go.mod +++ b/connector/countconnector/go.mod @@ -49,6 +49,7 @@ require ( github.com/prometheus/procfs v0.15.0 // indirect go.opentelemetry.io/collector v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/collector/config/configtelemetry v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect diff --git a/connector/countconnector/go.sum b/connector/countconnector/go.sum index cf697f414d9a..723e59ee9ed7 100644 --- a/connector/countconnector/go.sum +++ b/connector/countconnector/go.sum @@ -90,6 +90,8 @@ go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c h1:f8L2 go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c/go.mod h1:IHxHsp+Jq/xfjORQMDJjSH6jvedOSTOyu3nbxqhWSYE= go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4EegmtiSaOuh6wXWatKIui8xU= go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/connector/routingconnector/go.mod b/connector/routingconnector/go.mod index 1dc3704edac9..7d83813c0d2b 100644 --- a/connector/routingconnector/go.mod +++ b/connector/routingconnector/go.mod @@ -44,6 +44,7 @@ require ( github.com/prometheus/procfs v0.15.0 // indirect go.opentelemetry.io/collector v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/collector/config/configtelemetry v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect diff --git a/connector/routingconnector/go.sum b/connector/routingconnector/go.sum index 3c34c72879c3..749cea76c6a0 100644 --- a/connector/routingconnector/go.sum +++ b/connector/routingconnector/go.sum @@ -90,6 +90,8 @@ go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c h1:f8L2 go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c/go.mod h1:IHxHsp+Jq/xfjORQMDJjSH6jvedOSTOyu3nbxqhWSYE= go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4EegmtiSaOuh6wXWatKIui8xU= go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/exporter/honeycombmarkerexporter/go.mod b/exporter/honeycombmarkerexporter/go.mod index 1ee7b2447088..541b2aa78dff 100644 --- a/exporter/honeycombmarkerexporter/go.mod +++ b/exporter/honeycombmarkerexporter/go.mod @@ -13,6 +13,7 @@ require ( go.opentelemetry.io/collector/confmap v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/exporter v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/exporter/honeycombmarkerexporter/go.sum b/exporter/honeycombmarkerexporter/go.sum index a5af3d1a6c34..4fcbb052b58f 100644 --- a/exporter/honeycombmarkerexporter/go.sum +++ b/exporter/honeycombmarkerexporter/go.sum @@ -126,6 +126,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= diff --git a/internal/coreinternal/parseutils/uri.go b/internal/coreinternal/parseutils/uri.go new file mode 100644 index 000000000000..048e90e38389 --- /dev/null +++ b/internal/coreinternal/parseutils/uri.go @@ -0,0 +1,164 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package parseutils // import "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/parseutils" + +import ( + "net/url" + "strconv" + "strings" + + semconv "go.opentelemetry.io/collector/semconv/v1.25.0" +) + +const ( + // replace once conventions includes these + AttributeURLUserInfo = "url.user_info" + AttributeURLUsername = "url.username" + AttributeURLPassword = "url.password" +) + +// parseURI takes an absolute or relative uri and returns the parsed values. +func ParseURI(value string, semconvCompliant bool) (map[string]any, error) { + m := make(map[string]any) + + if strings.HasPrefix(value, "?") { + // remove the query string '?' prefix before parsing + v, err := url.ParseQuery(value[1:]) + if err != nil { + return nil, err + } + return queryToMap(v, m), nil + } + + var x *url.URL + var err error + var mappingFn func(*url.URL, map[string]any) (map[string]any, error) + + if semconvCompliant { + mappingFn = urlToSemconvMap + x, err = url.Parse(value) + if err != nil { + return nil, err + } + } else { + x, err = url.ParseRequestURI(value) + if err != nil { + return nil, err + } + + mappingFn = urlToMap + } + return mappingFn(x, m) +} + +// urlToMap converts a url.URL to a map, excludes any values that are not set. +func urlToSemconvMap(parsedURI *url.URL, m map[string]any) (map[string]any, error) { + m[semconv.AttributeURLOriginal] = parsedURI.String() + m[semconv.AttributeURLDomain] = parsedURI.Hostname() + m[semconv.AttributeURLScheme] = parsedURI.Scheme + m[semconv.AttributeURLPath] = parsedURI.Path + + if portString := parsedURI.Port(); len(portString) > 0 { + port, err := strconv.Atoi(portString) + if err != nil { + return nil, err + } + m[semconv.AttributeURLPort] = port + } + + if fragment := parsedURI.Fragment; len(fragment) > 0 { + m[semconv.AttributeURLFragment] = fragment + } + + if parsedURI.User != nil { + m[AttributeURLUserInfo] = parsedURI.User.String() + + if username := parsedURI.User.Username(); len(username) > 0 { + m[AttributeURLUsername] = username + } + + if pwd, isSet := parsedURI.User.Password(); isSet { + m[AttributeURLPassword] = pwd + } + } + + if query := parsedURI.RawQuery; len(query) > 0 { + m[semconv.AttributeURLQuery] = query + } + + if periodIdx := strings.LastIndex(parsedURI.Path, "."); periodIdx != -1 { + if periodIdx < len(parsedURI.Path)-1 { + m[semconv.AttributeURLExtension] = parsedURI.Path[periodIdx+1:] + } + } + + return m, nil +} + +// urlToMap converts a url.URL to a map, excludes any values that are not set. +func urlToMap(p *url.URL, m map[string]any) (map[string]any, error) { + scheme := p.Scheme + if scheme != "" { + m["scheme"] = scheme + } + + user := p.User.Username() + if user != "" { + m["user"] = user + } + + host := p.Hostname() + if host != "" { + m["host"] = host + } + + port := p.Port() + if port != "" { + m["port"] = port + } + + path := p.EscapedPath() + if path != "" { + m["path"] = path + } + + return queryToMap(p.Query(), m), nil +} + +// queryToMap converts a query string url.Values to a map. +func queryToMap(query url.Values, m map[string]any) map[string]any { + // no-op if query is empty, do not create the key m["query"] + if len(query) == 0 { + return m + } + + /* 'parameter' will represent url.Values + map[string]any{ + "parameter-a": []any{ + "a", + "b", + }, + "parameter-b": []any{ + "x", + "y", + }, + } + */ + parameters := map[string]any{} + for param, values := range query { + parameters[param] = queryParamValuesToMap(values) + } + m["query"] = parameters + return m +} + +// queryParamValuesToMap takes query string parameter values and +// returns an []interface populated with the values +func queryParamValuesToMap(values []string) []any { + v := make([]any, len(values)) + for i, value := range values { + v[i] = value + } + return v +} diff --git a/internal/coreinternal/parseutils/uri_test.go b/internal/coreinternal/parseutils/uri_test.go new file mode 100644 index 000000000000..f2cab56aa3bd --- /dev/null +++ b/internal/coreinternal/parseutils/uri_test.go @@ -0,0 +1,633 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package parseutils + +import ( + "net/url" + "testing" + + "github.com/stretchr/testify/require" + semconv "go.opentelemetry.io/collector/semconv/v1.25.0" +) + +// Test all usecases: absolute uri, relative uri, query string +func TestParseURI(t *testing.T) { + cases := []struct { + name string + inputBody string + outputBody map[string]any + expectErr bool + }{ + { + "scheme-http", + "http://", + map[string]any{ + "scheme": "http", + }, + false, + }, + { + "scheme-user", + "http://myuser:mypass@", + map[string]any{ + "scheme": "http", + "user": "myuser", + }, + false, + }, + { + "scheme-host", + "http://golang.com", + map[string]any{ + "scheme": "http", + "host": "golang.com", + }, + false, + }, + { + "scheme-host-root", + "http://golang.com/", + map[string]any{ + "scheme": "http", + "host": "golang.com", + "path": "/", + }, + false, + }, + { + "scheme-host-minimal", + "http://golang", + map[string]any{ + "scheme": "http", + "host": "golang", + }, + false, + }, + { + "host-missing-scheme", + "golang.org", + map[string]any{}, + true, + }, + { + "sheme-port", + "http://:8080", + map[string]any{ + "scheme": "http", + "port": "8080", + }, + false, + }, + { + "port-missing-scheme", + ":8080", + map[string]any{}, + true, + }, + { + "path", + "/docs", + map[string]any{ + "path": "/docs", + }, + false, + }, + { + "path-advanced", + `/x/y%2Fz`, + map[string]any{ + "path": `/x/y%2Fz`, + }, + false, + }, + { + "path-root", + "/", + map[string]any{ + "path": "/", + }, + false, + }, + { + "path-query", + "/v1/app?user=golang", + map[string]any{ + "path": "/v1/app", + "query": map[string]any{ + "user": []any{ + "golang", + }, + }, + }, + false, + }, + { + "invalid-query", + "?q;go", + map[string]any{}, + true, + }, + { + "scheme-path", + "http:///v1/app", + map[string]any{ + "scheme": "http", + "path": "/v1/app", + }, + false, + }, + { + "scheme-host-query", + "https://app.com?token=0000&env=prod&env=stage", + map[string]any{ + "scheme": "https", + "host": "app.com", + "query": map[string]any{ + "token": []any{ + "0000", + }, + "env": []any{ + "prod", + "stage", + }, + }, + }, + false, + }, + { + "minimal", + "http://golang.org", + map[string]any{ + "scheme": "http", + "host": "golang.org", + }, + false, + }, + { + "advanced", + "https://go:password@golang.org:8443/v2/app?env=stage&token=456&index=105838&env=prod", + map[string]any{ + "scheme": "https", + "user": "go", + "host": "golang.org", + "port": "8443", + "path": "/v2/app", + "query": map[string]any{ + "token": []any{ + "456", + }, + "index": []any{ + "105838", + }, + "env": []any{ + "stage", + "prod", + }, + }, + }, + false, + }, + { + "magnet", + "magnet:?xt=urn:sha1:HNCKHTQCWBTRNJIV4WNAE52SJUQCZO6C", + map[string]any{ + "scheme": "magnet", + "query": map[string]any{ + "xt": []any{ + "urn:sha1:HNCKHTQCWBTRNJIV4WNAE52SJUQCZO6C", + }, + }, + }, + false, + }, + { + "sftp", + "sftp://ftp.com//home/name/employee.csv", + map[string]any{ + "scheme": "sftp", + "host": "ftp.com", + "path": "//home/name/employee.csv", + }, + false, + }, + { + "missing-schema", + "golang.org/app", + map[string]any{}, + true, + }, + { + "query-advanced", + "?token=0000&env=prod&env=stage&task=update&task=new&action=update", + map[string]any{ + "query": map[string]any{ + "token": []any{ + "0000", + }, + "env": []any{ + "prod", + "stage", + }, + "task": []any{ + "update", + "new", + }, + "action": []any{ + "update", + }, + }, + }, + false, + }, + { + "query", + "?token=0000", + map[string]any{ + "query": map[string]any{ + "token": []any{ + "0000", + }, + }, + }, + false, + }, + { + "query-empty", + "?", + map[string]any{}, + false, + }, + { + "query-empty-key", + "?user=", + map[string]any{ + "query": map[string]any{ + "user": []any{ + "", // no value + }, + }, + }, + false, + }, + // Query string without a ? prefix is treated as a URI, therefor + // an error will be returned by url.Parse("user=dev") + { + "query-no-?-prefix", + "user=dev", + map[string]any{}, + true, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + x, err := ParseURI(tc.inputBody, false) + if tc.expectErr { + require.Error(t, err) + return + } + require.NoError(t, err) + require.Equal(t, tc.outputBody, x) + }) + } +} + +func TestURLToMap(t *testing.T) { + cases := []struct { + name string + inputBody *url.URL + outputBody map[string]any + }{ + { + "absolute-uri", + &url.URL{ + Scheme: "https", + Host: "google.com:8443", + Path: "/app", + RawQuery: "stage=prod&stage=dev", + }, + map[string]any{ + "scheme": "https", + "host": "google.com", + "port": "8443", + "path": "/app", + "query": map[string]any{ + "stage": []any{ + "prod", + "dev", + }, + }, + }, + }, + { + "absolute-uri-simple", + &url.URL{ + Scheme: "http", + Host: "google.com", + }, + map[string]any{ + "scheme": "http", + "host": "google.com", + }, + }, + { + "path", + &url.URL{ + Path: "/app", + RawQuery: "stage=prod&stage=dev", + }, + map[string]any{ + "path": "/app", + "query": map[string]any{ + "stage": []any{ + "prod", + "dev", + }, + }, + }, + }, + { + "path-simple", + &url.URL{ + Path: "/app", + }, + map[string]any{ + "path": "/app", + }, + }, + { + "query", + &url.URL{ + RawQuery: "stage=prod&stage=dev", + }, + map[string]any{ + "query": map[string]any{ + "stage": []any{ + "prod", + "dev", + }, + }, + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + m := make(map[string]any) + resMap, err := urlToMap(tc.inputBody, m) + require.NoError(t, err) + require.Equal(t, tc.outputBody, resMap) + }) + } +} + +func TestQueryToMap(t *testing.T) { + cases := []struct { + name string + inputBody url.Values + outputBody map[string]any + }{ + { + "query", + url.Values{ + "stage": []string{ + "prod", + "dev", + }, + }, + map[string]any{ + "query": map[string]any{ + "stage": []any{ + "prod", + "dev", + }, + }, + }, + }, + { + "empty", + url.Values{}, + map[string]any{}, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + m := make(map[string]any) + require.Equal(t, tc.outputBody, queryToMap(tc.inputBody, m)) + }) + } +} + +func TestQueryParamValuesToMap(t *testing.T) { + cases := []struct { + name string + inputBody []string + outputBody []any + }{ + { + "simple", + []string{ + "prod", + "dev", + }, + []any{ + "prod", + "dev", + }, + }, + { + "empty", + []string{}, + []any{}, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.outputBody, queryParamValuesToMap(tc.inputBody)) + }) + } +} + +func BenchmarkURLToMap(b *testing.B) { + m := make(map[string]any) + v := "https://dev:password@www.golang.org:8443/v1/app/stage?token=d9e28b1d-2c7b-4853-be6a-d94f34a5d4ab&env=prod&env=stage&token=c6fa29f9-a31b-4584-b98d-aa8473b0e18d®ion=us-east1b&mode=fast" + u, err := url.ParseRequestURI(v) + if err != nil { + b.Fatal(err) + } + for n := 0; n < b.N; n++ { + _, _ = urlToMap(u, m) + } +} + +func BenchmarkQueryToMap(b *testing.B) { + m := make(map[string]any) + v := "?token=d9e28b1d-2c7b-4853-be6a-d94f34a5d4ab&env=prod&env=stage&token=c6fa29f9-a31b-4584-b98d-aa8473b0e18d®ion=us-east1b&mode=fast" + u, err := url.ParseQuery(v) + if err != nil { + b.Fatal(err) + } + for n := 0; n < b.N; n++ { + queryToMap(u, m) + } +} + +func BenchmarkQueryParamValuesToMap(b *testing.B) { + v := []string{ + "d9e28b1d-2c7b-4853-be6a-d94f34a5d4ab", + "c6fa29f9-a31b-4584-b98d-aa8473b0e18", + } + for n := 0; n < b.N; n++ { + queryParamValuesToMap(v) + } +} + +func TestParseSemconv(t *testing.T) { + testCases := []struct { + Name string + Original string + ExpectedMap map[string]any + }{ + { + "complete example", + "http://myusername:mypassword@www.example.com:80/foo.gif?key1=val1&key2=val2#fragment", + map[string]any{ + semconv.AttributeURLPath: "/foo.gif", + semconv.AttributeURLFragment: "fragment", + semconv.AttributeURLExtension: "gif", + AttributeURLPassword: "mypassword", + semconv.AttributeURLOriginal: "http://myusername:mypassword@www.example.com:80/foo.gif?key1=val1&key2=val2#fragment", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLPort: 80, + AttributeURLUserInfo: "myusername:mypassword", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLQuery: "key1=val1&key2=val2", + AttributeURLUsername: "myusername", + }, + }, + { + "simple example", + "http://www.example.com", + map[string]any{ + semconv.AttributeURLOriginal: "http://www.example.com", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "", + }, + }, + { + "custom port", + "http://www.example.com:77", + map[string]any{ + semconv.AttributeURLOriginal: "http://www.example.com:77", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "", + semconv.AttributeURLPort: 77, + }, + }, + { + "file", + "http://www.example.com:77/file.png", + map[string]any{ + semconv.AttributeURLOriginal: "http://www.example.com:77/file.png", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/file.png", + semconv.AttributeURLPort: 77, + semconv.AttributeURLExtension: "png", + }, + }, + { + "fragment", + "http://www.example.com:77/foo#bar", + map[string]any{ + semconv.AttributeURLOriginal: "http://www.example.com:77/foo#bar", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/foo", + semconv.AttributeURLPort: 77, + semconv.AttributeURLFragment: "bar", + }, + }, + { + "query example", + "https://www.example.com:77/foo?key=val", + map[string]any{ + semconv.AttributeURLOriginal: "https://www.example.com:77/foo?key=val", + semconv.AttributeURLScheme: "https", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/foo", + semconv.AttributeURLPort: 77, + semconv.AttributeURLQuery: "key=val", + }, + }, + { + "user info", + "https://user:pw@www.example.com:77/foo", + map[string]any{ + semconv.AttributeURLOriginal: "https://user:pw@www.example.com:77/foo", + semconv.AttributeURLScheme: "https", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/foo", + semconv.AttributeURLPort: 77, + AttributeURLUserInfo: "user:pw", + AttributeURLUsername: "user", + AttributeURLPassword: "pw", + }, + }, + { + "user info - no password", + "https://user:@www.example.com:77/foo", + map[string]any{ + semconv.AttributeURLOriginal: "https://user:@www.example.com:77/foo", + semconv.AttributeURLScheme: "https", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/foo", + semconv.AttributeURLPort: 77, + AttributeURLUserInfo: "user:", + AttributeURLUsername: "user", + AttributeURLPassword: "", + }, + }, + { + "non-http scheme: ftp", + "ftp://ftp.is.co.za/rfc/rfc1808.txt", + map[string]any{ + semconv.AttributeURLOriginal: "ftp://ftp.is.co.za/rfc/rfc1808.txt", + semconv.AttributeURLScheme: "ftp", + semconv.AttributeURLPath: "/rfc/rfc1808.txt", + semconv.AttributeURLExtension: "txt", + semconv.AttributeURLDomain: "ftp.is.co.za", + }, + }, + { + "non-http scheme: telnet", + "telnet://192.0.2.16:80/", + map[string]any{ + semconv.AttributeURLOriginal: "telnet://192.0.2.16:80/", + semconv.AttributeURLScheme: "telnet", + semconv.AttributeURLPath: "/", + semconv.AttributeURLPort: 80, + semconv.AttributeURLDomain: "192.0.2.16", + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.Name, func(t *testing.T) { + resMap, err := ParseURI(tc.Original, true) + require.NoError(t, err) + + require.Equal(t, len(tc.ExpectedMap), len(resMap)) + for k, v := range tc.ExpectedMap { + actualValue, found := resMap[k] + require.True(t, found, "key not found %q", k) + require.Equal(t, v, actualValue) + } + }) + } +} diff --git a/pkg/ottl/go.mod b/pkg/ottl/go.mod index ec71505b42e1..08abab513060 100644 --- a/pkg/ottl/go.mod +++ b/pkg/ottl/go.mod @@ -13,6 +13,7 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 diff --git a/pkg/ottl/go.sum b/pkg/ottl/go.sum index c6e131a2448e..2dbe86234179 100644 --- a/pkg/ottl/go.sum +++ b/pkg/ottl/go.sum @@ -66,6 +66,8 @@ go.opentelemetry.io/collector/config/configtelemetry v0.102.2-0.20240611143128-7 go.opentelemetry.io/collector/config/configtelemetry v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:WxWKNVAQJg/Io1nA3xLgn/DWLE/W1QOB2+/Js3ACi40= go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c h1:f8L2r0f684bJAAZDoTvEWccx34C3kQsePNwy8KzTPqM= go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c/go.mod h1:IHxHsp+Jq/xfjORQMDJjSH6jvedOSTOyu3nbxqhWSYE= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/pkg/ottl/ottlfuncs/README.md b/pkg/ottl/ottlfuncs/README.md index 993f9d34ce2f..1562a17e5573 100644 --- a/pkg/ottl/ottlfuncs/README.md +++ b/pkg/ottl/ottlfuncs/README.md @@ -1370,6 +1370,44 @@ Examples: - `UnixSeconds(Time("02/04/2023", "%m/%d/%Y"))` +### URL + +`URL(url_string)` + +Parses a Uniform Resource Locator (URL) string and extracts its components as an object. +This URL object includes properties for the URL’s domain, path, fragment, port, query, scheme, user info, username, and password. + +`original`, `domain`, `scheme`, and `path` are always present. Other properties are present only if they have corresponding values. + +`url_string` is a `string`. + +- `URL("http://www.example.com")` + +results in +``` + "url.original": "http://www.example.com", + "url.scheme": "http", + "url.domain": "www.example.com", + "url.path": "", +``` + +- `URL("http://myusername:mypassword@www.example.com:80/foo.gif?key1=val1&key2=val2#fragment")` + +results in +``` + "url.path": "/foo.gif", + "url.fragment": "fragment", + "url.extension": "gif", + "url.password": "mypassword", + "url.original": "http://myusername:mypassword@www.example.com:80/foo.gif?key1=val1&key2=val2#fragment", + "url.scheme": "http", + "url.port": 80, + "url.user_info": "myusername:mypassword", + "url.domain": "www.example.com", + "url.query": "key1=val1&key2=val2", + "url.username": "myusername", +``` + ### UUID `UUID()` diff --git a/pkg/ottl/ottlfuncs/func_url.go b/pkg/ottl/ottlfuncs/func_url.go new file mode 100644 index 000000000000..371576bb0249 --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_url.go @@ -0,0 +1,44 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs" + +import ( + "context" + "fmt" + + "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/parseutils" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +type URLArguments[K any] struct { + URI ottl.StringGetter[K] +} + +func NewURLFactory[K any]() ottl.Factory[K] { + return ottl.NewFactory("URL", &URLArguments[K]{}, createURIFunction[K]) +} + +func createURIFunction[K any](_ ottl.FunctionContext, oArgs ottl.Arguments) (ottl.ExprFunc[K], error) { + args, ok := oArgs.(*URLArguments[K]) + if !ok { + return nil, fmt.Errorf("URLFactory args must be of type *URLArguments[K]") + } + + return url(args.URI), nil //revive:disable-line:var-naming +} + +func url[K any](uriSource ottl.StringGetter[K]) ottl.ExprFunc[K] { //revive:disable-line:var-naming + return func(ctx context.Context, tCtx K) (any, error) { + urlString, err := uriSource.Get(ctx, tCtx) + if err != nil { + return nil, err + } + + if urlString == "" { + return nil, fmt.Errorf("url cannot be empty") + } + + return parseutils.ParseURI(urlString, true) + } +} diff --git a/pkg/ottl/ottlfuncs/func_url_test.go b/pkg/ottl/ottlfuncs/func_url_test.go new file mode 100644 index 000000000000..5990a3693ba4 --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_url_test.go @@ -0,0 +1,178 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + semconv "go.opentelemetry.io/collector/semconv/v1.25.0" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +const ( + // replace once conventions includes these + AttributeURLUserInfo = "url.user_info" + AttributeURLUsername = "url.username" + AttributeURLPassword = "url.password" +) + +func TestURLParser(t *testing.T) { + testCases := []struct { + Name string + Original string + ExpectedMap map[string]any + }{ + { + "complete example", + "http://myusername:mypassword@www.example.com:80/foo.gif?key1=val1&key2=val2#fragment", + map[string]any{ + semconv.AttributeURLPath: "/foo.gif", + semconv.AttributeURLFragment: "fragment", + semconv.AttributeURLExtension: "gif", + AttributeURLPassword: "mypassword", + semconv.AttributeURLOriginal: "http://myusername:mypassword@www.example.com:80/foo.gif?key1=val1&key2=val2#fragment", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLPort: 80, + AttributeURLUserInfo: "myusername:mypassword", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLQuery: "key1=val1&key2=val2", + AttributeURLUsername: "myusername", + }, + }, + { + "simple example", + "http://www.example.com", + map[string]any{ + semconv.AttributeURLOriginal: "http://www.example.com", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "", + }, + }, + { + "custom port", + "http://www.example.com:77", + map[string]any{ + semconv.AttributeURLOriginal: "http://www.example.com:77", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "", + semconv.AttributeURLPort: 77, + }, + }, + { + "file", + "http://www.example.com:77/file.png", + map[string]any{ + semconv.AttributeURLOriginal: "http://www.example.com:77/file.png", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/file.png", + semconv.AttributeURLPort: 77, + semconv.AttributeURLExtension: "png", + }, + }, + { + "fragment", + "http://www.example.com:77/foo#bar", + map[string]any{ + semconv.AttributeURLOriginal: "http://www.example.com:77/foo#bar", + semconv.AttributeURLScheme: "http", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/foo", + semconv.AttributeURLPort: 77, + semconv.AttributeURLFragment: "bar", + }, + }, + { + "query example", + "https://www.example.com:77/foo?key=val", + map[string]any{ + semconv.AttributeURLOriginal: "https://www.example.com:77/foo?key=val", + semconv.AttributeURLScheme: "https", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/foo", + semconv.AttributeURLPort: 77, + semconv.AttributeURLQuery: "key=val", + }, + }, + { + "user info", + "https://user:pw@www.example.com:77/foo", + map[string]any{ + semconv.AttributeURLOriginal: "https://user:pw@www.example.com:77/foo", + semconv.AttributeURLScheme: "https", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/foo", + semconv.AttributeURLPort: 77, + AttributeURLUserInfo: "user:pw", + AttributeURLUsername: "user", + AttributeURLPassword: "pw", + }, + }, + { + "user info - no password", + "https://user:@www.example.com:77/foo", + map[string]any{ + semconv.AttributeURLOriginal: "https://user:@www.example.com:77/foo", + semconv.AttributeURLScheme: "https", + semconv.AttributeURLDomain: "www.example.com", + semconv.AttributeURLPath: "/foo", + semconv.AttributeURLPort: 77, + AttributeURLUserInfo: "user:", + AttributeURLUsername: "user", + AttributeURLPassword: "", + }, + }, + { + "non-http scheme: ftp", + "ftp://ftp.is.co.za/rfc/rfc1808.txt", + map[string]any{ + semconv.AttributeURLOriginal: "ftp://ftp.is.co.za/rfc/rfc1808.txt", + semconv.AttributeURLScheme: "ftp", + semconv.AttributeURLPath: "/rfc/rfc1808.txt", + semconv.AttributeURLExtension: "txt", + semconv.AttributeURLDomain: "ftp.is.co.za", + }, + }, + { + "non-http scheme: telnet", + "telnet://192.0.2.16:80/", + map[string]any{ + semconv.AttributeURLOriginal: "telnet://192.0.2.16:80/", + semconv.AttributeURLScheme: "telnet", + semconv.AttributeURLPath: "/", + semconv.AttributeURLPort: 80, + semconv.AttributeURLDomain: "192.0.2.16", + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.Name, func(t *testing.T) { + source := &ottl.StandardStringGetter[any]{ + Getter: func(_ context.Context, _ any) (any, error) { + return tc.Original, nil + }, + } + + exprFunc := url(source) //revive:disable-line:var-naming + res, err := exprFunc(context.Background(), nil) + require.NoError(t, err) + + resMap, ok := res.(map[string]any) + require.True(t, ok) + + require.Equal(t, len(tc.ExpectedMap), len(resMap)) + for k, v := range tc.ExpectedMap { + actualValue, found := resMap[k] + require.True(t, found, "key not found %q", k) + require.Equal(t, v, actualValue) + } + }) + } +} diff --git a/pkg/ottl/ottlfuncs/functions.go b/pkg/ottl/ottlfuncs/functions.go index 9f86b845ff2c..a4a635a7d591 100644 --- a/pkg/ottl/ottlfuncs/functions.go +++ b/pkg/ottl/ottlfuncs/functions.go @@ -83,6 +83,7 @@ func converters[K any]() []ottl.Factory[K] { NewUnixNanoFactory[K](), NewUnixSecondsFactory[K](), NewUUIDFactory[K](), + NewURLFactory[K](), NewAppendFactory[K](), NewYearFactory[K](), } diff --git a/pkg/stanza/go.mod b/pkg/stanza/go.mod index 3bff75cf97f3..e626cebb3d70 100644 --- a/pkg/stanza/go.mod +++ b/pkg/stanza/go.mod @@ -61,6 +61,7 @@ require ( go.opentelemetry.io/collector v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/collector/config/configopaque v1.9.1-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/collector/config/configtelemetry v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect diff --git a/pkg/stanza/go.sum b/pkg/stanza/go.sum index ff061ed75eb6..cd36da4fdf87 100644 --- a/pkg/stanza/go.sum +++ b/pkg/stanza/go.sum @@ -105,6 +105,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/pkg/stanza/operator/parser/uri/parser.go b/pkg/stanza/operator/parser/uri/parser.go index e7761239cbbc..9762c3655951 100644 --- a/pkg/stanza/operator/parser/uri/parser.go +++ b/pkg/stanza/operator/parser/uri/parser.go @@ -6,13 +6,27 @@ package uri // import "github.com/open-telemetry/opentelemetry-collector-contrib import ( "context" "fmt" - "net/url" - "strings" + "go.opentelemetry.io/collector/featuregate" + + "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/parseutils" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/entry" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/helper" ) +const semconvCompliantFeatureGateID = "parser.uri.ecscompliant" + +var semconvCompliantFeatureGate *featuregate.Gate + +func init() { + semconvCompliantFeatureGate = featuregate.GlobalRegistry().MustRegister( + semconvCompliantFeatureGateID, + featuregate.StageAlpha, + featuregate.WithRegisterDescription("When enabled resulting map will be in semconv compliant format."), + featuregate.WithRegisterFromVersion("v0.103.0"), + ) +} + // Parser is an operator that parses a uri. type Parser struct { helper.ParserOperator @@ -27,95 +41,8 @@ func (p *Parser) Process(ctx context.Context, entry *entry.Entry) error { func (p *Parser) parse(value any) (any, error) { switch m := value.(type) { case string: - return parseURI(m) + return parseutils.ParseURI(m, semconvCompliantFeatureGate.IsEnabled()) default: return nil, fmt.Errorf("type '%T' cannot be parsed as URI", value) } } - -// parseURI takes an absolute or relative uri and returns the parsed values. -func parseURI(value string) (map[string]any, error) { - m := make(map[string]any) - - if strings.HasPrefix(value, "?") { - // remove the query string '?' prefix before parsing - v, err := url.ParseQuery(value[1:]) - if err != nil { - return nil, err - } - return queryToMap(v, m), nil - } - - x, err := url.ParseRequestURI(value) - if err != nil { - return nil, err - } - return urlToMap(x, m), nil -} - -// urlToMap converts a url.URL to a map, excludes any values that are not set. -func urlToMap(p *url.URL, m map[string]any) map[string]any { - scheme := p.Scheme - if scheme != "" { - m["scheme"] = scheme - } - - user := p.User.Username() - if user != "" { - m["user"] = user - } - - host := p.Hostname() - if host != "" { - m["host"] = host - } - - port := p.Port() - if port != "" { - m["port"] = port - } - - path := p.EscapedPath() - if path != "" { - m["path"] = path - } - - return queryToMap(p.Query(), m) -} - -// queryToMap converts a query string url.Values to a map. -func queryToMap(query url.Values, m map[string]any) map[string]any { - // no-op if query is empty, do not create the key m["query"] - if len(query) == 0 { - return m - } - - /* 'parameter' will represent url.Values - map[string]any{ - "parameter-a": []any{ - "a", - "b", - }, - "parameter-b": []any{ - "x", - "y", - }, - } - */ - parameters := map[string]any{} - for param, values := range query { - parameters[param] = queryParamValuesToMap(values) - } - m["query"] = parameters - return m -} - -// queryParamValuesToMap takes query string parameter values and -// returns an []interface populated with the values -func queryParamValuesToMap(values []string) []any { - v := make([]any, len(values)) - for i, value := range values { - v[i] = value - } - return v -} diff --git a/pkg/stanza/operator/parser/uri/parser_test.go b/pkg/stanza/operator/parser/uri/parser_test.go index 3bec6dc7469e..f6c0290b3f2a 100644 --- a/pkg/stanza/operator/parser/uri/parser_test.go +++ b/pkg/stanza/operator/parser/uri/parser_test.go @@ -5,7 +5,6 @@ package uri import ( "context" - "net/url" "testing" "github.com/stretchr/testify/require" @@ -204,288 +203,6 @@ func TestParserParse(t *testing.T) { } } -// Test all usecases: absolute uri, relative uri, query string -func TestParseURI(t *testing.T) { - cases := []struct { - name string - inputBody string - outputBody map[string]any - expectErr bool - }{ - { - "scheme-http", - "http://", - map[string]any{ - "scheme": "http", - }, - false, - }, - { - "scheme-user", - "http://myuser:mypass@", - map[string]any{ - "scheme": "http", - "user": "myuser", - }, - false, - }, - { - "scheme-host", - "http://golang.com", - map[string]any{ - "scheme": "http", - "host": "golang.com", - }, - false, - }, - { - "scheme-host-root", - "http://golang.com/", - map[string]any{ - "scheme": "http", - "host": "golang.com", - "path": "/", - }, - false, - }, - { - "scheme-host-minimal", - "http://golang", - map[string]any{ - "scheme": "http", - "host": "golang", - }, - false, - }, - { - "host-missing-scheme", - "golang.org", - map[string]any{}, - true, - }, - { - "sheme-port", - "http://:8080", - map[string]any{ - "scheme": "http", - "port": "8080", - }, - false, - }, - { - "port-missing-scheme", - ":8080", - map[string]any{}, - true, - }, - { - "path", - "/docs", - map[string]any{ - "path": "/docs", - }, - false, - }, - { - "path-advanced", - `/x/y%2Fz`, - map[string]any{ - "path": `/x/y%2Fz`, - }, - false, - }, - { - "path-root", - "/", - map[string]any{ - "path": "/", - }, - false, - }, - { - "path-query", - "/v1/app?user=golang", - map[string]any{ - "path": "/v1/app", - "query": map[string]any{ - "user": []any{ - "golang", - }, - }, - }, - false, - }, - { - "invalid-query", - "?q;go", - map[string]any{}, - true, - }, - { - "scheme-path", - "http:///v1/app", - map[string]any{ - "scheme": "http", - "path": "/v1/app", - }, - false, - }, - { - "scheme-host-query", - "https://app.com?token=0000&env=prod&env=stage", - map[string]any{ - "scheme": "https", - "host": "app.com", - "query": map[string]any{ - "token": []any{ - "0000", - }, - "env": []any{ - "prod", - "stage", - }, - }, - }, - false, - }, - { - "minimal", - "http://golang.org", - map[string]any{ - "scheme": "http", - "host": "golang.org", - }, - false, - }, - { - "advanced", - "https://go:password@golang.org:8443/v2/app?env=stage&token=456&index=105838&env=prod", - map[string]any{ - "scheme": "https", - "user": "go", - "host": "golang.org", - "port": "8443", - "path": "/v2/app", - "query": map[string]any{ - "token": []any{ - "456", - }, - "index": []any{ - "105838", - }, - "env": []any{ - "stage", - "prod", - }, - }, - }, - false, - }, - { - "magnet", - "magnet:?xt=urn:sha1:HNCKHTQCWBTRNJIV4WNAE52SJUQCZO6C", - map[string]any{ - "scheme": "magnet", - "query": map[string]any{ - "xt": []any{ - "urn:sha1:HNCKHTQCWBTRNJIV4WNAE52SJUQCZO6C", - }, - }, - }, - false, - }, - { - "sftp", - "sftp://ftp.com//home/name/employee.csv", - map[string]any{ - "scheme": "sftp", - "host": "ftp.com", - "path": "//home/name/employee.csv", - }, - false, - }, - { - "missing-schema", - "golang.org/app", - map[string]any{}, - true, - }, - { - "query-advanced", - "?token=0000&env=prod&env=stage&task=update&task=new&action=update", - map[string]any{ - "query": map[string]any{ - "token": []any{ - "0000", - }, - "env": []any{ - "prod", - "stage", - }, - "task": []any{ - "update", - "new", - }, - "action": []any{ - "update", - }, - }, - }, - false, - }, - { - "query", - "?token=0000", - map[string]any{ - "query": map[string]any{ - "token": []any{ - "0000", - }, - }, - }, - false, - }, - { - "query-empty", - "?", - map[string]any{}, - false, - }, - { - "query-empty-key", - "?user=", - map[string]any{ - "query": map[string]any{ - "user": []any{ - "", // no value - }, - }, - }, - false, - }, - // Query string without a ? prefix is treated as a URI, therefor - // an error will be returned by url.Parse("user=dev") - { - "query-no-?-prefix", - "user=dev", - map[string]any{}, - true, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - x, err := parseURI(tc.inputBody) - if tc.expectErr { - require.Error(t, err) - return - } - require.NoError(t, err) - require.Equal(t, tc.outputBody, x) - }) - } -} - func TestBuildParserURL(t *testing.T) { newBasicParser := func() *Config { cfg := NewConfigWithID("test") @@ -501,162 +218,6 @@ func TestBuildParserURL(t *testing.T) { }) } -func TestURLToMap(t *testing.T) { - cases := []struct { - name string - inputBody *url.URL - outputBody map[string]any - }{ - { - "absolute-uri", - &url.URL{ - Scheme: "https", - Host: "google.com:8443", - Path: "/app", - RawQuery: "stage=prod&stage=dev", - }, - map[string]any{ - "scheme": "https", - "host": "google.com", - "port": "8443", - "path": "/app", - "query": map[string]any{ - "stage": []any{ - "prod", - "dev", - }, - }, - }, - }, - { - "absolute-uri-simple", - &url.URL{ - Scheme: "http", - Host: "google.com", - }, - map[string]any{ - "scheme": "http", - "host": "google.com", - }, - }, - { - "path", - &url.URL{ - Path: "/app", - RawQuery: "stage=prod&stage=dev", - }, - map[string]any{ - "path": "/app", - "query": map[string]any{ - "stage": []any{ - "prod", - "dev", - }, - }, - }, - }, - { - "path-simple", - &url.URL{ - Path: "/app", - }, - map[string]any{ - "path": "/app", - }, - }, - { - "query", - &url.URL{ - RawQuery: "stage=prod&stage=dev", - }, - map[string]any{ - "query": map[string]any{ - "stage": []any{ - "prod", - "dev", - }, - }, - }, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - m := make(map[string]any) - require.Equal(t, tc.outputBody, urlToMap(tc.inputBody, m)) - }) - } -} - -func TestQueryToMap(t *testing.T) { - cases := []struct { - name string - inputBody url.Values - outputBody map[string]any - }{ - { - "query", - url.Values{ - "stage": []string{ - "prod", - "dev", - }, - }, - map[string]any{ - "query": map[string]any{ - "stage": []any{ - "prod", - "dev", - }, - }, - }, - }, - { - "empty", - url.Values{}, - map[string]any{}, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - m := make(map[string]any) - require.Equal(t, tc.outputBody, queryToMap(tc.inputBody, m)) - }) - } -} - -func TestQueryParamValuesToMap(t *testing.T) { - cases := []struct { - name string - inputBody []string - outputBody []any - }{ - { - "simple", - []string{ - "prod", - "dev", - }, - []any{ - "prod", - "dev", - }, - }, - { - "empty", - []string{}, - []any{}, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - require.Equal(t, tc.outputBody, queryParamValuesToMap(tc.inputBody)) - }) - } -} - func BenchmarkParserParse(b *testing.B) { v := "https://dev:password@www.golang.org:8443/v1/app/stage?token=d9e28b1d-2c7b-4853-be6a-d94f34a5d4ab&env=prod&env=stage&token=c6fa29f9-a31b-4584-b98d-aa8473b0e18d®ion=us-east1b&mode=fast" parser := Parser{} @@ -666,37 +227,3 @@ func BenchmarkParserParse(b *testing.B) { } } } - -func BenchmarkURLToMap(b *testing.B) { - m := make(map[string]any) - v := "https://dev:password@www.golang.org:8443/v1/app/stage?token=d9e28b1d-2c7b-4853-be6a-d94f34a5d4ab&env=prod&env=stage&token=c6fa29f9-a31b-4584-b98d-aa8473b0e18d®ion=us-east1b&mode=fast" - u, err := url.ParseRequestURI(v) - if err != nil { - b.Fatal(err) - } - for n := 0; n < b.N; n++ { - urlToMap(u, m) - } -} - -func BenchmarkQueryToMap(b *testing.B) { - m := make(map[string]any) - v := "?token=d9e28b1d-2c7b-4853-be6a-d94f34a5d4ab&env=prod&env=stage&token=c6fa29f9-a31b-4584-b98d-aa8473b0e18d®ion=us-east1b&mode=fast" - u, err := url.ParseQuery(v) - if err != nil { - b.Fatal(err) - } - for n := 0; n < b.N; n++ { - queryToMap(u, m) - } -} - -func BenchmarkQueryParamValuesToMap(b *testing.B) { - v := []string{ - "d9e28b1d-2c7b-4853-be6a-d94f34a5d4ab", - "c6fa29f9-a31b-4584-b98d-aa8473b0e18", - } - for n := 0; n < b.N; n++ { - queryParamValuesToMap(v) - } -} diff --git a/processor/logstransformprocessor/go.mod b/processor/logstransformprocessor/go.mod index 949646deb996..56b5177eb84f 100644 --- a/processor/logstransformprocessor/go.mod +++ b/processor/logstransformprocessor/go.mod @@ -13,6 +13,7 @@ require ( go.opentelemetry.io/collector/extension v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/processor/logstransformprocessor/go.sum b/processor/logstransformprocessor/go.sum index c652f8501872..7961c54febaf 100644 --- a/processor/logstransformprocessor/go.sum +++ b/processor/logstransformprocessor/go.sum @@ -97,6 +97,8 @@ go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c h go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:81izr5ORy0YdzmhelV5fRUJvV8ElmeodxToRpL0cocY= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/processor/routingprocessor/go.mod b/processor/routingprocessor/go.mod index 5b8ee8bf58bc..d1d5a6d43e4d 100644 --- a/processor/routingprocessor/go.mod +++ b/processor/routingprocessor/go.mod @@ -68,6 +68,7 @@ require ( go.opentelemetry.io/collector/featuregate v1.9.1-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/collector/pdata/testdata v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect diff --git a/processor/routingprocessor/go.sum b/processor/routingprocessor/go.sum index c53a944448c7..4b730b241e29 100644 --- a/processor/routingprocessor/go.sum +++ b/processor/routingprocessor/go.sum @@ -130,6 +130,8 @@ go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c h go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:81izr5ORy0YdzmhelV5fRUJvV8ElmeodxToRpL0cocY= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/contrib/config v0.7.0 h1:b1rK5tGTuhhPirJiMxOcyQfZs76j2VapY6ODn3b2Dbs= go.opentelemetry.io/contrib/config v0.7.0/go.mod h1:8tdiFd8N5etOi3XzBmAoMxplEzI3TcL8dU5rM5/xcOQ= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 h1:vS1Ao/R55RNV4O7TA2Qopok8yN+X0LIP6RVWLFkprck= diff --git a/processor/tailsamplingprocessor/go.mod b/processor/tailsamplingprocessor/go.mod index 74b7fe3709a0..7f777e050b81 100644 --- a/processor/tailsamplingprocessor/go.mod +++ b/processor/tailsamplingprocessor/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/collector/featuregate v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel v1.27.0 go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/sdk/metric v1.27.0 diff --git a/processor/tailsamplingprocessor/go.sum b/processor/tailsamplingprocessor/go.sum index 0e79d9228e4a..966be72d3d25 100644 --- a/processor/tailsamplingprocessor/go.sum +++ b/processor/tailsamplingprocessor/go.sum @@ -94,6 +94,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.2-0.20240611143128-7dfb57b9a go.opentelemetry.io/collector/pdata/testdata v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:czLc/oKlriUYBB6EZbPLIhWMKaG4viHtxflaSDMjnxg= go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c h1:SufVomDf8sHj3SMlKcCT5qJh/weXHlacQ8QDby7IFOM= go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:81izr5ORy0YdzmhelV5fRUJvV8ElmeodxToRpL0cocY= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/processor/transformprocessor/go.mod b/processor/transformprocessor/go.mod index 6fd8e9029d38..504726824f2a 100644 --- a/processor/transformprocessor/go.mod +++ b/processor/transformprocessor/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/collector/featuregate v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/processor/transformprocessor/go.sum b/processor/transformprocessor/go.sum index c7367253be38..24029778d96b 100644 --- a/processor/transformprocessor/go.sum +++ b/processor/transformprocessor/go.sum @@ -94,6 +94,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.2-0.20240611143128-7dfb57b9a go.opentelemetry.io/collector/pdata/testdata v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:czLc/oKlriUYBB6EZbPLIhWMKaG4viHtxflaSDMjnxg= go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c h1:SufVomDf8sHj3SMlKcCT5qJh/weXHlacQ8QDby7IFOM= go.opentelemetry.io/collector/processor v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:81izr5ORy0YdzmhelV5fRUJvV8ElmeodxToRpL0cocY= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/receiver/filelogreceiver/go.mod b/receiver/filelogreceiver/go.mod index 69e8b32eb6de..f0518ae55853 100644 --- a/receiver/filelogreceiver/go.mod +++ b/receiver/filelogreceiver/go.mod @@ -12,6 +12,7 @@ require ( go.opentelemetry.io/collector/consumer v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/filelogreceiver/go.sum b/receiver/filelogreceiver/go.sum index d1ed25acf50f..a065612cccb0 100644 --- a/receiver/filelogreceiver/go.sum +++ b/receiver/filelogreceiver/go.sum @@ -97,6 +97,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/receiver/journaldreceiver/go.mod b/receiver/journaldreceiver/go.mod index 07facc6d000e..c1a927ba1176 100644 --- a/receiver/journaldreceiver/go.mod +++ b/receiver/journaldreceiver/go.mod @@ -10,6 +10,7 @@ require ( go.opentelemetry.io/collector/confmap v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/consumer v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/journaldreceiver/go.sum b/receiver/journaldreceiver/go.sum index 6ccf7b0c2930..36053dd7b192 100644 --- a/receiver/journaldreceiver/go.sum +++ b/receiver/journaldreceiver/go.sum @@ -95,6 +95,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/receiver/mongodbatlasreceiver/go.mod b/receiver/mongodbatlasreceiver/go.mod index 7ab56f8c74e9..36158e8592b1 100644 --- a/receiver/mongodbatlasreceiver/go.mod +++ b/receiver/mongodbatlasreceiver/go.mod @@ -22,6 +22,7 @@ require ( go.opentelemetry.io/collector/filter v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/mongodbatlasreceiver/go.sum b/receiver/mongodbatlasreceiver/go.sum index 6044c0e7d05a..43be2ea884c0 100644 --- a/receiver/mongodbatlasreceiver/go.sum +++ b/receiver/mongodbatlasreceiver/go.sum @@ -114,6 +114,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/receiver/namedpipereceiver/go.mod b/receiver/namedpipereceiver/go.mod index 892c1c5d1a3e..c0af87c58d10 100644 --- a/receiver/namedpipereceiver/go.mod +++ b/receiver/namedpipereceiver/go.mod @@ -10,6 +10,7 @@ require ( go.opentelemetry.io/collector/confmap v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/consumer v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/namedpipereceiver/go.sum b/receiver/namedpipereceiver/go.sum index 5d27a8e52602..169f1922f668 100644 --- a/receiver/namedpipereceiver/go.sum +++ b/receiver/namedpipereceiver/go.sum @@ -97,6 +97,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/receiver/otlpjsonfilereceiver/go.mod b/receiver/otlpjsonfilereceiver/go.mod index 2037296f6353..c0abeb29b96e 100644 --- a/receiver/otlpjsonfilereceiver/go.mod +++ b/receiver/otlpjsonfilereceiver/go.mod @@ -11,6 +11,7 @@ require ( go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata/testdata v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/otlpjsonfilereceiver/go.sum b/receiver/otlpjsonfilereceiver/go.sum index cabadfdeca0b..2591121bea44 100644 --- a/receiver/otlpjsonfilereceiver/go.sum +++ b/receiver/otlpjsonfilereceiver/go.sum @@ -97,6 +97,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.2-0.20240611143128-7dfb57b9a go.opentelemetry.io/collector/pdata/testdata v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:czLc/oKlriUYBB6EZbPLIhWMKaG4viHtxflaSDMjnxg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/receiver/sqlqueryreceiver/go.mod b/receiver/sqlqueryreceiver/go.mod index 4ed7f0578049..9c4b008a2f89 100644 --- a/receiver/sqlqueryreceiver/go.mod +++ b/receiver/sqlqueryreceiver/go.mod @@ -17,6 +17,7 @@ require ( go.opentelemetry.io/collector/extension v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/sqlqueryreceiver/go.sum b/receiver/sqlqueryreceiver/go.sum index fef551fc1397..70e37a491143 100644 --- a/receiver/sqlqueryreceiver/go.sum +++ b/receiver/sqlqueryreceiver/go.sum @@ -314,6 +314,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= diff --git a/receiver/syslogreceiver/go.mod b/receiver/syslogreceiver/go.mod index 3009ec93e0c7..8889f02e5702 100644 --- a/receiver/syslogreceiver/go.mod +++ b/receiver/syslogreceiver/go.mod @@ -11,6 +11,7 @@ require ( go.opentelemetry.io/collector/consumer v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/pdata v1.9.1-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/syslogreceiver/go.sum b/receiver/syslogreceiver/go.sum index e808a117246e..61a7508acb33 100644 --- a/receiver/syslogreceiver/go.sum +++ b/receiver/syslogreceiver/go.sum @@ -103,6 +103,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/receiver/tcplogreceiver/go.mod b/receiver/tcplogreceiver/go.mod index 2ae65da55c1f..c8d2e89eeeda 100644 --- a/receiver/tcplogreceiver/go.mod +++ b/receiver/tcplogreceiver/go.mod @@ -9,6 +9,7 @@ require ( go.opentelemetry.io/collector/confmap v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/consumer v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/tcplogreceiver/go.sum b/receiver/tcplogreceiver/go.sum index e808a117246e..61a7508acb33 100644 --- a/receiver/tcplogreceiver/go.sum +++ b/receiver/tcplogreceiver/go.sum @@ -103,6 +103,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/receiver/udplogreceiver/go.mod b/receiver/udplogreceiver/go.mod index 5a6465fbc16b..90ca58820f11 100644 --- a/receiver/udplogreceiver/go.mod +++ b/receiver/udplogreceiver/go.mod @@ -9,6 +9,7 @@ require ( go.opentelemetry.io/collector/confmap v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/consumer v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/udplogreceiver/go.sum b/receiver/udplogreceiver/go.sum index 6ccf7b0c2930..36053dd7b192 100644 --- a/receiver/udplogreceiver/go.sum +++ b/receiver/udplogreceiver/go.sum @@ -95,6 +95,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= diff --git a/receiver/windowseventlogreceiver/go.mod b/receiver/windowseventlogreceiver/go.mod index 387133021fd1..442288e0f9df 100644 --- a/receiver/windowseventlogreceiver/go.mod +++ b/receiver/windowseventlogreceiver/go.mod @@ -10,6 +10,7 @@ require ( go.opentelemetry.io/collector/confmap v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/consumer v0.102.2-0.20240611143128-7dfb57b9ad1c go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c + go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c // indirect go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 go.uber.org/goleak v1.3.0 diff --git a/receiver/windowseventlogreceiver/go.sum b/receiver/windowseventlogreceiver/go.sum index 6ccf7b0c2930..36053dd7b192 100644 --- a/receiver/windowseventlogreceiver/go.sum +++ b/receiver/windowseventlogreceiver/go.sum @@ -95,6 +95,8 @@ go.opentelemetry.io/collector/pdata/testdata v0.102.1 h1:S3idZaJxy8M7mCC4PG4Eegm go.opentelemetry.io/collector/pdata/testdata v0.102.1/go.mod h1:JEoSJTMgeTKyGxoMRy48RMYyhkA5vCCq/abJq9B6vXs= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c h1:FBHGUHAan/LZwzIwxodReDH64HTfaDB1RYH3dD3rwjg= go.opentelemetry.io/collector/receiver v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:A/oJHfYc+1auPv6gbp0B/kR8DLtFIDCB/Z/3nDlHVQs= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c h1:uNEgGegvb9zVQ9i70Kit3oldAOP4FJkCuOmtswOjLUk= +go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ=