diff --git a/logging/log.go b/logging/log.go
index 14759d1cdc..ebe600f7f7 100644
--- a/logging/log.go
+++ b/logging/log.go
@@ -158,7 +158,6 @@ type Logger interface {
Metrics(category telemetryspec.Category, metrics telemetryspec.MetricDetails, details interface{})
Event(category telemetryspec.Category, identifier telemetryspec.Event)
EventWithDetails(category telemetryspec.Category, identifier telemetryspec.Event, details interface{})
- StartOperation(category telemetryspec.Category, identifier telemetryspec.Operation) TelemetryOperation
GetTelemetrySession() string
GetTelemetryGUID() string
GetInstanceName() string
@@ -458,13 +457,6 @@ func (l logger) EventWithDetails(category telemetryspec.Category, identifier tel
}
}
-func (l logger) StartOperation(category telemetryspec.Category, identifier telemetryspec.Operation) TelemetryOperation {
- if l.loggerState.telemetry != nil {
- return l.loggerState.telemetry.logStartOperation(l, category, identifier)
- }
- return TelemetryOperation{}
-}
-
func (l logger) CloseTelemetry() {
if l.loggerState.telemetry != nil {
l.loggerState.telemetry.Close()
diff --git a/logging/telemetry.go b/logging/telemetry.go
index 99e7e83ad7..7daa471920 100644
--- a/logging/telemetry.go
+++ b/logging/telemetry.go
@@ -244,12 +244,6 @@ func (t *telemetryState) logEvent(l logger, category telemetryspec.Category, ide
t.logTelemetry(l, buildMessage(string(category), string(identifier)), details)
}
-func (t *telemetryState) logStartOperation(l logger, category telemetryspec.Category, identifier telemetryspec.Operation) TelemetryOperation {
- op := makeTelemetryOperation(t, category, identifier)
- t.logTelemetry(l, buildMessage(string(category), string(identifier), "Start"), nil)
- return op
-}
-
func buildMessage(args ...string) string {
message := telemetryPrefix + strings.Join(args, telemetrySeparator)
return message
diff --git a/logging/telemetryCommon.go b/logging/telemetryCommon.go
index e198833dc9..41a13d9497 100644
--- a/logging/telemetryCommon.go
+++ b/logging/telemetryCommon.go
@@ -17,24 +17,11 @@
package logging
import (
- "sync"
- "time"
-
"github.com/algorand/go-deadlock"
"github.com/sirupsen/logrus"
-
- "github.com/algorand/go-algorand/logging/telemetryspec"
+ "sync"
)
-// TelemetryOperation wraps the context for an ongoing telemetry.StartOperation call
-type TelemetryOperation struct {
- startTime time.Time
- category telemetryspec.Category
- identifier telemetryspec.Operation
- telemetryState *telemetryState
- pending int32
-}
-
type telemetryHook interface {
Fire(entry *logrus.Entry) error
Levels() []logrus.Level
diff --git a/logging/telemetryOperation.go b/logging/telemetryOperation.go
deleted file mode 100644
index 4663a16af2..0000000000
--- a/logging/telemetryOperation.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2019-2023 Algorand, Inc.
-// This file is part of go-algorand
-//
-// go-algorand is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// go-algorand is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with go-algorand. If not, see .
-
-package logging
-
-import (
- "sync/atomic"
- "time"
-
- "github.com/sirupsen/logrus"
-
- "github.com/algorand/go-algorand/logging/telemetryspec"
-)
-
-func makeTelemetryOperation(telemetryState *telemetryState, category telemetryspec.Category, identifier telemetryspec.Operation) TelemetryOperation {
- return TelemetryOperation{
- startTime: time.Now(),
- category: category,
- identifier: identifier,
- telemetryState: telemetryState,
- pending: 1, // Indicates we should process Stop() when called
- }
-}
-
-// Stop is called to report the completion of an operation started by logger.StartOperation
-func (op *TelemetryOperation) Stop(l logger, details interface{}) {
- // If we have already called Stop, or if we're a nil operation, don't do anything
- if !atomic.CompareAndSwapInt32(&op.pending, 1, 0) {
- return
- }
-
- elapsed := time.Since(op.startTime).Nanoseconds()
- entry := l.WithFields(logrus.Fields{
- "duration": elapsed,
- }).(logger)
-
- op.telemetryState.logTelemetry(entry, buildMessage(string(op.category), string(op.identifier), "Stop"), details)
-}
diff --git a/logging/telemetry_test.go b/logging/telemetry_test.go
index 4729463787..1d1b9f8d44 100644
--- a/logging/telemetry_test.go
+++ b/logging/telemetry_test.go
@@ -19,12 +19,10 @@ package logging
import (
"encoding/json"
"fmt"
- "os"
- "testing"
- "time"
-
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
+ "os"
+ "testing"
"github.com/algorand/go-deadlock"
@@ -159,17 +157,11 @@ func TestTelemetryHook(t *testing.T) {
f.telem.logMetrics(f.l, testString1, testMetrics{}, nil)
f.telem.logEvent(f.l, testString1, testString2, nil)
- op := f.telem.logStartOperation(f.l, testString1, testString2)
- time.Sleep(1 * time.Millisecond)
- op.Stop(f.l, nil)
entries := f.hookEntries()
- a.Equal(4, len(entries))
+ a.Equal(2, len(entries))
a.Equal(buildMessage(testString1, testString2), entries[0])
a.Equal(buildMessage(testString1, testString2), entries[1])
- a.Equal(buildMessage(testString1, testString2, "Start"), entries[2])
- a.Equal(buildMessage(testString1, testString2, "Stop"), entries[3])
- a.NotZero(f.hookData()[3]["duration"])
}
func TestNilMetrics(t *testing.T) {
@@ -182,23 +174,6 @@ func TestNilMetrics(t *testing.T) {
a.Zero(len(f.hookEntries()))
}
-func TestMultipleOperationStop(t *testing.T) {
- partitiontest.PartitionTest(t)
- a := require.New(t)
- f := makeTelemetryTestFixture(logrus.InfoLevel)
-
- op := f.telem.logStartOperation(f.l, testString1, testString2)
- op.Stop(f.l, nil)
-
- // Start and stop should result in 2 entries
- a.Equal(2, len(f.hookEntries()))
-
- op.Stop(f.l, nil)
-
- // Calling stop again should not result in another entry
- a.Equal(2, len(f.hookEntries()))
-}
-
func TestDetails(t *testing.T) {
partitiontest.PartitionTest(t)
a := require.New(t)
diff --git a/logging/telemetryspec/operation.go b/logging/telemetryspec/operation.go
deleted file mode 100644
index e1675c79dc..0000000000
--- a/logging/telemetryspec/operation.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2019-2023 Algorand, Inc.
-// This file is part of go-algorand
-//
-// go-algorand is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// go-algorand is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with go-algorand. If not, see .
-
-package telemetryspec
-
-// Telemetry operations
-
-// Operation is the type used to identify strings used for telemetry operation identifiers.
-// We want these to be stable and easy to find / document so we can create queries against them.
-type Operation string