Skip to content

Commit 2e2e155

Browse files
authored
Merge pull request #633 from getsentry/txiao/chore/remove-unused-metrics-endpoint
chore(metrics): Remove unused metrics endpoint
2 parents cf2eae3 + 833015e commit 2e2e155

File tree

4 files changed

+1
-205
lines changed

4 files changed

+1
-205
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- Classify macOS frames from an application as application frames. ([#604](https://github.com/getsentry/vroom/pull/604))
3737
- Return number of occurrences in flamegraph. ([#622](https://github.com/getsentry/vroom/pull/622), [#625](https://github.com/getsentry/vroom/pull/625))
3838
- Use function duration when computing metrics ([#627](https://github.com/getsentry/vroom/pull/627), [#628](https://github.com/getsentry/vroom/pull/628), [#629](https://github.com/getsentry/vroom/pull/629), [#630](https://github.com/getsentry/vroom/pull/630))
39+
- Remove Unused metrics endpoint ([#633](https://github.com/getsentry/vroom/pull/633))
3940

4041
**Bug Fixes**:
4142

cmd/vroom/main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,6 @@ func (e *environment) newRouter() (*httprouter.Router, error) {
137137
"/organizations/:organization_id/flamegraph",
138138
e.postFlamegraph,
139139
},
140-
{
141-
http.MethodPost,
142-
"/organizations/:organization_id/metrics",
143-
e.postMetrics,
144-
},
145140
{http.MethodGet, "/health", e.getHealth},
146141
{http.MethodPost, "/chunk", e.postChunk},
147142
{http.MethodPost, "/profile", e.postProfile},

cmd/vroom/metrics.go

Lines changed: 0 additions & 90 deletions
This file was deleted.

internal/metrics/metrics.go

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
package metrics
22

33
import (
4-
"context"
54
"errors"
65
"math"
76
"sort"
87
"strconv"
98

10-
"github.com/getsentry/sentry-go"
11-
"github.com/getsentry/vroom/internal/chunk"
129
"github.com/getsentry/vroom/internal/examples"
1310
"github.com/getsentry/vroom/internal/nodetree"
14-
"github.com/getsentry/vroom/internal/profile"
15-
"github.com/getsentry/vroom/internal/storageutil"
16-
"gocloud.dev/blob"
1711
)
1812

1913
type (
@@ -203,107 +197,3 @@ func CapAndFilterFunctions(functions []nodetree.CallTreeFunction, maxUniqueFunct
203197
}
204198
return appFunctions
205199
}
206-
207-
func (ma *Aggregator) GetMetricsFromCandidates(
208-
ctx context.Context,
209-
storage *blob.Bucket,
210-
organizationID uint64,
211-
transactionProfileCandidates []examples.TransactionProfileCandidate,
212-
continuousProfileCandidates []examples.ContinuousProfileCandidate,
213-
jobs chan storageutil.ReadJob,
214-
) ([]examples.FunctionMetrics, error) {
215-
hub := sentry.GetHubFromContext(ctx)
216-
217-
results := make(chan storageutil.ReadJobResult)
218-
defer close(results)
219-
220-
go func() {
221-
for _, candidate := range transactionProfileCandidates {
222-
jobs <- profile.ReadJob{
223-
Ctx: ctx,
224-
OrganizationID: organizationID,
225-
ProjectID: candidate.ProjectID,
226-
ProfileID: candidate.ProfileID,
227-
Storage: storage,
228-
Result: results,
229-
}
230-
}
231-
232-
for _, candidate := range continuousProfileCandidates {
233-
jobs <- chunk.ReadJob{
234-
Ctx: ctx,
235-
OrganizationID: organizationID,
236-
ProjectID: candidate.ProjectID,
237-
ProfilerID: candidate.ProfilerID,
238-
ChunkID: candidate.ChunkID,
239-
TransactionID: candidate.TransactionID,
240-
ThreadID: candidate.ThreadID,
241-
Start: candidate.Start,
242-
End: candidate.End,
243-
Storage: storage,
244-
Result: results,
245-
}
246-
}
247-
}()
248-
249-
numCandidates := len(transactionProfileCandidates) + len(continuousProfileCandidates)
250-
251-
for i := 0; i < numCandidates; i++ {
252-
res := <-results
253-
254-
err := res.Error()
255-
if err != nil {
256-
if errors.Is(err, storageutil.ErrObjectNotFound) {
257-
continue
258-
}
259-
if errors.Is(err, context.DeadlineExceeded) {
260-
return nil, err
261-
}
262-
if hub != nil {
263-
hub.CaptureException(err)
264-
}
265-
continue
266-
}
267-
268-
var resultMetadata examples.ExampleMetadata
269-
if result, ok := res.(profile.ReadJobResult); ok {
270-
profileCallTrees, err := result.Profile.CallTrees()
271-
if err != nil {
272-
hub.CaptureException(err)
273-
continue
274-
}
275-
start, end := result.Profile.StartAndEndEpoch()
276-
resultMetadata = examples.NewExampleFromProfileID(
277-
result.Profile.ProjectID(),
278-
result.Profile.ID(),
279-
start,
280-
end,
281-
)
282-
functions := CapAndFilterFunctions(ExtractFunctionsFromCallTrees(profileCallTrees, ma.MinDepth), int(ma.MaxUniqueFunctions), true)
283-
ma.AddFunctions(functions, resultMetadata)
284-
} else if result, ok := res.(chunk.ReadJobResult); ok {
285-
chunkCallTrees, err := result.Chunk.CallTrees(result.ThreadID)
286-
if err != nil {
287-
hub.CaptureException(err)
288-
continue
289-
}
290-
291-
resultMetadata = examples.NewExampleFromProfilerChunk(
292-
result.Chunk.GetProjectID(),
293-
result.Chunk.GetProfilerID(),
294-
result.Chunk.GetID(),
295-
result.TransactionID,
296-
result.ThreadID,
297-
result.Start,
298-
result.End,
299-
)
300-
functions := CapAndFilterFunctions(ExtractFunctionsFromCallTrees(chunkCallTrees, ma.MinDepth), int(ma.MaxUniqueFunctions), true)
301-
ma.AddFunctions(functions, resultMetadata)
302-
} else {
303-
// this should never happen
304-
return nil, errors.New("unexpected result from storage")
305-
}
306-
}
307-
308-
return ma.ToMetrics(), nil
309-
}

0 commit comments

Comments
 (0)