Skip to content

Commit 5fa0297

Browse files
authored
Redefine model/ and api_v2/ types as aliases to jaeger-idl/ types (#6602)
## Which problem is this PR solving? - part of #6595 - part of #6494 ## Description of the changes - change models ## How was this change tested? - `make lint`, `make test` ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [ ] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: nabil salah <[email protected]>
1 parent 07e4f57 commit 5fa0297

26 files changed

+365
-10334
lines changed

Makefile.Protobuf.mk

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,12 @@ define proto_compile
7878
endef
7979

8080
.PHONY: proto
81-
proto: proto-model \
82-
proto-api-v2 \
83-
proto-storage-v1 \
81+
proto: proto-storage-v1 \
8482
proto-hotrod \
8583
proto-zipkin \
8684
proto-openmetrics \
8785
proto-api-v3
8886

89-
.PHONY: proto-model
90-
proto-model:
91-
$(call proto_compile, model, idl/proto/api_v2/model.proto)
92-
$(PROTOC) -Imodel/proto --go_out=$(PWD)/model/ model/proto/model_test.proto
9387

9488
API_V2_PATCHED_DIR=proto-gen/.patched/api_v2
9589
.PHONY: patch-api-v2
@@ -99,11 +93,6 @@ patch-api-v2:
9993
cp idl/proto/api_v2/sampling.proto $(API_V2_PATCHED_DIR)/
10094
cat idl/proto/api_v2/query.proto | $(SED) 's|jaegertracing/jaeger-idl/model/v1.|jaegertracing/jaeger/model.|g' > $(API_V2_PATCHED_DIR)/query.proto
10195

102-
.PHONY: proto-api-v2
103-
proto-api-v2: patch-api-v2
104-
$(call proto_compile, proto-gen/api_v2, $(API_V2_PATCHED_DIR)/query.proto)
105-
$(call proto_compile, proto-gen/api_v2, $(API_V2_PATCHED_DIR)/collector.proto)
106-
$(call proto_compile, proto-gen/api_v2, $(API_V2_PATCHED_DIR)/sampling.proto)
10796

10897
.PHONY: proto-openmetrics
10998
proto-openmetrics:

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ require (
161161
github.com/hashicorp/hcl v1.0.0 // indirect
162162
github.com/iancoleman/strcase v0.3.0 // indirect
163163
github.com/inconshreveable/mousetrap v1.1.0 // indirect
164+
github.com/jaegertracing/jaeger-idl v0.0.0-20250122172554-3e525d710892
164165
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
165166
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
166167
github.com/jcmturner/gofork v1.7.6 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
329329
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
330330
github.com/ionos-cloud/sdk-go/v6 v6.1.11 h1:J/uRN4UWO3wCyGOeDdMKv8LWRzKu6UIkLEaes38Kzh8=
331331
github.com/ionos-cloud/sdk-go/v6 v6.1.11/go.mod h1:EzEgRIDxBELvfoa/uBN0kOQaqovLjUWEB7iW4/Q+t4k=
332+
github.com/jaegertracing/jaeger-idl v0.0.0-20250122172554-3e525d710892 h1:wDzNPLnnHOGCvGpLGn78gPo6Cqxpdil5TkS9dKfT2cE=
333+
github.com/jaegertracing/jaeger-idl v0.0.0-20250122172554-3e525d710892/go.mod h1:TimiEKGlMAcMZsKSHJkXNo0I0Q39iaENPswLXA1I2XY=
332334
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
333335
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
334336
github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=

model/dependencies.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@
44

55
package model
66

7+
import (
8+
modelv1 "github.com/jaegertracing/jaeger-idl/model/v1"
9+
)
10+
711
const (
812
// JaegerDependencyLinkSource describes a dependency diagram that was generated from Jaeger traces.
9-
JaegerDependencyLinkSource = "jaeger"
13+
JaegerDependencyLinkSource = modelv1.JaegerDependencyLinkSource
1014
)
11-
12-
// ApplyDefaults applies defaults to the DependencyLink.
13-
func (d DependencyLink) ApplyDefaults() DependencyLink {
14-
dd := d
15-
if dd.Source == "" {
16-
dd.Source = JaegerDependencyLinkSource
17-
}
18-
return dd
19-
}

model/doc.go

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

model/flags.go

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,18 @@
44

55
package model
66

7+
import (
8+
modelv1 "github.com/jaegertracing/jaeger-idl/model/v1"
9+
)
10+
711
const (
812
// SampledFlag is the bit set in Flags in order to define a span as a sampled span
9-
SampledFlag = Flags(1)
13+
SampledFlag = modelv1.SampledFlag
1014
// DebugFlag is the bit set in Flags in order to define a span as a debug span
11-
DebugFlag = Flags(2)
15+
DebugFlag = modelv1.SampledFlag
1216
// FirehoseFlag is the bit in Flags in order to define a span as a firehose span
13-
FirehoseFlag = Flags(8)
17+
FirehoseFlag = modelv1.SampledFlag
1418
)
1519

1620
// Flags is a bit map of flags for a span
17-
type Flags uint32
18-
19-
// ------- Flags -------
20-
21-
// SetSampled sets the Flags as sampled
22-
func (f *Flags) SetSampled() {
23-
f.setFlags(SampledFlag)
24-
}
25-
26-
// SetDebug set the Flags as sampled
27-
func (f *Flags) SetDebug() {
28-
f.setFlags(DebugFlag)
29-
}
30-
31-
// SetFirehose set the Flags as firehose enabled
32-
func (f *Flags) SetFirehose() {
33-
f.setFlags(FirehoseFlag)
34-
}
35-
36-
func (f *Flags) setFlags(bit Flags) {
37-
*f |= bit
38-
}
39-
40-
// IsSampled returns true if the Flags denote sampling
41-
func (f Flags) IsSampled() bool {
42-
return f.checkFlags(SampledFlag)
43-
}
44-
45-
// IsDebug returns true if the Flags denote debugging
46-
// Debugging can be useful in testing tracing availability or correctness
47-
func (f Flags) IsDebug() bool {
48-
return f.checkFlags(DebugFlag)
49-
}
50-
51-
// IsFirehoseEnabled returns true if firehose is enabled
52-
// Firehose is used to decide whether to index a span or not
53-
func (f Flags) IsFirehoseEnabled() bool {
54-
return f.checkFlags(FirehoseFlag)
55-
}
56-
57-
func (f Flags) checkFlags(bit Flags) bool {
58-
return f&bit == bit
59-
}
21+
type Flags = modelv1.Flags

model/hash.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,12 @@
55
package model
66

77
import (
8-
"hash/fnv"
9-
"io"
8+
modelv1 "github.com/jaegertracing/jaeger-idl/model/v1"
109
)
1110

1211
// Hashable interface is for type that can participate in a hash computation
1312
// by writing their data into io.Writer, which is usually an instance of hash.Hash.
14-
type Hashable interface {
15-
Hash(w io.Writer) error
16-
}
13+
type Hashable = modelv1.Hashable
1714

1815
// HashCode calculates a FNV-1a hash code for a Hashable object.
19-
func HashCode(o Hashable) (uint64, error) {
20-
h := fnv.New64a()
21-
if err := o.Hash(h); err != nil {
22-
return 0, err
23-
}
24-
return h.Sum64(), nil
25-
}
16+
var HashCode = modelv1.HashCode

0 commit comments

Comments
 (0)