From 9b87abcb917044962bcbb1371282c89e8a460c8c Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sun, 20 Feb 2022 22:13:46 -0800 Subject: [PATCH] Generate pdata/signal packages with aliases --- model/internal/cmd/pdatagen/internal/files.go | 31 ++-- .../cmd/pdatagen/internal/log_structs.go | 2 +- .../cmd/pdatagen/internal/trace_structs.go | 2 +- model/internal/cmd/pdatagen/main.go | 9 +- .../{generated_log.go => generated_logs.go} | 0 ...ted_log_test.go => generated_logs_test.go} | 0 ...generated_trace.go => generated_traces.go} | 0 ...trace_test.go => generated_traces_test.go} | 0 ...d_log_alias.go => generated_logs_alias.go} | 0 ...ace_alias.go => generated_traces_alias.go} | 0 model/pdata/logs/generated_logs_alias.go | 56 ++++++ model/pdata/logs/log_alias.go | 65 +++++++ .../pdata/metrics/generated_metrics_alias.go | 164 ++++++++++++++++++ model/pdata/metrics/metric_alias.go | 81 +++++++++ model/pdata/metrics_alias.go | 2 +- model/pdata/traces/alias_trace.go | 62 +++++++ model/pdata/traces/generated_traces_alias.go | 86 +++++++++ 17 files changed, 543 insertions(+), 17 deletions(-) rename model/internal/pdata/{generated_log.go => generated_logs.go} (100%) rename model/internal/pdata/{generated_log_test.go => generated_logs_test.go} (100%) rename model/internal/pdata/{generated_trace.go => generated_traces.go} (100%) rename model/internal/pdata/{generated_trace_test.go => generated_traces_test.go} (100%) rename model/pdata/{generated_log_alias.go => generated_logs_alias.go} (100%) rename model/pdata/{generated_trace_alias.go => generated_traces_alias.go} (100%) create mode 100644 model/pdata/logs/generated_logs_alias.go create mode 100644 model/pdata/logs/log_alias.go create mode 100644 model/pdata/metrics/generated_metrics_alias.go create mode 100644 model/pdata/metrics/metric_alias.go create mode 100644 model/pdata/traces/alias_trace.go create mode 100644 model/pdata/traces/generated_traces_alias.go diff --git a/model/internal/cmd/pdatagen/internal/files.go b/model/internal/cmd/pdatagen/internal/files.go index ec851363073..965738c80aa 100644 --- a/model/internal/cmd/pdatagen/internal/files.go +++ b/model/internal/cmd/pdatagen/internal/files.go @@ -31,9 +31,7 @@ const header = `// Copyright The OpenTelemetry Authors // limitations under the License. // Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT. -// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go". - -package pdata` +// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".` // AllFiles is a list of all files that needs to be generated. var AllFiles = []*File{ @@ -57,9 +55,8 @@ type File struct { func (f *File) GenerateFile() string { var sb strings.Builder - // Write headers - sb.WriteString(header) - sb.WriteString(newLine + newLine) + generateHeader(&sb, "pdata") + // Add imports sb.WriteString("import (" + newLine) for _, imp := range f.imports { @@ -83,9 +80,8 @@ func (f *File) GenerateFile() string { func (f *File) GenerateTestFile() string { var sb strings.Builder - // Write headers - sb.WriteString(header) - sb.WriteString(newLine + newLine) + generateHeader(&sb, "pdata") + // Add imports sb.WriteString("import (" + newLine) for _, imp := range f.testImports { @@ -111,12 +107,10 @@ func (f *File) GenerateTestFile() string { } // GenerateFile generates the aliases for data structures for this File. -func (f *File) GenerateAliasFile() string { +func (f *File) GenerateAliasFile(packageName string) string { var sb strings.Builder - // Write headers - sb.WriteString(header) - sb.WriteString(newLine + newLine) + generateHeader(&sb, packageName) // Add import sb.WriteString("import \"go.opentelemetry.io/collector/model/internal/pdata\"" + newLine + newLine) @@ -130,3 +124,14 @@ func (f *File) GenerateAliasFile() string { sb.WriteString(newLine) return sb.String() } + +func (f *File) IsCommon() bool { + return f.Name == "resource" || f.Name == "common" +} + +func generateHeader(sb *strings.Builder, packageName string) { + sb.WriteString(header) + sb.WriteString(newLine + newLine) + sb.WriteString("package " + packageName) + sb.WriteString(newLine + newLine) +} diff --git a/model/internal/cmd/pdatagen/internal/log_structs.go b/model/internal/cmd/pdatagen/internal/log_structs.go index 0a61207eebe..6894fe064f2 100644 --- a/model/internal/cmd/pdatagen/internal/log_structs.go +++ b/model/internal/cmd/pdatagen/internal/log_structs.go @@ -15,7 +15,7 @@ package internal // import "go.opentelemetry.io/collector/model/internal/cmd/pdatagen/internal" var logFile = &File{ - Name: "log", + Name: "logs", imports: []string{ `"sort"`, ``, diff --git a/model/internal/cmd/pdatagen/internal/trace_structs.go b/model/internal/cmd/pdatagen/internal/trace_structs.go index 8a28e84646e..51b426c86fe 100644 --- a/model/internal/cmd/pdatagen/internal/trace_structs.go +++ b/model/internal/cmd/pdatagen/internal/trace_structs.go @@ -15,7 +15,7 @@ package internal // import "go.opentelemetry.io/collector/model/internal/cmd/pdatagen/internal" var traceFile = &File{ - Name: "trace", + Name: "traces", imports: []string{ `"sort"`, ``, diff --git a/model/internal/cmd/pdatagen/main.go b/model/internal/cmd/pdatagen/main.go index b65b9e4077d..ee718c3908c 100644 --- a/model/internal/cmd/pdatagen/main.go +++ b/model/internal/cmd/pdatagen/main.go @@ -40,8 +40,15 @@ func main() { check(f.Close()) f, err = os.Create("./model/pdata/generated_" + fp.Name + "_alias.go") check(err) - _, err = f.WriteString(fp.GenerateAliasFile()) + _, err = f.WriteString(fp.GenerateAliasFile("pdata")) check(err) check(f.Close()) + if !fp.IsCommon() { + f, err = os.Create("./model/pdata/" + fp.Name + "/generated_" + fp.Name + "_alias.go") + check(err) + _, err = f.WriteString(fp.GenerateAliasFile(fp.Name)) + check(err) + check(f.Close()) + } } } diff --git a/model/internal/pdata/generated_log.go b/model/internal/pdata/generated_logs.go similarity index 100% rename from model/internal/pdata/generated_log.go rename to model/internal/pdata/generated_logs.go diff --git a/model/internal/pdata/generated_log_test.go b/model/internal/pdata/generated_logs_test.go similarity index 100% rename from model/internal/pdata/generated_log_test.go rename to model/internal/pdata/generated_logs_test.go diff --git a/model/internal/pdata/generated_trace.go b/model/internal/pdata/generated_traces.go similarity index 100% rename from model/internal/pdata/generated_trace.go rename to model/internal/pdata/generated_traces.go diff --git a/model/internal/pdata/generated_trace_test.go b/model/internal/pdata/generated_traces_test.go similarity index 100% rename from model/internal/pdata/generated_trace_test.go rename to model/internal/pdata/generated_traces_test.go diff --git a/model/pdata/generated_log_alias.go b/model/pdata/generated_logs_alias.go similarity index 100% rename from model/pdata/generated_log_alias.go rename to model/pdata/generated_logs_alias.go diff --git a/model/pdata/generated_trace_alias.go b/model/pdata/generated_traces_alias.go similarity index 100% rename from model/pdata/generated_trace_alias.go rename to model/pdata/generated_traces_alias.go diff --git a/model/pdata/logs/generated_logs_alias.go b/model/pdata/logs/generated_logs_alias.go new file mode 100644 index 00000000000..b69d6e6935f --- /dev/null +++ b/model/pdata/logs/generated_logs_alias.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT. +// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go". + +package logs + +import "go.opentelemetry.io/collector/model/internal/pdata" + +// ResourceLogsSlice is an alias for pdata.ResourceLogsSlice struct. +type ResourceLogsSlice = pdata.ResourceLogsSlice + +// NewResourceLogsSlice is an alias for a function to create ResourceLogsSlice. +var NewResourceLogsSlice = pdata.NewResourceLogsSlice + +// ResourceLogs is an alias for pdata.ResourceLogs struct. +type ResourceLogs = pdata.ResourceLogs + +// NewResourceLogs is an alias for a function to create a new empty ResourceLogs. +var NewResourceLogs = pdata.NewResourceLogs + +// InstrumentationLibraryLogsSlice is an alias for pdata.InstrumentationLibraryLogsSlice struct. +type InstrumentationLibraryLogsSlice = pdata.InstrumentationLibraryLogsSlice + +// NewInstrumentationLibraryLogsSlice is an alias for a function to create InstrumentationLibraryLogsSlice. +var NewInstrumentationLibraryLogsSlice = pdata.NewInstrumentationLibraryLogsSlice + +// InstrumentationLibraryLogs is an alias for pdata.InstrumentationLibraryLogs struct. +type InstrumentationLibraryLogs = pdata.InstrumentationLibraryLogs + +// NewInstrumentationLibraryLogs is an alias for a function to create a new empty InstrumentationLibraryLogs. +var NewInstrumentationLibraryLogs = pdata.NewInstrumentationLibraryLogs + +// LogRecordSlice is an alias for pdata.LogRecordSlice struct. +type LogRecordSlice = pdata.LogRecordSlice + +// NewLogRecordSlice is an alias for a function to create LogRecordSlice. +var NewLogRecordSlice = pdata.NewLogRecordSlice + +// LogRecord is an alias for pdata.LogRecord struct. +type LogRecord = pdata.LogRecord + +// NewLogRecord is an alias for a function to create a new empty LogRecord. +var NewLogRecord = pdata.NewLogRecord diff --git a/model/pdata/logs/log_alias.go b/model/pdata/logs/log_alias.go new file mode 100644 index 00000000000..96c0c2b7b5f --- /dev/null +++ b/model/pdata/logs/log_alias.go @@ -0,0 +1,65 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logs // import "go.opentelemetry.io/collector/model/pdata/logs" + +// This file contains aliases for logs data structures. + +import "go.opentelemetry.io/collector/model/internal/pdata" + +// Marshaler is an alias for pdata.LogsMarshaler interface. +type Marshaler = pdata.LogsMarshaler + +// Unmarshaler is an alias for pdata.LogsUnmarshaler interface. +type Unmarshaler = pdata.LogsUnmarshaler + +// Sizer is an alias for pdata.LogsSizer interface. +type Sizer = pdata.LogsSizer + +// Logs is an alias for pdata.Logs struct. +type Logs = pdata.Logs + +// New is an alias for a function to create new Logs. +var New = pdata.NewLogs + +// SeverityNumber is an alias for pdata.SeverityNumber type. +type SeverityNumber = pdata.SeverityNumber + +const ( + SeverityNumberUNDEFINED = pdata.SeverityNumberUNDEFINED + SeverityNumberTRACE = pdata.SeverityNumberTRACE + SeverityNumberTRACE2 = pdata.SeverityNumberTRACE2 + SeverityNumberTRACE3 = pdata.SeverityNumberTRACE3 + SeverityNumberTRACE4 = pdata.SeverityNumberTRACE4 + SeverityNumberDEBUG = pdata.SeverityNumberDEBUG + SeverityNumberDEBUG2 = pdata.SeverityNumberDEBUG2 + SeverityNumberDEBUG3 = pdata.SeverityNumberDEBUG3 + SeverityNumberDEBUG4 = pdata.SeverityNumberDEBUG4 + SeverityNumberINFO = pdata.SeverityNumberINFO + SeverityNumberINFO2 = pdata.SeverityNumberINFO2 + SeverityNumberINFO3 = pdata.SeverityNumberINFO3 + SeverityNumberINFO4 = pdata.SeverityNumberINFO4 + SeverityNumberWARN = pdata.SeverityNumberWARN + SeverityNumberWARN2 = pdata.SeverityNumberWARN2 + SeverityNumberWARN3 = pdata.SeverityNumberWARN3 + SeverityNumberWARN4 = pdata.SeverityNumberWARN4 + SeverityNumberERROR = pdata.SeverityNumberERROR + SeverityNumberERROR2 = pdata.SeverityNumberERROR2 + SeverityNumberERROR3 = pdata.SeverityNumberERROR3 + SeverityNumberERROR4 = pdata.SeverityNumberERROR4 + SeverityNumberFATAL = pdata.SeverityNumberFATAL + SeverityNumberFATAL2 = pdata.SeverityNumberFATAL2 + SeverityNumberFATAL3 = pdata.SeverityNumberFATAL3 + SeverityNumberFATAL4 = pdata.SeverityNumberFATAL4 +) diff --git a/model/pdata/metrics/generated_metrics_alias.go b/model/pdata/metrics/generated_metrics_alias.go new file mode 100644 index 00000000000..0dabb8b1bfe --- /dev/null +++ b/model/pdata/metrics/generated_metrics_alias.go @@ -0,0 +1,164 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT. +// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go". + +package metrics + +import "go.opentelemetry.io/collector/model/internal/pdata" + +// ResourceMetricsSlice is an alias for pdata.ResourceMetricsSlice struct. +type ResourceMetricsSlice = pdata.ResourceMetricsSlice + +// NewResourceMetricsSlice is an alias for a function to create ResourceMetricsSlice. +var NewResourceMetricsSlice = pdata.NewResourceMetricsSlice + +// ResourceMetrics is an alias for pdata.ResourceMetrics struct. +type ResourceMetrics = pdata.ResourceMetrics + +// NewResourceMetrics is an alias for a function to create a new empty ResourceMetrics. +var NewResourceMetrics = pdata.NewResourceMetrics + +// InstrumentationLibraryMetricsSlice is an alias for pdata.InstrumentationLibraryMetricsSlice struct. +type InstrumentationLibraryMetricsSlice = pdata.InstrumentationLibraryMetricsSlice + +// NewInstrumentationLibraryMetricsSlice is an alias for a function to create InstrumentationLibraryMetricsSlice. +var NewInstrumentationLibraryMetricsSlice = pdata.NewInstrumentationLibraryMetricsSlice + +// InstrumentationLibraryMetrics is an alias for pdata.InstrumentationLibraryMetrics struct. +type InstrumentationLibraryMetrics = pdata.InstrumentationLibraryMetrics + +// NewInstrumentationLibraryMetrics is an alias for a function to create a new empty InstrumentationLibraryMetrics. +var NewInstrumentationLibraryMetrics = pdata.NewInstrumentationLibraryMetrics + +// MetricSlice is an alias for pdata.MetricSlice struct. +type MetricSlice = pdata.MetricSlice + +// NewMetricSlice is an alias for a function to create MetricSlice. +var NewMetricSlice = pdata.NewMetricSlice + +// Metric is an alias for pdata.Metric struct. +type Metric = pdata.Metric + +// NewMetric is an alias for a function to create a new empty Metric. +var NewMetric = pdata.NewMetric + +// Gauge is an alias for pdata.Gauge struct. +type Gauge = pdata.Gauge + +// NewGauge is an alias for a function to create a new empty Gauge. +var NewGauge = pdata.NewGauge + +// Sum is an alias for pdata.Sum struct. +type Sum = pdata.Sum + +// NewSum is an alias for a function to create a new empty Sum. +var NewSum = pdata.NewSum + +// Histogram is an alias for pdata.Histogram struct. +type Histogram = pdata.Histogram + +// NewHistogram is an alias for a function to create a new empty Histogram. +var NewHistogram = pdata.NewHistogram + +// ExponentialHistogram is an alias for pdata.ExponentialHistogram struct. +type ExponentialHistogram = pdata.ExponentialHistogram + +// NewExponentialHistogram is an alias for a function to create a new empty ExponentialHistogram. +var NewExponentialHistogram = pdata.NewExponentialHistogram + +// Summary is an alias for pdata.Summary struct. +type Summary = pdata.Summary + +// NewSummary is an alias for a function to create a new empty Summary. +var NewSummary = pdata.NewSummary + +// NumberDataPointSlice is an alias for pdata.NumberDataPointSlice struct. +type NumberDataPointSlice = pdata.NumberDataPointSlice + +// NewNumberDataPointSlice is an alias for a function to create NumberDataPointSlice. +var NewNumberDataPointSlice = pdata.NewNumberDataPointSlice + +// NumberDataPoint is an alias for pdata.NumberDataPoint struct. +type NumberDataPoint = pdata.NumberDataPoint + +// NewNumberDataPoint is an alias for a function to create a new empty NumberDataPoint. +var NewNumberDataPoint = pdata.NewNumberDataPoint + +// HistogramDataPointSlice is an alias for pdata.HistogramDataPointSlice struct. +type HistogramDataPointSlice = pdata.HistogramDataPointSlice + +// NewHistogramDataPointSlice is an alias for a function to create HistogramDataPointSlice. +var NewHistogramDataPointSlice = pdata.NewHistogramDataPointSlice + +// HistogramDataPoint is an alias for pdata.HistogramDataPoint struct. +type HistogramDataPoint = pdata.HistogramDataPoint + +// NewHistogramDataPoint is an alias for a function to create a new empty HistogramDataPoint. +var NewHistogramDataPoint = pdata.NewHistogramDataPoint + +// ExponentialHistogramDataPointSlice is an alias for pdata.ExponentialHistogramDataPointSlice struct. +type ExponentialHistogramDataPointSlice = pdata.ExponentialHistogramDataPointSlice + +// NewExponentialHistogramDataPointSlice is an alias for a function to create ExponentialHistogramDataPointSlice. +var NewExponentialHistogramDataPointSlice = pdata.NewExponentialHistogramDataPointSlice + +// ExponentialHistogramDataPoint is an alias for pdata.ExponentialHistogramDataPoint struct. +type ExponentialHistogramDataPoint = pdata.ExponentialHistogramDataPoint + +// NewExponentialHistogramDataPoint is an alias for a function to create a new empty ExponentialHistogramDataPoint. +var NewExponentialHistogramDataPoint = pdata.NewExponentialHistogramDataPoint + +// Buckets is an alias for pdata.Buckets struct. +type Buckets = pdata.Buckets + +// NewBuckets is an alias for a function to create a new empty Buckets. +var NewBuckets = pdata.NewBuckets + +// SummaryDataPointSlice is an alias for pdata.SummaryDataPointSlice struct. +type SummaryDataPointSlice = pdata.SummaryDataPointSlice + +// NewSummaryDataPointSlice is an alias for a function to create SummaryDataPointSlice. +var NewSummaryDataPointSlice = pdata.NewSummaryDataPointSlice + +// SummaryDataPoint is an alias for pdata.SummaryDataPoint struct. +type SummaryDataPoint = pdata.SummaryDataPoint + +// NewSummaryDataPoint is an alias for a function to create a new empty SummaryDataPoint. +var NewSummaryDataPoint = pdata.NewSummaryDataPoint + +// ValueAtQuantileSlice is an alias for pdata.ValueAtQuantileSlice struct. +type ValueAtQuantileSlice = pdata.ValueAtQuantileSlice + +// NewValueAtQuantileSlice is an alias for a function to create ValueAtQuantileSlice. +var NewValueAtQuantileSlice = pdata.NewValueAtQuantileSlice + +// ValueAtQuantile is an alias for pdata.ValueAtQuantile struct. +type ValueAtQuantile = pdata.ValueAtQuantile + +// NewValueAtQuantile is an alias for a function to create a new empty ValueAtQuantile. +var NewValueAtQuantile = pdata.NewValueAtQuantile + +// ExemplarSlice is an alias for pdata.ExemplarSlice struct. +type ExemplarSlice = pdata.ExemplarSlice + +// NewExemplarSlice is an alias for a function to create ExemplarSlice. +var NewExemplarSlice = pdata.NewExemplarSlice + +// Exemplar is an alias for pdata.Exemplar struct. +type Exemplar = pdata.Exemplar + +// NewExemplar is an alias for a function to create a new empty Exemplar. +var NewExemplar = pdata.NewExemplar diff --git a/model/pdata/metrics/metric_alias.go b/model/pdata/metrics/metric_alias.go new file mode 100644 index 00000000000..b73771ebe88 --- /dev/null +++ b/model/pdata/metrics/metric_alias.go @@ -0,0 +1,81 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metrics // import "go.opentelemetry.io/collector/model/pdata/metrics" + +// This file contains aliases for metrics data structures. + +import "go.opentelemetry.io/collector/model/internal/pdata" + +// Marshaler is an alias for pdata.MetricsMarshaler interface. +type Marshaler = pdata.MetricsMarshaler + +// Unmarshaler is an alias for pdata.MetricsUnmarshaler interface. +type Unmarshaler = pdata.MetricsUnmarshaler + +// Sizer is an alias for pdata.MetricsSizer interface. +type Sizer = pdata.MetricsSizer + +// Metrics is an alias for pdata.Metrics structure. +type Metrics = pdata.Metrics + +// New is an alias for a function to create new Metrics. +var New = pdata.NewMetrics + +// MetricDataType is an alias for pdata.MetricDataType type. +type MetricDataType = pdata.MetricDataType + +const ( + MetricDataTypeNone = pdata.MetricDataTypeNone + MetricDataTypeGauge = pdata.MetricDataTypeGauge + MetricDataTypeSum = pdata.MetricDataTypeSum + MetricDataTypeHistogram = pdata.MetricDataTypeHistogram + MetricDataTypeExponentialHistogram = pdata.MetricDataTypeExponentialHistogram + MetricDataTypeSummary = pdata.MetricDataTypeSummary +) + +// MetricAggregationTemporality is an alias for pdata.MetricAggregationTemporality type. +type MetricAggregationTemporality = pdata.MetricAggregationTemporality + +const ( + MetricAggregationTemporalityUnspecified = pdata.MetricAggregationTemporalityUnspecified + MetricAggregationTemporalityDelta = pdata.MetricAggregationTemporalityDelta + MetricAggregationTemporalityCumulative = pdata.MetricAggregationTemporalityCumulative +) + +// MetricDataPointFlags is an alias for pdata.MetricDataPointFlags type. +type MetricDataPointFlags = pdata.MetricDataPointFlags + +const ( + MetricDataPointFlagsNone = pdata.MetricDataPointFlagsNone +) + +// NewMetricDataPointFlags is an alias for a function to create new MetricDataPointFlags. +var NewMetricDataPointFlags = pdata.NewMetricDataPointFlags + +// MetricDataPointFlag is an alias for pdata.MetricDataPointFlag type. +type MetricDataPointFlag = pdata.MetricDataPointFlag + +const ( + MetricDataPointFlagNoRecordedValue = pdata.MetricDataPointFlagNoRecordedValue +) + +// MetricValueType is an alias for pdata.MetricValueType type. +type MetricValueType = pdata.MetricValueType + +const ( + MetricValueTypeNone = pdata.MetricValueTypeNone + MetricValueTypeInt = pdata.MetricValueTypeInt + MetricValueTypeDouble = pdata.MetricValueTypeDouble +) diff --git a/model/pdata/metrics_alias.go b/model/pdata/metrics_alias.go index 6bc0d043ace..ddd8dac69eb 100644 --- a/model/pdata/metrics_alias.go +++ b/model/pdata/metrics_alias.go @@ -14,7 +14,7 @@ package pdata // import "go.opentelemetry.io/collector/model/pdata" -// This file contains aliases for metric data structures. +// This file contains aliases for metrics data structures. import "go.opentelemetry.io/collector/model/internal/pdata" diff --git a/model/pdata/traces/alias_trace.go b/model/pdata/traces/alias_trace.go new file mode 100644 index 00000000000..9162c1f2964 --- /dev/null +++ b/model/pdata/traces/alias_trace.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package traces // import "go.opentelemetry.io/collector/model/pdata/traces" + +// This file contains aliases for traces data structures. + +import "go.opentelemetry.io/collector/model/internal/pdata" + +// Marshaler is an alias for pdata.TracesMarshaler interface. +type Marshaler = pdata.TracesMarshaler + +// Unmarshaler is an alias for pdata.TracesUnmarshaler interface. +type Unmarshaler = pdata.TracesUnmarshaler + +// Sizer is an alias for pdata.TracesSizer interface. +type Sizer = pdata.TracesSizer + +// Traces is an alias for pdata.Traces struct. +type Traces = pdata.Traces + +// New is an alias for a function to create new Traces. +var New = pdata.NewTraces + +// TraceState is an alias for pdata.TraceState type. +type TraceState = pdata.TraceState + +const ( + TraceStateEmpty = pdata.TraceStateEmpty +) + +// SpanKind is an alias for pdata.SpanKind type. +type SpanKind = pdata.SpanKind + +const ( + SpanKindUnspecified = pdata.SpanKindUnspecified + SpanKindInternal = pdata.SpanKindInternal + SpanKindServer = pdata.SpanKindServer + SpanKindClient = pdata.SpanKindClient + SpanKindProducer = pdata.SpanKindProducer + SpanKindConsumer = pdata.SpanKindConsumer +) + +// StatusCode is an alias for pdata.StatusCode type. +type StatusCode = pdata.StatusCode + +const ( + StatusCodeUnset = pdata.StatusCodeUnset + StatusCodeOk = pdata.StatusCodeOk + StatusCodeError = pdata.StatusCodeError +) diff --git a/model/pdata/traces/generated_traces_alias.go b/model/pdata/traces/generated_traces_alias.go new file mode 100644 index 00000000000..d3f98ba7d6e --- /dev/null +++ b/model/pdata/traces/generated_traces_alias.go @@ -0,0 +1,86 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT. +// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go". + +package traces + +import "go.opentelemetry.io/collector/model/internal/pdata" + +// ResourceSpansSlice is an alias for pdata.ResourceSpansSlice struct. +type ResourceSpansSlice = pdata.ResourceSpansSlice + +// NewResourceSpansSlice is an alias for a function to create ResourceSpansSlice. +var NewResourceSpansSlice = pdata.NewResourceSpansSlice + +// ResourceSpans is an alias for pdata.ResourceSpans struct. +type ResourceSpans = pdata.ResourceSpans + +// NewResourceSpans is an alias for a function to create a new empty ResourceSpans. +var NewResourceSpans = pdata.NewResourceSpans + +// InstrumentationLibrarySpansSlice is an alias for pdata.InstrumentationLibrarySpansSlice struct. +type InstrumentationLibrarySpansSlice = pdata.InstrumentationLibrarySpansSlice + +// NewInstrumentationLibrarySpansSlice is an alias for a function to create InstrumentationLibrarySpansSlice. +var NewInstrumentationLibrarySpansSlice = pdata.NewInstrumentationLibrarySpansSlice + +// InstrumentationLibrarySpans is an alias for pdata.InstrumentationLibrarySpans struct. +type InstrumentationLibrarySpans = pdata.InstrumentationLibrarySpans + +// NewInstrumentationLibrarySpans is an alias for a function to create a new empty InstrumentationLibrarySpans. +var NewInstrumentationLibrarySpans = pdata.NewInstrumentationLibrarySpans + +// SpanSlice is an alias for pdata.SpanSlice struct. +type SpanSlice = pdata.SpanSlice + +// NewSpanSlice is an alias for a function to create SpanSlice. +var NewSpanSlice = pdata.NewSpanSlice + +// Span is an alias for pdata.Span struct. +type Span = pdata.Span + +// NewSpan is an alias for a function to create a new empty Span. +var NewSpan = pdata.NewSpan + +// SpanEventSlice is an alias for pdata.SpanEventSlice struct. +type SpanEventSlice = pdata.SpanEventSlice + +// NewSpanEventSlice is an alias for a function to create SpanEventSlice. +var NewSpanEventSlice = pdata.NewSpanEventSlice + +// SpanEvent is an alias for pdata.SpanEvent struct. +type SpanEvent = pdata.SpanEvent + +// NewSpanEvent is an alias for a function to create a new empty SpanEvent. +var NewSpanEvent = pdata.NewSpanEvent + +// SpanLinkSlice is an alias for pdata.SpanLinkSlice struct. +type SpanLinkSlice = pdata.SpanLinkSlice + +// NewSpanLinkSlice is an alias for a function to create SpanLinkSlice. +var NewSpanLinkSlice = pdata.NewSpanLinkSlice + +// SpanLink is an alias for pdata.SpanLink struct. +type SpanLink = pdata.SpanLink + +// NewSpanLink is an alias for a function to create a new empty SpanLink. +var NewSpanLink = pdata.NewSpanLink + +// SpanStatus is an alias for pdata.SpanStatus struct. +type SpanStatus = pdata.SpanStatus + +// NewSpanStatus is an alias for a function to create a new empty SpanStatus. +var NewSpanStatus = pdata.NewSpanStatus