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

Bump OTLP proto to 1.3.1 #3402

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions test/IntegrationTests/ContinuousProfilerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#if NET6_0_OR_GREATER

using IntegrationTests.Helpers;
using OpenTelemetry.Proto.Profiles.V1;
using OpenTelemetry.Proto.Profiles.V1.Alternatives.PprofExtended;
using OpenTelemetry.Proto.Profiles.V1Experimental;
using Xunit.Abstractions;

namespace IntegrationTests;
Expand Down
33 changes: 15 additions & 18 deletions test/IntegrationTests/Helpers/MockProfilesCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using System.Collections.Concurrent;
using System.Text;
using Microsoft.AspNetCore.Http;
using OpenTelemetry.Proto.Collector.Profiles.V1;
using OpenTelemetry.Proto.Profiles.V1;
using OpenTelemetry.Proto.Collector.Profiles.V1Experimental;
using OpenTelemetry.Proto.Profiles.V1Experimental;
using Xunit.Abstractions;

namespace IntegrationTests.Helpers;
Expand Down Expand Up @@ -41,7 +41,7 @@ public void Dispose()
_listener.Dispose();
}

public void Expect(Func<ProfilesData, bool>? predicate = null, string? description = null)
public void Expect(Func<ExportProfilesServiceRequest, bool>? predicate = null, string? description = null)
{
predicate ??= x => true;

Expand Down Expand Up @@ -70,7 +70,7 @@ public void AssertExpectations(TimeSpan? timeout = null)
var found = false;
for (var i = missingExpectations.Count - 1; i >= 0; i--)
{
if (!missingExpectations[i].Predicate(collectedProfilesDataSnapshot.ProfilesData))
if (!missingExpectations[i].Predicate(collectedProfilesDataSnapshot.ExportProfilesServiceRequest))
{
continue;
}
Expand Down Expand Up @@ -142,17 +142,14 @@ private async Task HandleHttpRequests(HttpContext ctx)
await ctx.GenerateEmptyProtobufResponseAsync<ExportProfilesServiceResponse>();
}

private void HandleProfilesMessage(ExportProfilesServiceRequest metricsMessage)
private void HandleProfilesMessage(ExportProfilesServiceRequest profileMessage)
{
foreach (var profilesData in metricsMessage.ProfilesData ?? Enumerable.Empty<ProfilesData>())
foreach (var resourceProfile in profileMessage.ResourceProfiles ?? Enumerable.Empty<ResourceProfiles>())
{
foreach (var resourceProfile in profilesData.ResourceProfiles)
{
ResourceExpector.Collect(resourceProfile.Resource);
}

_profilesSnapshots.Add(new Collected(profilesData));
ResourceExpector.Collect(resourceProfile.Resource);
}

_profilesSnapshots.Add(new Collected(profileMessage));
}

private void WriteOutput(string msg)
Expand All @@ -163,28 +160,28 @@ private void WriteOutput(string msg)

public class Collected
{
public Collected(ProfilesData profilesData)
public Collected(ExportProfilesServiceRequest exportProfilesServiceRequest)
{
ProfilesData = profilesData;
ExportProfilesServiceRequest = exportProfilesServiceRequest;
}

public ProfilesData ProfilesData { get; } // protobuf type
public ExportProfilesServiceRequest ExportProfilesServiceRequest { get; } // protobuf type

public override string ToString()
{
return $"ProfilesData = {ProfilesData}";
return $"ExportProfilesServiceRequest = {ExportProfilesServiceRequest}";
}
}

private class Expectation
{
public Expectation(Func<ProfilesData, bool> predicate, string? description)
public Expectation(Func<ExportProfilesServiceRequest, bool> predicate, string? description)
{
Predicate = predicate;
Description = description;
}

public Func<ProfilesData, bool> Predicate { get; }
public Func<ExportProfilesServiceRequest, bool> Predicate { get; }

public string? Description { get; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019, OpenTelemetry Authors
// Copyright 2023, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,32 +14,31 @@

syntax = "proto3";

package opentelemetry.proto.collector.profiles.v1;
package opentelemetry.proto.collector.profiles.v1experimental;

import "opentelemetry/proto/profiles/v1/profiles.proto";
import "opentelemetry/proto/profiles/v1experimental/profiles.proto";

option csharp_namespace = "OpenTelemetry.Proto.Collector.Profiles.V1";
option csharp_namespace = "OpenTelemetry.Proto.Collector.Profiles.V1Experimental";
option java_multiple_files = true;
option java_package = "io.opentelemetry.proto.collector.profiles.v1";
option java_package = "io.opentelemetry.proto.collector.profiles.v1experimental";
option java_outer_classname = "ProfilesServiceProto";
option go_package = "go.opentelemetry.io/proto/otlp/collector/profiles/v1";
option go_package = "go.opentelemetry.io/proto/otlp/collector/profiles/v1experimental";

// Service that can be used to push profiles data between one Application instrumented with
// OpenTelemetry and a collector, or between a collector and a central collector (in this
// case profiles data are sent/received to/from multiple Applications).
// Service that can be used to push profiles between one Application instrumented with
// OpenTelemetry and a collector, or between a collector and a central collector.
service ProfilesService {
// For performance reasons, it is recommended to keep this RPC
// alive for the entire life of the application.
rpc Export(ExportProfilesServiceRequest) returns (ExportProfilesServiceResponse) {}
}

message ExportProfilesServiceRequest {
// An array of ProfilesData.
// An array of ResourceProfiles.
// 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.
repeated opentelemetry.proto.profiles.v1.ProfilesData profiles_data = 1;
repeated opentelemetry.proto.profiles.v1experimental.ResourceProfiles resource_profiles = 1;
}

message ExportProfilesServiceResponse {
Expand All @@ -62,11 +61,11 @@ message ExportProfilesServiceResponse {
}

message ExportProfilesPartialSuccess {
// The number of rejected spans.
// The number of rejected profiles.
//
// A `rejected_<signal>` field holding a `0` value indicates that the
// request was fully accepted.
int64 rejected_spans = 1;
int64 rejected_profiles = 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ type: google.api.Service
config_version: 3
http:
rules:
- selector: opentelemetry.proto.collector.profiles.v1.ProfilesService.Export
post: /v1/profiles
- selector: opentelemetry.proto.collector.profiles.v1experimental.ProfilesService.Export
post: /v1experimental/profiles
body: "*"
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
// Copyright 2023, 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.
//
// This file includes work covered by the following copyright and permission notices:
//
// Copyright 2016 Google Inc. All Rights Reserved.
//
// 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.

// Profile is a common stacktrace profile format.
//
// Measurements represented with this format should follow the
Expand All @@ -24,12 +54,12 @@

syntax = "proto3";

package opentelemetry.proto.profiles.v1.alternatives.pprofextended;
package opentelemetry.proto.profiles.v1experimental;

import "opentelemetry/proto/common/v1/common.proto";

option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1.Alternatives.PprofExtended";
option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1/alternatives/pprofextended";
option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1Experimental";
option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1experimental";

// Represents a complete profile, including sample types, samples,
// mappings to binaries, locations, functions, string table, and additional metadata.
Expand Down Expand Up @@ -227,9 +257,9 @@ message Sample {
// Reference to link in Profile.link_table. [optional]
uint64 link = 12;

// Timestamps associated with Sample represented in ms. These timestamps are expected
// Timestamps associated with Sample represented in nanoseconds. These timestamps are expected
// to fall within the Profile's time range. [optional]
repeated uint64 timestamps = 13;
repeated uint64 timestamps_unix_nano = 13;
}

// Provides additional context for a sample,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
// Copyright 2023, 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.

syntax = "proto3";

package opentelemetry.proto.profiles.v1;
package opentelemetry.proto.profiles.v1experimental;

import "opentelemetry/proto/common/v1/common.proto";
import "opentelemetry/proto/resource/v1/resource.proto";
import "opentelemetry/proto/profiles/v1experimental/pprofextended.proto";

import "opentelemetry/proto/profiles/v1/alternatives/pprofextended/pprofextended.proto";

option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1";
option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1Experimental";
option java_multiple_files = true;
option java_package = "io.opentelemetry.proto.profiles.v1";
option java_package = "io.opentelemetry.proto.profiles.v1experimental";
option java_outer_classname = "ProfilesProto";
option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1";
option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1experimental";

// Relationships Diagram
//
Expand Down Expand Up @@ -87,6 +100,7 @@ message ProfilesData {
repeated ResourceProfiles resource_profiles = 1;
}


// A collection of ScopeProfiles from a Resource.
message ResourceProfiles {
reserved 1000;
Expand All @@ -98,12 +112,15 @@ message ResourceProfiles {
// A list of ScopeProfiles that originate from a resource.
repeated ScopeProfiles scope_profiles = 2;

// The Schema URL, if known. This is the identifier of the Schema that the resource data
// is recorded in. To learn more about Schema URL see
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
// This schema_url applies to the data in the "resource" field. It does not apply
// to the data in the "scope_profiles" field which have their own schema_url field.
string schema_url = 3;
}

// A collection of Profiles produced by an InstrumentationScope.
// A collection of ProfileContainers produced by an InstrumentationScope.
message ScopeProfiles {
// The instrumentation scope information for the profiles in this message.
// Semantically when InstrumentationScope isn't set, it is equivalent with
Expand All @@ -113,7 +130,10 @@ message ScopeProfiles {
// A list of ProfileContainers that originate from an instrumentation scope.
repeated ProfileContainer profiles = 2;

// This schema_url applies to all profiles and profile events in the "profiles" field.
// The Schema URL, if known. This is the identifier of the Schema that the metric data
// is recorded in. To learn more about Schema URL see
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
// This schema_url applies to all profiles in the "profiles" field.
string schema_url = 3;
}

Expand Down Expand Up @@ -167,5 +187,5 @@ message ProfileContainer {
bytes original_payload = 7;

// This is a reference to a pprof profile. Required, even when original_payload is present.
opentelemetry.proto.profiles.v1.alternatives.pprofextended.Profile profile = 8;
opentelemetry.proto.profiles.v1experimental.Profile profile = 8;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Google.Protobuf;
using OpenTelemetry.Proto.Common.V1;
using OpenTelemetry.Proto.Profiles.V1.Alternatives.PprofExtended;
using OpenTelemetry.Proto.Profiles.V1Experimental;

namespace TestApplication.ContinuousProfiler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
using System.Net.Http.Headers;
using System.Runtime.CompilerServices;
using Google.Protobuf;
using OpenTelemetry.Proto.Collector.Profiles.V1;
using OpenTelemetry.Proto.Collector.Profiles.V1Experimental;
using OpenTelemetry.Proto.Common.V1;
using OpenTelemetry.Proto.Profiles.V1;
using OpenTelemetry.Proto.Profiles.V1.Alternatives.PprofExtended;
using OpenTelemetry.Proto.Profiles.V1Experimental;
using OpenTelemetry.Proto.Resource.V1;

namespace TestApplication.ContinuousProfiler;
Expand Down Expand Up @@ -149,7 +148,7 @@ private static ExportProfilesServiceRequest CreateExportProfilesServiceRequest(P
{
var request = new ExportProfilesServiceRequest();

request.ProfilesData.Add(profilesData);
request.ResourceProfiles.Add(profilesData.ResourceProfiles);

return request;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

using OpenTelemetry.Proto.Profiles.V1.Alternatives.PprofExtended;
using OpenTelemetry.Proto.Profiles.V1Experimental;

namespace TestApplication.ContinuousProfiler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<ItemGroup>
<Protobuf Include="..\..\..\IntegrationTests\opentelemetry\proto\common\v1\common.proto" Link="opentelemetry\proto\common\v1\common.proto" ProtoRoot="..\..\..\IntegrationTests" Access="internal" />
<Protobuf Include="..\..\..\IntegrationTests\opentelemetry\proto\resource\v1\resource.proto" Link="opentelemetry\proto\resource\v1\resource.proto" ProtoRoot="..\..\..\IntegrationTests" Access="internal" />
<Protobuf Include="..\..\..\IntegrationTests\opentelemetry\proto\profiles\v1\alternatives\pprofextended\pprofextended.proto" Link="opentelemetry\proto\profiles\v1\alternatives\pprofextended\pprofextended.proto" ProtoRoot="..\..\..\IntegrationTests" Access="internal" />
<Protobuf Include="..\..\..\IntegrationTests\opentelemetry\proto\profiles\v1\profiles.proto" Link="opentelemetry\proto\profiles\v1\profiles.proto" ProtoRoot="..\..\..\IntegrationTests" Access="internal" />
<Protobuf Include="..\..\..\IntegrationTests\opentelemetry\proto\collector\profiles\v1\profiles_service.proto" Link="opentelemetry\proto\collector\profiles\v1\profiles_service.proto" ProtoRoot="..\..\..\IntegrationTests" Access="internal" />
<Protobuf Include="..\..\..\IntegrationTests\opentelemetry\proto\profiles\v1experimental\pprofextended.proto" Link="opentelemetry\proto\profiles\v1experimental\pprofextended.proto" ProtoRoot="..\..\..\IntegrationTests" Access="internal" />
<Protobuf Include="..\..\..\IntegrationTests\opentelemetry\proto\profiles\v1experimental\profiles.proto" Link="opentelemetry\proto\profiles\v1experimental\profiles.proto" ProtoRoot="..\..\..\IntegrationTests" Access="internal" />
<Protobuf Include="..\..\..\IntegrationTests\opentelemetry\proto\collector\profiles\v1experimental\profiles_service.proto" Link="opentelemetry\proto\collector\profiles\v1\profiles_service.proto" ProtoRoot="..\..\..\IntegrationTests" Access="internal" />
</ItemGroup>
</Project>
Loading