Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #16

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
03faf67
add conversion from Int64 and Double OTLP metrics for Promehteus Remo…
huyan0 Aug 28, 2020
88634ae
Rename some internal funcs to allow the oc to new structs to reuse th…
bogdandrutu Aug 28, 2020
02bf8dc
Add testdata for the new metrics structs (#1665)
bogdandrutu Aug 28, 2020
1f7fddc
Tune testdata, and update testdataold to use same names (#1667)
bogdandrutu Aug 29, 2020
fadd7d5
Add OC to new metrics structure conversion. (#1666)
bogdandrutu Aug 29, 2020
4649b3b
Remove dependency on the old errors (#1668)
bogdandrutu Aug 29, 2020
5257ff0
Fix flaky test TestOCToMetrics_ResourceInMetric (#1670)
bogdandrutu Aug 29, 2020
c157903
Add pdatautil support for the new internal metrics structs (#1669)
bogdandrutu Aug 29, 2020
f9166ee
Rename getters for oneof and metricdata types (#1675)
bogdandrutu Aug 30, 2020
7c315f9
Fix typo Mame -> Name (#1676)
bogdandrutu Aug 30, 2020
52c9e7f
Add initial draft of the oneof generator, fixes issue in contrib (#1677)
bogdandrutu Aug 30, 2020
c9135e0
Change resource processor to use the new metrics internal structs (#1…
bogdandrutu Aug 30, 2020
f36fd70
Change queued processor/exporterhelper tests to use the new metrics i…
bogdandrutu Aug 31, 2020
6e05a9a
Change opencensus recv/exp to use the new metrics internal structs (#…
bogdandrutu Aug 31, 2020
6a0d262
Change processor tests to use the new metrics internal structs (#1680)
bogdandrutu Aug 31, 2020
a1ec7a8
Fix bug in copy data, the data were not deeply copied (#1683)
bogdandrutu Aug 31, 2020
550df0e
Add SetDataType and remove Set for every type (#1684)
bogdandrutu Aug 31, 2020
474f475
Change sink exporter to use the new metrics internal structs (#1678)
bogdandrutu Aug 31, 2020
c3f7dd5
Change logging exporter to use the new metrics internal structs (#1679)
bogdandrutu Aug 31, 2020
0e1fe61
Bump github.com/google/uuid from 1.1.1 to 1.1.2 (#1690)
dependabot[bot] Aug 31, 2020
e65a63f
Bump github.com/google/go-cmp from 0.5.1 to 0.5.2 (#1688)
dependabot[bot] Aug 31, 2020
fc77725
Change host metrics receiver to use the new metrics internal structs …
bogdandrutu Aug 31, 2020
09d5ee7
Change tests to use the new internal metrics structs (#1695)
bogdandrutu Aug 31, 2020
5b7093d
rm go.sum; go mod tidy (#1694)
bogdandrutu Aug 31, 2020
f586657
Bump github.com/ory/go-acc from 0.2.5 to 0.2.6 (#1689)
dependabot[bot] Aug 31, 2020
b3b8f20
implement histogram conversion (#1643)
huyan0 Aug 31, 2020
f8c4ecb
Change goldendataset to use the new internal metrics structs (#1697)
bogdandrutu Aug 31, 2020
3c961c9
Change testbed to use the new internal metrics structs (#1698)
bogdandrutu Aug 31, 2020
e9d67ce
Change batch processor to use the new internal metrics structs (#1699)
bogdandrutu Aug 31, 2020
8be4504
Update opentelemetry-proto to v0.5.0 and regenerate files (#1700)
bogdandrutu Aug 31, 2020
57aeb8f
Change OTLP exporter/receiver and File exporter to use the new opente…
bogdandrutu Aug 31, 2020
0891359
temporary work
huyan0 Aug 31, 2020
ca23e5b
temporary work
huyan0 Sep 1, 2020
58bef49
need self review
huyan0 Sep 1, 2020
ef89d1e
make pass
huyan0 Sep 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## 🛑 Breaking changes 🛑

- **Update OTLP to v0.5.0, incompatible metrics protocol.**
- Remove support for propagating summary metrics in OtelCollector.
- This is a temporary change, and will affect mostly OpenCensus users who use metrics.

## v0.9.0 Beta

## 🛑 Breaking changes 🛑
Expand Down
58 changes: 41 additions & 17 deletions cmd/pdatagen/internal/base_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type baseField interface {
}

type sliceField struct {
fieldMame string
fieldName string
originFieldName string
returnSlice *sliceStruct
}
Expand All @@ -114,7 +114,7 @@ func (sf *sliceField) generateAccessors(ms *messageStruct, sb *strings.Builder)
case "structName":
return ms.structName
case "fieldName":
return sf.fieldMame
return sf.fieldName
case "returnType":
return sf.returnSlice.structName
case "originFieldName":
Expand All @@ -131,7 +131,7 @@ func (sf *sliceField) generateAccessorsTest(ms *messageStruct, sb *strings.Build
case "structName":
return ms.structName
case "fieldName":
return sf.fieldMame
return sf.fieldName
case "returnType":
return sf.returnSlice.structName
default:
Expand All @@ -141,11 +141,11 @@ func (sf *sliceField) generateAccessorsTest(ms *messageStruct, sb *strings.Build
}

func (sf *sliceField) generateSetWithTestValue(sb *strings.Builder) {
sb.WriteString("\tfillTest" + sf.returnSlice.structName + "(tv." + sf.fieldMame + "())")
sb.WriteString("\tfillTest" + sf.returnSlice.structName + "(tv." + sf.fieldName + "())")
}

func (sf *sliceField) generateCopyToValue(sb *strings.Builder) {
sb.WriteString("\tms." + sf.fieldMame + "().CopyTo(dest." + sf.fieldMame + "())")
sb.WriteString("\tms." + sf.fieldName + "().CopyTo(dest." + sf.fieldName + "())")
}

var _ baseField = (*sliceField)(nil)
Expand Down Expand Up @@ -204,7 +204,7 @@ func (mf *messageField) generateCopyToValue(sb *strings.Builder) {
var _ baseField = (*messageField)(nil)

type primitiveField struct {
fieldMame string
fieldName string
originFieldName string
returnType string
defaultVal string
Expand All @@ -217,9 +217,9 @@ func (pf *primitiveField) generateAccessors(ms *messageStruct, sb *strings.Build
case "structName":
return ms.structName
case "fieldName":
return pf.fieldMame
return pf.fieldName
case "lowerFieldName":
return strings.ToLower(pf.fieldMame)
return strings.ToLower(pf.fieldName)
case "returnType":
return pf.returnType
case "originFieldName":
Expand All @@ -238,7 +238,7 @@ func (pf *primitiveField) generateAccessorsTest(ms *messageStruct, sb *strings.B
case "defaultVal":
return pf.defaultVal
case "fieldName":
return pf.fieldMame
return pf.fieldName
case "testValue":
return pf.testVal
default:
Expand All @@ -248,18 +248,18 @@ func (pf *primitiveField) generateAccessorsTest(ms *messageStruct, sb *strings.B
}

func (pf *primitiveField) generateSetWithTestValue(sb *strings.Builder) {
sb.WriteString("\ttv.Set" + pf.fieldMame + "(" + pf.testVal + ")")
sb.WriteString("\ttv.Set" + pf.fieldName + "(" + pf.testVal + ")")
}

func (pf *primitiveField) generateCopyToValue(sb *strings.Builder) {
sb.WriteString("\tdest.Set" + pf.fieldMame + "(ms." + pf.fieldMame + "())")
sb.WriteString("\tdest.Set" + pf.fieldName + "(ms." + pf.fieldName + "())")
}

var _ baseField = (*primitiveField)(nil)

// Types that has defined a custom type (e.g. "type TimestampUnixNano uint64")
type primitiveTypedField struct {
fieldMame string
fieldName string
originFieldName string
returnType string
defaultVal string
Expand All @@ -273,9 +273,9 @@ func (ptf *primitiveTypedField) generateAccessors(ms *messageStruct, sb *strings
case "structName":
return ms.structName
case "fieldName":
return ptf.fieldMame
return ptf.fieldName
case "lowerFieldName":
return strings.ToLower(ptf.fieldMame)
return strings.ToLower(ptf.fieldName)
case "returnType":
return ptf.returnType
case "rawType":
Expand All @@ -296,7 +296,7 @@ func (ptf *primitiveTypedField) generateAccessorsTest(ms *messageStruct, sb *str
case "defaultVal":
return ptf.defaultVal
case "fieldName":
return ptf.fieldMame
return ptf.fieldName
case "testValue":
return ptf.testVal
default:
Expand All @@ -306,11 +306,35 @@ func (ptf *primitiveTypedField) generateAccessorsTest(ms *messageStruct, sb *str
}

func (ptf *primitiveTypedField) generateSetWithTestValue(sb *strings.Builder) {
sb.WriteString("\ttv.Set" + ptf.fieldMame + "(" + ptf.testVal + ")")
sb.WriteString("\ttv.Set" + ptf.fieldName + "(" + ptf.testVal + ")")
}

func (ptf *primitiveTypedField) generateCopyToValue(sb *strings.Builder) {
sb.WriteString("\tdest.Set" + ptf.fieldMame + "(ms." + ptf.fieldMame + "())")
sb.WriteString("\tdest.Set" + ptf.fieldName + "(ms." + ptf.fieldName + "())")
}

var _ baseField = (*primitiveTypedField)(nil)

// oneofField is used in case where the proto defines an "oneof".
type oneofField struct {
copyFuncName string
originFieldName string
testVal string
fillTestName string
}

func (one oneofField) generateAccessors(*messageStruct, *strings.Builder) {}

func (one oneofField) generateAccessorsTest(*messageStruct, *strings.Builder) {}

func (one oneofField) generateSetWithTestValue(sb *strings.Builder) {
sb.WriteString("\t(*tv.orig)." + one.originFieldName + " = " + one.testVal + "\n")
sb.WriteString("\ttv." + one.fillTestName + "().InitEmpty()\n")
sb.WriteString("\tfillTest" + one.fillTestName + "(tv." + one.fillTestName + "())")
}

func (one oneofField) generateCopyToValue(sb *strings.Builder) {
sb.WriteString("\t" + one.copyFuncName + "((*ms.orig), (*dest.orig))")
}

var _ baseField = (*oneofField)(nil)
12 changes: 6 additions & 6 deletions cmd/pdatagen/internal/common_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var instrumentationLibrary = &messageStruct{
fields: []baseField{
nameField,
&primitiveField{
fieldMame: "Version",
fieldName: "Version",
originFieldName: "Version",
returnType: "string",
defaultVal: `""`,
Expand Down Expand Up @@ -73,7 +73,7 @@ var instrumentationLibraryField = &messageField{
}

var startTimeField = &primitiveTypedField{
fieldMame: "StartTime",
fieldName: "StartTime",
originFieldName: "StartTimeUnixNano",
returnType: "TimestampUnixNano",
rawType: "uint64",
Expand All @@ -82,7 +82,7 @@ var startTimeField = &primitiveTypedField{
}

var timeField = &primitiveTypedField{
fieldMame: "Timestamp",
fieldName: "Timestamp",
originFieldName: "TimeUnixNano",
returnType: "TimestampUnixNano",
rawType: "uint64",
Expand All @@ -91,7 +91,7 @@ var timeField = &primitiveTypedField{
}

var endTimeField = &primitiveTypedField{
fieldMame: "EndTime",
fieldName: "EndTime",
originFieldName: "EndTimeUnixNano",
returnType: "TimestampUnixNano",
rawType: "uint64",
Expand All @@ -100,13 +100,13 @@ var endTimeField = &primitiveTypedField{
}

var attributes = &sliceField{
fieldMame: "Attributes",
fieldName: "Attributes",
originFieldName: "Attributes",
returnSlice: attributeMap,
}

var nameField = &primitiveField{
fieldMame: "Name",
fieldName: "Name",
originFieldName: "Name",
returnType: "string",
defaultVal: `""`,
Expand Down
14 changes: 7 additions & 7 deletions cmd/pdatagen/internal/log_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var resourceLogs = &messageStruct{
fields: []baseField{
resourceField,
&sliceField{
fieldMame: "InstrumentationLibraryLogs",
fieldName: "InstrumentationLibraryLogs",
originFieldName: "InstrumentationLibraryLogs",
returnSlice: instrumentationLibraryLogsSlice,
},
Expand All @@ -67,7 +67,7 @@ var instrumentationLibraryLogs = &messageStruct{
fields: []baseField{
instrumentationLibraryField,
&sliceField{
fieldMame: "Logs",
fieldName: "Logs",
originFieldName: "Logs",
returnSlice: logSlice,
},
Expand All @@ -85,7 +85,7 @@ var logRecord = &messageStruct{
originFullName: "otlplogs.LogRecord",
fields: []baseField{
&primitiveTypedField{
fieldMame: "Timestamp",
fieldName: "Timestamp",
originFieldName: "TimeUnixNano",
returnType: "TimestampUnixNano",
rawType: "uint64",
Expand All @@ -95,30 +95,30 @@ var logRecord = &messageStruct{
traceIDField,
spanIDField,
&primitiveTypedField{
fieldMame: "Flags",
fieldName: "Flags",
originFieldName: "Flags",
returnType: "uint32",
rawType: "uint32",
defaultVal: `uint32(0)`,
testVal: `uint32(0x01)`,
},
&primitiveField{
fieldMame: "SeverityText",
fieldName: "SeverityText",
originFieldName: "SeverityText",
returnType: "string",
defaultVal: `""`,
testVal: `"INFO"`,
},
&primitiveTypedField{
fieldMame: "SeverityNumber",
fieldName: "SeverityNumber",
originFieldName: "SeverityNumber",
returnType: "SeverityNumber",
rawType: "otlplogs.SeverityNumber",
defaultVal: `SeverityNumberUNDEFINED`,
testVal: `SeverityNumberINFO`,
},
&primitiveField{
fieldMame: "Name",
fieldName: "Name",
originFieldName: "Name",
returnType: "string",
defaultVal: `""`,
Expand Down
Loading