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

feat: proto logs #202

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ init:
protoc --proto_path opentelemetry-proto --dart_out . \
opentelemetry-proto/opentelemetry/proto/common/v1/common.proto \
opentelemetry-proto/opentelemetry/proto/collector/trace/v1/trace_service.proto \
opentelemetry-proto/opentelemetry/proto/collector/logs/v1/logs_service.proto \
opentelemetry-proto/opentelemetry/proto/trace/v1/trace.proto \
opentelemetry-proto/opentelemetry/proto/resource/v1/resource.proto
opentelemetry-proto/opentelemetry/proto/resource/v1/resource.proto \
opentelemetry-proto/opentelemetry/proto/logs/v1/logs.proto
blakeroberts-wk marked this conversation as resolved.
Show resolved Hide resolved
./scripts/attach_copyright.sh

analyze:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
// Copyright 2021-2022 Workiva.
// Licensed under the Apache License, Version 2.0. Please see https://github.com/Workiva/opentelemetry-dart/blob/master/LICENSE for more information

//
// Generated code. Do not modify.
// source: opentelemetry/proto/collector/logs/v1/logs_service.proto
//
// @dart = 2.12

// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

import 'dart:async' as $async;
import 'dart:core' as $core;

import 'package:fixnum/fixnum.dart' as $fixnum;
import 'package:protobuf/protobuf.dart' as $pb;

import '../../../logs/v1/logs.pb.dart' as $4;

class ExportLogsServiceRequest extends $pb.GeneratedMessage {
factory ExportLogsServiceRequest({
$core.Iterable<$4.ResourceLogs>? resourceLogs,
}) {
final $result = create();
if (resourceLogs != null) {
$result.resourceLogs.addAll(resourceLogs);
}
return $result;
}
ExportLogsServiceRequest._() : super();
factory ExportLogsServiceRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ExportLogsServiceRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);

static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ExportLogsServiceRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'opentelemetry.proto.collector.logs.v1'), createEmptyInstance: create)
..pc<$4.ResourceLogs>(1, _omitFieldNames ? '' : 'resourceLogs', $pb.PbFieldType.PM, subBuilder: $4.ResourceLogs.create)
..hasRequiredFields = false
;

@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ExportLogsServiceRequest clone() => ExportLogsServiceRequest()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ExportLogsServiceRequest copyWith(void Function(ExportLogsServiceRequest) updates) => super.copyWith((message) => updates(message as ExportLogsServiceRequest)) as ExportLogsServiceRequest;

$pb.BuilderInfo get info_ => _i;

@$core.pragma('dart2js:noInline')
static ExportLogsServiceRequest create() => ExportLogsServiceRequest._();
ExportLogsServiceRequest createEmptyInstance() => create();
static $pb.PbList<ExportLogsServiceRequest> createRepeated() => $pb.PbList<ExportLogsServiceRequest>();
@$core.pragma('dart2js:noInline')
static ExportLogsServiceRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ExportLogsServiceRequest>(create);
static ExportLogsServiceRequest? _defaultInstance;

/// An array of ResourceLogs.
/// For data coming from a single resource this array will typically contain one
/// element. Intermediary nodes (such as OpenTelemetry Collector) that receive
/// data from multiple origins typically batch the data before forwarding further and
/// in that case this array will contain multiple elements.
@$pb.TagNumber(1)
$core.List<$4.ResourceLogs> get resourceLogs => $_getList(0);
}

class ExportLogsServiceResponse extends $pb.GeneratedMessage {
factory ExportLogsServiceResponse({
ExportLogsPartialSuccess? partialSuccess,
}) {
final $result = create();
if (partialSuccess != null) {
$result.partialSuccess = partialSuccess;
}
return $result;
}
ExportLogsServiceResponse._() : super();
factory ExportLogsServiceResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ExportLogsServiceResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);

static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ExportLogsServiceResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'opentelemetry.proto.collector.logs.v1'), createEmptyInstance: create)
..aOM<ExportLogsPartialSuccess>(1, _omitFieldNames ? '' : 'partialSuccess', subBuilder: ExportLogsPartialSuccess.create)
..hasRequiredFields = false
;

@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ExportLogsServiceResponse clone() => ExportLogsServiceResponse()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ExportLogsServiceResponse copyWith(void Function(ExportLogsServiceResponse) updates) => super.copyWith((message) => updates(message as ExportLogsServiceResponse)) as ExportLogsServiceResponse;

$pb.BuilderInfo get info_ => _i;

@$core.pragma('dart2js:noInline')
static ExportLogsServiceResponse create() => ExportLogsServiceResponse._();
ExportLogsServiceResponse createEmptyInstance() => create();
static $pb.PbList<ExportLogsServiceResponse> createRepeated() => $pb.PbList<ExportLogsServiceResponse>();
@$core.pragma('dart2js:noInline')
static ExportLogsServiceResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ExportLogsServiceResponse>(create);
static ExportLogsServiceResponse? _defaultInstance;

/// The details of a partially successful export request.
///
/// If the request is only partially accepted
/// (i.e. when the server accepts only parts of the data and rejects the rest)
/// the server MUST initialize the `partial_success` field and MUST
/// set the `rejected_<signal>` with the number of items it rejected.
///
/// Servers MAY also make use of the `partial_success` field to convey
/// warnings/suggestions to senders even when the request was fully accepted.
/// In such cases, the `rejected_<signal>` MUST have a value of `0` and
/// the `error_message` MUST be non-empty.
///
/// A `partial_success` message with an empty value (rejected_<signal> = 0 and
/// `error_message` = "") is equivalent to it not being set/present. Senders
/// SHOULD interpret it the same way as in the full success case.
@$pb.TagNumber(1)
ExportLogsPartialSuccess get partialSuccess => $_getN(0);
@$pb.TagNumber(1)
set partialSuccess(ExportLogsPartialSuccess v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasPartialSuccess() => $_has(0);
@$pb.TagNumber(1)
void clearPartialSuccess() => clearField(1);
@$pb.TagNumber(1)
ExportLogsPartialSuccess ensurePartialSuccess() => $_ensure(0);
}

class ExportLogsPartialSuccess extends $pb.GeneratedMessage {
factory ExportLogsPartialSuccess({
$fixnum.Int64? rejectedLogRecords,
$core.String? errorMessage,
}) {
final $result = create();
if (rejectedLogRecords != null) {
$result.rejectedLogRecords = rejectedLogRecords;
}
if (errorMessage != null) {
$result.errorMessage = errorMessage;
}
return $result;
}
ExportLogsPartialSuccess._() : super();
factory ExportLogsPartialSuccess.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ExportLogsPartialSuccess.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);

static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ExportLogsPartialSuccess', package: const $pb.PackageName(_omitMessageNames ? '' : 'opentelemetry.proto.collector.logs.v1'), createEmptyInstance: create)
..aInt64(1, _omitFieldNames ? '' : 'rejectedLogRecords')
..aOS(2, _omitFieldNames ? '' : 'errorMessage')
..hasRequiredFields = false
;

@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ExportLogsPartialSuccess clone() => ExportLogsPartialSuccess()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ExportLogsPartialSuccess copyWith(void Function(ExportLogsPartialSuccess) updates) => super.copyWith((message) => updates(message as ExportLogsPartialSuccess)) as ExportLogsPartialSuccess;

$pb.BuilderInfo get info_ => _i;

@$core.pragma('dart2js:noInline')
static ExportLogsPartialSuccess create() => ExportLogsPartialSuccess._();
ExportLogsPartialSuccess createEmptyInstance() => create();
static $pb.PbList<ExportLogsPartialSuccess> createRepeated() => $pb.PbList<ExportLogsPartialSuccess>();
@$core.pragma('dart2js:noInline')
static ExportLogsPartialSuccess getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ExportLogsPartialSuccess>(create);
static ExportLogsPartialSuccess? _defaultInstance;

/// The number of rejected log records.
///
/// A `rejected_<signal>` field holding a `0` value indicates that the
/// request was fully accepted.
@$pb.TagNumber(1)
$fixnum.Int64 get rejectedLogRecords => $_getI64(0);
@$pb.TagNumber(1)
set rejectedLogRecords($fixnum.Int64 v) { $_setInt64(0, v); }
@$pb.TagNumber(1)
$core.bool hasRejectedLogRecords() => $_has(0);
@$pb.TagNumber(1)
void clearRejectedLogRecords() => clearField(1);

/// A developer-facing human-readable message in English. It should be used
/// either to explain why the server rejected parts of the data during a partial
/// success or to convey warnings/suggestions during a full success. The message
/// should offer guidance on how users can address such issues.
///
/// error_message is an optional field. An error_message with an empty value
/// is equivalent to it not being set.
@$pb.TagNumber(2)
$core.String get errorMessage => $_getSZ(1);
@$pb.TagNumber(2)
set errorMessage($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasErrorMessage() => $_has(1);
@$pb.TagNumber(2)
void clearErrorMessage() => clearField(2);
}

class LogsServiceApi {
$pb.RpcClient _client;
LogsServiceApi(this._client);

$async.Future<ExportLogsServiceResponse> export($pb.ClientContext? ctx, ExportLogsServiceRequest request) =>
_client.invoke<ExportLogsServiceResponse>(ctx, 'LogsService', 'Export', request, ExportLogsServiceResponse())
;
}


const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2021-2022 Workiva.
// Licensed under the Apache License, Version 2.0. Please see https://github.com/Workiva/opentelemetry-dart/blob/master/LICENSE for more information

//
// Generated code. Do not modify.
// source: opentelemetry/proto/collector/logs/v1/logs_service.proto
//
// @dart = 2.12

// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Copyright 2021-2022 Workiva.
// Licensed under the Apache License, Version 2.0. Please see https://github.com/Workiva/opentelemetry-dart/blob/master/LICENSE for more information

//
// Generated code. Do not modify.
// source: opentelemetry/proto/collector/logs/v1/logs_service.proto
//
// @dart = 2.12

// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;

import '../../../common/v1/common.pbjson.dart' as $0;
import '../../../logs/v1/logs.pbjson.dart' as $4;
import '../../../resource/v1/resource.pbjson.dart' as $1;

@$core.Deprecated('Use exportLogsServiceRequestDescriptor instead')
const ExportLogsServiceRequest$json = {
'1': 'ExportLogsServiceRequest',
'2': [
{'1': 'resource_logs', '3': 1, '4': 3, '5': 11, '6': '.opentelemetry.proto.logs.v1.ResourceLogs', '10': 'resourceLogs'},
],
};

/// Descriptor for `ExportLogsServiceRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List exportLogsServiceRequestDescriptor = $convert.base64Decode(
'ChhFeHBvcnRMb2dzU2VydmljZVJlcXVlc3QSTgoNcmVzb3VyY2VfbG9ncxgBIAMoCzIpLm9wZW'
'50ZWxlbWV0cnkucHJvdG8ubG9ncy52MS5SZXNvdXJjZUxvZ3NSDHJlc291cmNlTG9ncw==');

@$core.Deprecated('Use exportLogsServiceResponseDescriptor instead')
const ExportLogsServiceResponse$json = {
'1': 'ExportLogsServiceResponse',
'2': [
{'1': 'partial_success', '3': 1, '4': 1, '5': 11, '6': '.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess', '10': 'partialSuccess'},
],
};

/// Descriptor for `ExportLogsServiceResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List exportLogsServiceResponseDescriptor = $convert.base64Decode(
'ChlFeHBvcnRMb2dzU2VydmljZVJlc3BvbnNlEmgKD3BhcnRpYWxfc3VjY2VzcxgBIAEoCzI/Lm'
'9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLmxvZ3MudjEuRXhwb3J0TG9nc1BhcnRpYWxT'
'dWNjZXNzUg5wYXJ0aWFsU3VjY2Vzcw==');

@$core.Deprecated('Use exportLogsPartialSuccessDescriptor instead')
const ExportLogsPartialSuccess$json = {
'1': 'ExportLogsPartialSuccess',
'2': [
{'1': 'rejected_log_records', '3': 1, '4': 1, '5': 3, '10': 'rejectedLogRecords'},
{'1': 'error_message', '3': 2, '4': 1, '5': 9, '10': 'errorMessage'},
],
};

/// Descriptor for `ExportLogsPartialSuccess`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List exportLogsPartialSuccessDescriptor = $convert.base64Decode(
'ChhFeHBvcnRMb2dzUGFydGlhbFN1Y2Nlc3MSMAoUcmVqZWN0ZWRfbG9nX3JlY29yZHMYASABKA'
'NSEnJlamVjdGVkTG9nUmVjb3JkcxIjCg1lcnJvcl9tZXNzYWdlGAIgASgJUgxlcnJvck1lc3Nh'
'Z2U=');

const $core.Map<$core.String, $core.dynamic> LogsServiceBase$json = {
'1': 'LogsService',
'2': [
{'1': 'Export', '2': '.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest', '3': '.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse', '4': {}},
],
};

@$core.Deprecated('Use logsServiceDescriptor instead')
const $core.Map<$core.String, $core.Map<$core.String, $core.dynamic>> LogsServiceBase$messageJson = {
'.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest': ExportLogsServiceRequest$json,
'.opentelemetry.proto.logs.v1.ResourceLogs': $4.ResourceLogs$json,
'.opentelemetry.proto.resource.v1.Resource': $1.Resource$json,
'.opentelemetry.proto.common.v1.KeyValue': $0.KeyValue$json,
'.opentelemetry.proto.common.v1.AnyValue': $0.AnyValue$json,
'.opentelemetry.proto.common.v1.ArrayValue': $0.ArrayValue$json,
'.opentelemetry.proto.common.v1.KeyValueList': $0.KeyValueList$json,
'.opentelemetry.proto.logs.v1.ScopeLogs': $4.ScopeLogs$json,
'.opentelemetry.proto.common.v1.InstrumentationScope': $0.InstrumentationScope$json,
'.opentelemetry.proto.logs.v1.LogRecord': $4.LogRecord$json,
'.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse': ExportLogsServiceResponse$json,
'.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess': ExportLogsPartialSuccess$json,
};

/// Descriptor for `LogsService`. Decode as a `google.protobuf.ServiceDescriptorProto`.
final $typed_data.Uint8List logsServiceDescriptor = $convert.base64Decode(
'CgtMb2dzU2VydmljZRKNAQoGRXhwb3J0Ej8ub3BlbnRlbGVtZXRyeS5wcm90by5jb2xsZWN0b3'
'IubG9ncy52MS5FeHBvcnRMb2dzU2VydmljZVJlcXVlc3QaQC5vcGVudGVsZW1ldHJ5LnByb3Rv'
'LmNvbGxlY3Rvci5sb2dzLnYxLkV4cG9ydExvZ3NTZXJ2aWNlUmVzcG9uc2UiAA==');

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2021-2022 Workiva.
// Licensed under the Apache License, Version 2.0. Please see https://github.com/Workiva/opentelemetry-dart/blob/master/LICENSE for more information

//
// Generated code. Do not modify.
// source: opentelemetry/proto/collector/logs/v1/logs_service.proto
//
// @dart = 2.12

// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

import 'dart:async' as $async;
import 'dart:core' as $core;

import 'package:protobuf/protobuf.dart' as $pb;

import 'logs_service.pb.dart' as $5;
import 'logs_service.pbjson.dart';

export 'logs_service.pb.dart';

abstract class LogsServiceBase extends $pb.GeneratedService {
$async.Future<$5.ExportLogsServiceResponse> export($pb.ServerContext ctx, $5.ExportLogsServiceRequest request);

$pb.GeneratedMessage createRequest($core.String methodName) {
switch (methodName) {
case 'Export': return $5.ExportLogsServiceRequest();
default: throw $core.ArgumentError('Unknown method: $methodName');
}
}

$async.Future<$pb.GeneratedMessage> handleCall($pb.ServerContext ctx, $core.String methodName, $pb.GeneratedMessage request) {
switch (methodName) {
case 'Export': return this.export(ctx, request as $5.ExportLogsServiceRequest);
default: throw $core.ArgumentError('Unknown method: $methodName');
}
}

$core.Map<$core.String, $core.dynamic> get $json => LogsServiceBase$json;
$core.Map<$core.String, $core.Map<$core.String, $core.dynamic>> get $messageJson => LogsServiceBase$messageJson;
}

Loading
Loading