Skip to content
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

feat: Add support for tracing for http addon #1021

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bhussain91
Copy link

@bhussain91 bhussain91 commented May 9, 2024

Signed-off-by: Bilal Hussain [email protected]

Provide a description of what has been changed
The change is to add tracing capability into the keda http addon using opentelemetry. The changes allows the add on to generate and export spans to console (development) or otel gRPC endpoint. Further information on how to configure tracing can be found in the docs

Checklist

Fixes #

@bhussain91 bhussain91 requested a review from a team as a code owner May 9, 2024 12:00
@bhussain91 bhussain91 force-pushed the feature/keda-http-addon-tracing branch 2 times, most recently from f945b23 to 1eb19da Compare May 9, 2024 12:53
@bhussain91 bhussain91 force-pushed the feature/keda-http-addon-tracing branch from f64c6dc to 480050e Compare May 17, 2024 12:16
Comment on lines 28 to 31
- name: KEDA_HTTP_TRACE_ENDPOINT
value: "opentelemetry-collector.open-telemetry-system:4318"
- name: KEDA_HTTP_TRACE_INSECURE
value: "true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't noticed it with the first PR was created, but we should respect the OTEL spec for env vars: https://opentelemetry.io/docs/specs/otel/protocol/exporter/

Could you change the new envs to respect (or use) the SDK envs?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored to using the OTEL SDK envs instead

@bhussain91 bhussain91 force-pushed the feature/keda-http-addon-tracing branch 4 times, most recently from c95f18e to eb64c18 Compare May 23, 2024 15:52
Comment on lines 8 to 13
type Tracing struct {
// States whether tracing should be enabled, False by default
Enabled bool `envconfig:"KEDA_HTTP_TRACING_ENABLED" default:"false"`
// Sets what tracing export to use, must be one of: console,otlphttp
Exporter string `envconfig:"KEDA_HTTP_TRACE_EXPORTER" default:"console"`
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are going to rename other envs to be aligned with the spec, so we have to change these 2 too

What about

Suggested change
type Tracing struct {
// States whether tracing should be enabled, False by default
Enabled bool `envconfig:"KEDA_HTTP_TRACING_ENABLED" default:"false"`
// Sets what tracing export to use, must be one of: console,otlphttp
Exporter string `envconfig:"KEDA_HTTP_TRACE_EXPORTER" default:"console"`
}
type Tracing struct {
// States whether tracing should be enabled, False by default
Enabled bool `envconfig:"OTEL_EXPORTER_OTLP_TRACES_ENABLED" default:"false"`
// Sets what tracing export to use, must be one of: console,otlphttp
Exporter string `envconfig:"OTEL_EXPORTER_OTLP_PROTOCOL" default:"console"`
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored as per comment

switch strings.ToLower(tCfg.Exporter) {
case "console":
return stdouttrace.New()
case "otlphttp":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this should be http/protobuf based on docs: https://opentelemetry.io/docs/specs/otel/protocol/exporter/#specify-protocol

Does it make sense supporting also grpc?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added both supports

@zroubalik
Copy link
Member

@bhussain91 any update on this please?

Signed-off-by: Bilal Hussain <[email protected]>
@bhussain91 bhussain91 force-pushed the feature/keda-http-addon-tracing branch from eb64c18 to b093281 Compare June 5, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants