You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
If I configure the HTTP Check receiver with an endpoint URL without a scheme, the receiver does not fail, but instead produces the httpcheck.error metric on each scrape.
$ otelcontribcol --config config.yamlError: invalid configuration: receivers::httpcheck: "endpoint" must be in the form of <scheme>://<hostname>:<port>: parse "opentelemetry.io": invalid URI for request2023/06/01 23:48:58 collector server run finished with error: invalid configuration: receivers::httpcheck: "endpoint" must be in the form of <scheme>://<hostname>:<port>: parse "opentelemetry.io": invalid URI for request
Actual result:
$ otelcontribcol --config config.yaml2023-06-01T23:21:00.657+0200 info service/telemetry.go:104 Setting up own telemetry...2023-06-01T23:21:00.657+0200 info service/telemetry.go:127 Serving Prometheus metrics {"address": ":8888", "level": "Basic"}2023-06-01T23:21:00.657+0200 info [email protected]/exporter.go:275 Development component. May change in the future. {"kind": "exporter", "data_type": "metrics", "name": "logging"}2023-06-01T23:21:00.658+0200 info [email protected]/receiver.go:296 Development component. May change in the future. {"kind": "receiver", "name": "httpcheck", "data_type": "metrics"}2023-06-01T23:21:00.679+0200 info service/service.go:131 Starting otelcontribcol... {"Version": "0.78.0-dev", "NumCPU": 16}2023-06-01T23:21:00.679+0200 info extensions/extensions.go:30 Starting extensions...2023-06-01T23:21:00.679+0200 info service/service.go:148 Everything is ready. Begin running and processing data.2023-06-01T23:21:03.680+0200 info MetricsExporter {"kind": "exporter", "data_type": "metrics", "name": "logging", "resource metrics": 1, "metrics": 2, "data points": 6}2023-06-01T23:21:03.680+0200 info ResourceMetrics #0Resource SchemaURL: ScopeMetrics #0ScopeMetrics SchemaURL: InstrumentationScope otelcol/httpcheckreceiver 0.78.0-devMetric #0Descriptor: -> Name: httpcheck.error -> Description: Records errors occurring during HTTP check. -> Unit: {error} -> DataType: Sum -> IsMonotonic: false -> AggregationTemporality: CumulativeNumberDataPoints #0Data point attributes: -> http.url: Str() -> error.message: Str(Get "": unsupported protocol scheme "")StartTimestamp: 2023-06-01 21:21:00.658226525 +0000 UTCTimestamp: 2023-06-01 21:21:03.6801654 +0000 UTCValue: 1Metric #1Descriptor: -> Name: httpcheck.status -> Description: 1 if the check resulted in status_code matching the status_class, otherwise 0. -> Unit: 1 -> DataType: Sum -> IsMonotonic: false -> AggregationTemporality: CumulativeNumberDataPoints #0Data point attributes: -> http.url: Str() -> http.status_code: Int(0) -> http.method: Str(GET) -> http.status_class: Str(1xx)StartTimestamp: 2023-06-01 21:21:00.658226525 +0000 UTCTimestamp: 2023-06-01 21:21:03.6801654 +0000 UTCValue: 0NumberDataPoints #1Data point attributes: -> http.url: Str() -> http.status_code: Int(0) -> http.method: Str(GET) -> http.status_class: Str(2xx)StartTimestamp: 2023-06-01 21:21:00.658226525 +0000 UTCTimestamp: 2023-06-01 21:21:03.6801654 +0000 UTCValue: 0NumberDataPoints #2Data point attributes: -> http.url: Str() -> http.status_code: Int(0) -> http.method: Str(GET) -> http.status_class: Str(3xx)StartTimestamp: 2023-06-01 21:21:00.658226525 +0000 UTCTimestamp: 2023-06-01 21:21:03.6801654 +0000 UTCValue: 0NumberDataPoints #3Data point attributes: -> http.url: Str() -> http.status_code: Int(0) -> http.method: Str(GET) -> http.status_class: Str(4xx)StartTimestamp: 2023-06-01 21:21:00.658226525 +0000 UTCTimestamp: 2023-06-01 21:21:03.6801654 +0000 UTCValue: 0NumberDataPoints #4Data point attributes: -> http.url: Str() -> http.status_code: Int(0) -> http.method: Str(GET) -> http.status_class: Str(5xx)StartTimestamp: 2023-06-01 21:21:00.658226525 +0000 UTCTimestamp: 2023-06-01 21:21:03.6801654 +0000 UTCValue: 0 {"kind": "exporter", "data_type": "metrics", "name": "logging"}
Describe the solution you'd like
The receiver should fail fast during configuration validation, saying that you need to provide a URL with a scheme.
Describe alternatives you've considered
No response
Additional context
There's already an error message prepared for this scenario in code, but it's not being used because the url.Parse function used in Validate() method does not fail on URLs without scheme. I believe we should use url.ParseRequestURI function instead.
The text was updated successfully, but these errors were encountered:
Component(s)
receiver/httpcheck
Collector version
v0.78.0
Is your feature request related to a problem? Please describe.
If I configure the HTTP Check receiver with an endpoint URL without a scheme, the receiver does not fail, but instead produces the
httpcheck.error
metric on each scrape.Expected output:
Actual result:
Describe the solution you'd like
The receiver should fail fast during configuration validation, saying that you need to provide a URL with a scheme.
Describe alternatives you've considered
No response
Additional context
There's already an error message prepared for this scenario in code, but it's not being used because the
url.Parse
function used inValidate()
method does not fail on URLs without scheme. I believe we should useurl.ParseRequestURI
function instead.The text was updated successfully, but these errors were encountered: