-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cmd/telemetrygen] Bad default argument values for HTTP exporter mode #26999
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Thanks for the report @jmsnll, assigning P1 since this is important to fix for alignment with the OTLP spec |
My pleasure! I'm happy to open a PR for this also if my proposed solution looks sound |
The proposed solution makes sense to me, feel free to open a PR! :) |
**Description:** - Refactored and moved `otlp-http-url-path` flag from the common flags for each command - Added flag to the `traces` command with the default `/v1/traces` - Added flag to the `metrics` command with the default `/v1/metrics` - Flag was not used for the `logs` command so no longer exposed - Handle changing the default endpoint based on the communication mode (gRPC or HTTP) - Flag `--otlp-endpoint` now defaults to empty string and targets a new attribute `CustomEndpoint` on `common.Config` - Added the `Endpoint()` getter function to the `common.Config` struct for retrieving the correct endpoint - When `CustomEndpoint` is empty then either `DefaultGRPCEndpoint` or `DefaultHTTPEndpoint` are chosen based upon the value of `config.UseHTTP` - **Misc**: Split out the creation of trace/metric exporters into standalone factory functions with docstrings available in `exporters.go` in both modules - **Misc**: Removed the "default value is" from the descriptions of some flags as it was repeated information **Link to tracking Issue:** #26999 **Testing:** Added new set of unit tests to cover the addition of the `config.Endpoint()` getter. Running `telemetrygen traces --otlp-http --otlp-insecure` now correctly sends traces using HTTP to the default HTTP endpoint. **Documentation:** No documentation added/changed but updated some command flag descriptions. --------- Co-authored-by: Alex Boten <[email protected]>
…etry#27007) **Description:** - Refactored and moved `otlp-http-url-path` flag from the common flags for each command - Added flag to the `traces` command with the default `/v1/traces` - Added flag to the `metrics` command with the default `/v1/metrics` - Flag was not used for the `logs` command so no longer exposed - Handle changing the default endpoint based on the communication mode (gRPC or HTTP) - Flag `--otlp-endpoint` now defaults to empty string and targets a new attribute `CustomEndpoint` on `common.Config` - Added the `Endpoint()` getter function to the `common.Config` struct for retrieving the correct endpoint - When `CustomEndpoint` is empty then either `DefaultGRPCEndpoint` or `DefaultHTTPEndpoint` are chosen based upon the value of `config.UseHTTP` - **Misc**: Split out the creation of trace/metric exporters into standalone factory functions with docstrings available in `exporters.go` in both modules - **Misc**: Removed the "default value is" from the descriptions of some flags as it was repeated information **Link to tracking Issue:** open-telemetry#26999 **Testing:** Added new set of unit tests to cover the addition of the `config.Endpoint()` getter. Running `telemetrygen traces --otlp-http --otlp-insecure` now correctly sends traces using HTTP to the default HTTP endpoint. **Documentation:** No documentation added/changed but updated some command flag descriptions. --------- Co-authored-by: Alex Boten <[email protected]>
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Fixed by #27007 |
Component(s)
cmd/telemetrygen
What happened?
Description
The default behaviour of telemetrygen when trying to use HTTP exporters is broken out of the box.
otlp-http-url-path
is current set ininternal/common/config.go
file with a default value of/v1/metrics
so it is pointing toward the wrong endpoint when trying to use thetraces
sub-commandotlp-http
is used to indicate weather to use gRPC or HTTP exporters butotlp-endpoint
always has a default value pointing toward the gRPC receiver port4317
Steps to Reproduce
Have a locally running collector with HTTP and gRPC receivers enabled, then run telemetrygen to send traces using HTTP with:
telemetrygen traces --otlp-http --otlp-insecure
Expected Result
otlp-http-url-path
has a value of/v1/traces
by defaultotlp-http
flag and have not set a value forotlp-endpoint
we send traces tolocalhost:4318
Actual Result
We attempt to send traces via HTTP to the wrong endpoint (
/v1/metrics
) and the incorrect default port for the HTTP receiver:4317
Proposed Solution
otlp-http-url-path
from the common flags and have one in each of theinternal/traces/config.go
andinternal/metrics/config.go
module with the appropriate default value.otlp-http
has been set and overrideotlp-endpoint
tolocalhost:4318
if it has it's default value oflocalhost:4317
Collector version
v0.85.0
Environment information
No response
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: