Skip to content

Conversation

@kripanshdevtron
Copy link
Contributor

@kripanshdevtron kripanshdevtron commented Dec 20, 2022

Description

This PR adds support for Otel Integration for Devtron Service. It will send Trace data to Otel Collector.

Fixes #2874

How Has This Been Tested?

  • Tested with Otel Collector
  • Tested without Otel Collector Url, there should be not impact even no collector URL is provided.
  • Tested directly with Jaeger as well.

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?


@gitguardian
Copy link

gitguardian bot commented Dec 20, 2022

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
141558 Generic High Entropy Secret b8fe162 scripts/devtron-reference-helm-charts/deployment-chart_1-0-0/env-values.yaml View secret
2763127 Generic High Entropy Secret b8fe162 scripts/devtron-reference-helm-charts/deployment-chart_1-0-0/secrets-test-values.yaml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

Copy link
Contributor

@nishant-d nishant-d left a comment

Choose a reason for hiding this comment

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

  1. we need to develop convention for TracerName and context name
  2. is there any way we can decorate all methods with tracer automatically ? does this even makes sense ?

App.go Outdated
tp := otel.Init(serviceName)
defer func() {
if err := tp.Shutdown(context.Background()); err != nil {
log.Printf("Error shutting down tracer provider: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

use Logger.Infow/debugw

}
if err == nil && len(clusterIds) > 0 {
// get helm apps which are created using cd_pipelines
newCtx, span := otel.Tracer("pipelineRepository").Start(ctx, "GetAppAndEnvDetailsForDeploymentAppTypePipeline")
Copy link
Contributor

Choose a reason for hiding this comment

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

this method might be called from diff places Tracer("pipelineRepository").Start(ctx, "GetAppAndEnvDetailsForDeploymentAppTypePipeline") will change accordingly

Copy link
Contributor

Choose a reason for hiding this comment

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

same for all Tracer impl

}
}

func OverrideK8sHttpClient(restConfig *rest.Config) (*http.Client, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

name me contextually


// Init configures an OpenTelemetry exporter and trace provider
func Init(serviceName string) *sdktrace.TracerProvider {
var collectorURL = "otel-collector.observability:4317"
Copy link
Contributor

Choose a reason for hiding this comment

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

get it from env

),
)
if err != nil {
log.Fatal(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

return error instead of log.Fatal

@kripanshdevtron kripanshdevtron marked this pull request as ready for review January 19, 2023 08:02
@kripanshdevtron kripanshdevtron self-assigned this Jan 19, 2023
@kripanshdevtron kripanshdevtron added the enhancement New feature or request label Jan 19, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

No Coverage information No Coverage information
0.7% 0.7% Duplication

@kripanshdevtron kripanshdevtron merged commit 5e4459e into main Jan 20, 2023
@kripanshdevtron kripanshdevtron deleted the trace-observability-otlp branch January 20, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: OpenTelemetry Tracing Integration for Devtron

4 participants