Skip to content

Commit

Permalink
Comment out usage of OTel metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm committed Nov 29, 2024
1 parent 0d46d11 commit 3b395cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions cmd/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ User profiles can be configured with a "config.yml" file in the profile director

loc, err := locations.NewLocationManager()
if err != nil {
telemetry.ProfilesListFailureCnt.Add(globalCtx, 1)
// telemetry.ProfilesListFailureCnt.Add(globalCtx, 1)
span.SetStatus(codes.Error, "error fetching profile")
return fmt.Errorf("error fetching profile: %w", err)
}
Expand All @@ -132,20 +132,20 @@ User profiles can be configured with a "config.yml" file in the profile director
_, fetchSpan := telemetry.CmdTracer.Start(globalCtx, "Fetch all profiles")
profileList, err := profile.FetchAllProfiles(loc.ProfileDir())
if err != nil {
telemetry.ProfilesListFailureCnt.Add(globalCtx, 1)
// telemetry.ProfilesListFailureCnt.Add(globalCtx, 1)
fetchSpan.SetStatus(codes.Error, "error listing all profiles")
return fmt.Errorf("error listing all profiles: %w", err)
}
if len(profileList) == 0 {
fmt.Println("There are no profiles yet.")
telemetry.ProfilesListSuccessCnt.Add(globalCtx, 1)
// telemetry.ProfilesListSuccessCnt.Add(globalCtx, 1)
return nil
}
fetchSpan.End()

format, err := cmd.Flags().GetString(cobraext.ProfileFormatFlagName)
if err != nil {
telemetry.ProfilesListFailureCnt.Add(globalCtx, 1)
// telemetry.ProfilesListFailureCnt.Add(globalCtx, 1)
span.SetStatus(codes.Error, "flag error")
return cobraext.FlagParsingError(err, cobraext.ProfileFormatFlagName)
}
Expand Down Expand Up @@ -175,9 +175,9 @@ User profiles can be configured with a "config.yml" file in the profile director
if err != nil {
formatSpan.RecordError(err)
formatSpan.SetStatus(codes.Error, "error formatting profiles")
telemetry.ProfilesListFailureCnt.Add(globalCtx, 1)
// telemetry.ProfilesListFailureCnt.Add(globalCtx, 1)
} else {
telemetry.ProfilesListSuccessCnt.Add(globalCtx, 1)
// telemetry.ProfilesListSuccessCnt.Add(globalCtx, 1)
}
formatSpan.End()
return err
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func RootCmd() *cobra.Command {
telemetry.CmdTracer = otel.Tracer("elastic.co/elastic-package")

// TODO: Just a quick example to send metrics
telemetry.CmdMeter = otel.Meter("elastic.co/elastic-package")
telemetry.SetupMetrics(telemetry.CmdMeter)
// telemetry.CmdMeter = otel.Meter("elastic.co/elastic-package")
// telemetry.SetupMetrics(telemetry.CmdMeter)

otelShutdown = shutdown

Expand Down

0 comments on commit 3b395cb

Please sign in to comment.