|
| 1 | +// Copyright The OpenTelemetry Authors |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +package obsmetrics |
| 16 | + |
| 17 | +import ( |
| 18 | + "go.opencensus.io/stats" |
| 19 | + "go.opencensus.io/tag" |
| 20 | +) |
| 21 | + |
| 22 | +const ( |
| 23 | + // ReceiverKey used to identify receivers in metrics and traces. |
| 24 | + ReceiverKey = "receiver" |
| 25 | + // TransportKey used to identify the transport used to received the data. |
| 26 | + TransportKey = "transport" |
| 27 | + // FormatKey used to identify the format of the data received. |
| 28 | + FormatKey = "format" |
| 29 | + |
| 30 | + // AcceptedSpansKey used to identify spans accepted by the Collector. |
| 31 | + AcceptedSpansKey = "accepted_spans" |
| 32 | + // RefusedSpansKey used to identify spans refused (ie.: not ingested) by the Collector. |
| 33 | + RefusedSpansKey = "refused_spans" |
| 34 | + |
| 35 | + // AcceptedMetricPointsKey used to identify metric points accepted by the Collector. |
| 36 | + AcceptedMetricPointsKey = "accepted_metric_points" |
| 37 | + // RefusedMetricPointsKey used to identify metric points refused (ie.: not ingested) by the |
| 38 | + // Collector. |
| 39 | + RefusedMetricPointsKey = "refused_metric_points" |
| 40 | + |
| 41 | + // AcceptedLogRecordsKey used to identify log records accepted by the Collector. |
| 42 | + AcceptedLogRecordsKey = "accepted_log_records" |
| 43 | + // RefusedLogRecordsKey used to identify log records refused (ie.: not ingested) by the |
| 44 | + // Collector. |
| 45 | + RefusedLogRecordsKey = "refused_log_records" |
| 46 | +) |
| 47 | + |
| 48 | +var ( |
| 49 | + TagKeyReceiver, _ = tag.NewKey(ReceiverKey) |
| 50 | + TagKeyTransport, _ = tag.NewKey(TransportKey) |
| 51 | + |
| 52 | + ReceiverPrefix = ReceiverKey + NameSep |
| 53 | + ReceiveTraceDataOperationSuffix = NameSep + "TraceDataReceived" |
| 54 | + ReceiverMetricsOperationSuffix = NameSep + "MetricsReceived" |
| 55 | + ReceiverLogsOperationSuffix = NameSep + "LogsReceived" |
| 56 | + |
| 57 | + // Receiver metrics. Any count of data items below is in the original format |
| 58 | + // that they were received, reasoning: reconciliation is easier if measurement |
| 59 | + // on clients and receiver are expected to be the same. Translation issues |
| 60 | + // that result in a different number of elements should be reported in a |
| 61 | + // separate way. |
| 62 | + ReceiverAcceptedSpans = stats.Int64( |
| 63 | + ReceiverPrefix+AcceptedSpansKey, |
| 64 | + "Number of spans successfully pushed into the pipeline.", |
| 65 | + stats.UnitDimensionless) |
| 66 | + ReceiverRefusedSpans = stats.Int64( |
| 67 | + ReceiverPrefix+RefusedSpansKey, |
| 68 | + "Number of spans that could not be pushed into the pipeline.", |
| 69 | + stats.UnitDimensionless) |
| 70 | + ReceiverAcceptedMetricPoints = stats.Int64( |
| 71 | + ReceiverPrefix+AcceptedMetricPointsKey, |
| 72 | + "Number of metric points successfully pushed into the pipeline.", |
| 73 | + stats.UnitDimensionless) |
| 74 | + ReceiverRefusedMetricPoints = stats.Int64( |
| 75 | + ReceiverPrefix+RefusedMetricPointsKey, |
| 76 | + "Number of metric points that could not be pushed into the pipeline.", |
| 77 | + stats.UnitDimensionless) |
| 78 | + ReceiverAcceptedLogRecords = stats.Int64( |
| 79 | + ReceiverPrefix+AcceptedLogRecordsKey, |
| 80 | + "Number of log records successfully pushed into the pipeline.", |
| 81 | + stats.UnitDimensionless) |
| 82 | + ReceiverRefusedLogRecords = stats.Int64( |
| 83 | + ReceiverPrefix+RefusedLogRecordsKey, |
| 84 | + "Number of log records that could not be pushed into the pipeline.", |
| 85 | + stats.UnitDimensionless) |
| 86 | +) |
0 commit comments