@grafana/sigil-sdk-js 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +3 -0
  2. package/README.md +367 -0
  3. package/dist/client.d.ts +102 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +1502 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/config.d.ts +9 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +190 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/content_capture.d.ts +35 -0
  12. package/dist/content_capture.d.ts.map +1 -0
  13. package/dist/content_capture.js +123 -0
  14. package/dist/content_capture.js.map +1 -0
  15. package/dist/context.d.ts +11 -0
  16. package/dist/context.d.ts.map +1 -0
  17. package/dist/context.js +53 -0
  18. package/dist/context.js.map +1 -0
  19. package/dist/exporters/default.d.ts +3 -0
  20. package/dist/exporters/default.d.ts.map +1 -0
  21. package/dist/exporters/default.js +34 -0
  22. package/dist/exporters/default.js.map +1 -0
  23. package/dist/exporters/grpc.d.ts +14 -0
  24. package/dist/exporters/grpc.d.ts.map +1 -0
  25. package/dist/exporters/grpc.js +369 -0
  26. package/dist/exporters/grpc.js.map +1 -0
  27. package/dist/exporters/http.d.ts +8 -0
  28. package/dist/exporters/http.d.ts.map +1 -0
  29. package/dist/exporters/http.js +258 -0
  30. package/dist/exporters/http.js.map +1 -0
  31. package/dist/frameworks/google-adk/index.d.ts +136 -0
  32. package/dist/frameworks/google-adk/index.d.ts.map +1 -0
  33. package/dist/frameworks/google-adk/index.js +509 -0
  34. package/dist/frameworks/google-adk/index.js.map +1 -0
  35. package/dist/frameworks/langchain/index.d.ts +29 -0
  36. package/dist/frameworks/langchain/index.d.ts.map +1 -0
  37. package/dist/frameworks/langchain/index.js +70 -0
  38. package/dist/frameworks/langchain/index.js.map +1 -0
  39. package/dist/frameworks/langgraph/index.d.ts +29 -0
  40. package/dist/frameworks/langgraph/index.d.ts.map +1 -0
  41. package/dist/frameworks/langgraph/index.js +70 -0
  42. package/dist/frameworks/langgraph/index.js.map +1 -0
  43. package/dist/frameworks/llamaindex/index.d.ts +43 -0
  44. package/dist/frameworks/llamaindex/index.d.ts.map +1 -0
  45. package/dist/frameworks/llamaindex/index.js +493 -0
  46. package/dist/frameworks/llamaindex/index.js.map +1 -0
  47. package/dist/frameworks/openai-agents/index.d.ts +33 -0
  48. package/dist/frameworks/openai-agents/index.d.ts.map +1 -0
  49. package/dist/frameworks/openai-agents/index.js +531 -0
  50. package/dist/frameworks/openai-agents/index.js.map +1 -0
  51. package/dist/frameworks/shared.d.ts +57 -0
  52. package/dist/frameworks/shared.d.ts.map +1 -0
  53. package/dist/frameworks/shared.js +1032 -0
  54. package/dist/frameworks/shared.js.map +1 -0
  55. package/dist/frameworks/vercel-ai-sdk/hooks.d.ts +18 -0
  56. package/dist/frameworks/vercel-ai-sdk/hooks.d.ts.map +1 -0
  57. package/dist/frameworks/vercel-ai-sdk/hooks.js +672 -0
  58. package/dist/frameworks/vercel-ai-sdk/hooks.js.map +1 -0
  59. package/dist/frameworks/vercel-ai-sdk/index.d.ts +8 -0
  60. package/dist/frameworks/vercel-ai-sdk/index.d.ts.map +1 -0
  61. package/dist/frameworks/vercel-ai-sdk/index.js +7 -0
  62. package/dist/frameworks/vercel-ai-sdk/index.js.map +1 -0
  63. package/dist/frameworks/vercel-ai-sdk/mapping.d.ts +49 -0
  64. package/dist/frameworks/vercel-ai-sdk/mapping.d.ts.map +1 -0
  65. package/dist/frameworks/vercel-ai-sdk/mapping.js +660 -0
  66. package/dist/frameworks/vercel-ai-sdk/mapping.js.map +1 -0
  67. package/dist/frameworks/vercel-ai-sdk/types.d.ts +126 -0
  68. package/dist/frameworks/vercel-ai-sdk/types.d.ts.map +1 -0
  69. package/dist/frameworks/vercel-ai-sdk/types.js +2 -0
  70. package/dist/frameworks/vercel-ai-sdk/types.js.map +1 -0
  71. package/dist/index.d.ts +12 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +12 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/providers/anthropic.d.ts +35 -0
  76. package/dist/providers/anthropic.d.ts.map +1 -0
  77. package/dist/providers/anthropic.js +581 -0
  78. package/dist/providers/anthropic.js.map +1 -0
  79. package/dist/providers/gemini.d.ts +42 -0
  80. package/dist/providers/gemini.d.ts.map +1 -0
  81. package/dist/providers/gemini.js +650 -0
  82. package/dist/providers/gemini.js.map +1 -0
  83. package/dist/providers/openai.d.ts +67 -0
  84. package/dist/providers/openai.d.ts.map +1 -0
  85. package/dist/providers/openai.js +1007 -0
  86. package/dist/providers/openai.js.map +1 -0
  87. package/dist/types.d.ts +461 -0
  88. package/dist/types.d.ts.map +1 -0
  89. package/dist/types.js +2 -0
  90. package/dist/types.js.map +1 -0
  91. package/dist/utils.d.ts +25 -0
  92. package/dist/utils.d.ts.map +1 -0
  93. package/dist/utils.js +331 -0
  94. package/dist/utils.js.map +1 -0
  95. package/docs/frameworks/google-adk.md +84 -0
  96. package/docs/frameworks/langchain.md +102 -0
  97. package/docs/frameworks/langgraph.md +137 -0
  98. package/docs/frameworks/llamaindex.md +82 -0
  99. package/docs/frameworks/openai-agents.md +88 -0
  100. package/docs/frameworks/vercel-ai-sdk.md +124 -0
  101. package/docs/index.md +22 -0
  102. package/docs/providers/anthropic.md +69 -0
  103. package/docs/providers/gemini.md +86 -0
  104. package/docs/providers/openai.md +151 -0
  105. package/package.json +80 -0
  106. package/proto/opentelemetry/proto/collector/trace/v1/trace_service.proto +77 -0
  107. package/proto/opentelemetry/proto/common/v1/common.proto +115 -0
  108. package/proto/opentelemetry/proto/resource/v1/resource.proto +44 -0
  109. package/proto/opentelemetry/proto/trace/v1/trace.proto +357 -0
  110. package/proto/sigil/v1/generation_ingest.proto +145 -0
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@grafana/sigil-sdk-js",
3
+ "version": "0.0.1",
4
+ "license": "Apache-2.0",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./langchain": {
14
+ "types": "./dist/frameworks/langchain/index.d.ts",
15
+ "import": "./dist/frameworks/langchain/index.js"
16
+ },
17
+ "./langgraph": {
18
+ "types": "./dist/frameworks/langgraph/index.d.ts",
19
+ "import": "./dist/frameworks/langgraph/index.js"
20
+ },
21
+ "./openai-agents": {
22
+ "types": "./dist/frameworks/openai-agents/index.d.ts",
23
+ "import": "./dist/frameworks/openai-agents/index.js"
24
+ },
25
+ "./llamaindex": {
26
+ "types": "./dist/frameworks/llamaindex/index.d.ts",
27
+ "import": "./dist/frameworks/llamaindex/index.js"
28
+ },
29
+ "./google-adk": {
30
+ "types": "./dist/frameworks/google-adk/index.d.ts",
31
+ "import": "./dist/frameworks/google-adk/index.js"
32
+ },
33
+ "./vercel-ai-sdk": {
34
+ "types": "./dist/frameworks/vercel-ai-sdk/index.d.ts",
35
+ "import": "./dist/frameworks/vercel-ai-sdk/index.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "proto",
41
+ "docs",
42
+ "LICENSE",
43
+ "README.md"
44
+ ],
45
+ "sideEffects": false,
46
+ "scripts": {
47
+ "clean": "find dist -type f -delete 2>/dev/null || true && find dist -type d -empty -delete 2>/dev/null || true",
48
+ "build": "pnpm run clean && tsc --project tsconfig.build.json",
49
+ "typecheck": "tsc --project tsconfig.json --noEmit",
50
+ "test:build": "rm -rf .test-dist && tsc --project tsconfig.test.json",
51
+ "test": "pnpm run test:build && node --test test/**/*.test.mjs",
52
+ "test:ci": "pnpm run test",
53
+ "lint": "biome check .",
54
+ "lint:fix": "biome check --fix ."
55
+ },
56
+ "dependencies": {
57
+ "@anthropic-ai/sdk": "^0.81.0",
58
+ "@google/adk": "^0.5.0",
59
+ "@google/genai": "^1.41.0",
60
+ "@grpc/grpc-js": "^1.14.1",
61
+ "@grpc/proto-loader": "^0.8.0",
62
+ "@langchain/core": "^1.0.0",
63
+ "@langchain/langgraph": "^1.2.0",
64
+ "@openai/agents": "^0.8.0",
65
+ "@opentelemetry/api": "^1.9.0",
66
+ "@opentelemetry/exporter-metrics-otlp-grpc": "^0.213.0",
67
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.213.0",
68
+ "@opentelemetry/exporter-trace-otlp-grpc": "^0.213.0",
69
+ "@opentelemetry/exporter-trace-otlp-http": "^0.213.0",
70
+ "@opentelemetry/sdk-metrics": "^2.1.0",
71
+ "@opentelemetry/sdk-trace-base": "^2.5.0",
72
+ "llamaindex": "^0.12.1",
73
+ "openai": "^6.27.0"
74
+ },
75
+ "devDependencies": {
76
+ "@opentelemetry/context-async-hooks": "^2.6.0",
77
+ "@types/node": "^24.11.0",
78
+ "typescript": "^6.0.0"
79
+ }
80
+ }
@@ -0,0 +1,77 @@
1
+ // Copyright 2019, 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
+ syntax = "proto3";
16
+
17
+ package opentelemetry.proto.collector.trace.v1;
18
+
19
+ import "opentelemetry/proto/trace/v1/trace.proto";
20
+
21
+ option csharp_namespace = "OpenTelemetry.Proto.Collector.Trace.V1";
22
+ option java_multiple_files = true;
23
+ option java_package = "io.opentelemetry.proto.collector.trace.v1";
24
+ option java_outer_classname = "TraceServiceProto";
25
+ option go_package = "go.opentelemetry.io/proto/otlp/collector/trace/v1";
26
+
27
+ // Service that can be used to push spans between one Application instrumented with
28
+ // OpenTelemetry and a collector, or between a collector and a central collector (in this
29
+ // case spans are sent/received to/from multiple Applications).
30
+ service TraceService {
31
+ rpc Export(ExportTraceServiceRequest) returns (ExportTraceServiceResponse) {}
32
+ }
33
+
34
+ message ExportTraceServiceRequest {
35
+ // An array of ResourceSpans.
36
+ // For data coming from a single resource this array will typically contain one
37
+ // element. Intermediary nodes (such as OpenTelemetry Collector) that receive
38
+ // data from multiple origins typically batch the data before forwarding further and
39
+ // in that case this array will contain multiple elements.
40
+ repeated opentelemetry.proto.trace.v1.ResourceSpans resource_spans = 1;
41
+ }
42
+
43
+ message ExportTraceServiceResponse {
44
+ // The details of a partially successful export request.
45
+ //
46
+ // If the request is only partially accepted
47
+ // (i.e. when the server accepts only parts of the data and rejects the rest)
48
+ // the server MUST initialize the `partial_success` field and MUST
49
+ // set the `rejected_<signal>` with the number of items it rejected.
50
+ //
51
+ // Servers MAY also make use of the `partial_success` field to convey
52
+ // warnings/suggestions to senders even when the request was fully accepted.
53
+ // In such cases, the `rejected_<signal>` MUST have a value of `0` and
54
+ // the `error_message` MUST be non-empty.
55
+ //
56
+ // A `partial_success` message with an empty value (rejected_<signal> = 0 and
57
+ // `error_message` = "") is equivalent to it not being set/present. Senders
58
+ // SHOULD interpret it the same way as in the full success case.
59
+ ExportTracePartialSuccess partial_success = 1;
60
+ }
61
+
62
+ message ExportTracePartialSuccess {
63
+ // The number of rejected spans.
64
+ //
65
+ // A `rejected_<signal>` field holding a `0` value indicates that the
66
+ // request was fully accepted.
67
+ int64 rejected_spans = 1;
68
+
69
+ // A developer-facing human-readable message in English. It should be used
70
+ // either to explain why the server rejected parts of the data during a partial
71
+ // success or to convey warnings/suggestions during a full success. The message
72
+ // should offer guidance on how users can address such issues.
73
+ //
74
+ // error_message is an optional field. An error_message with an empty value
75
+ // is equivalent to it not being set.
76
+ string error_message = 2;
77
+ }
@@ -0,0 +1,115 @@
1
+ // Copyright 2019, 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
+ syntax = "proto3";
16
+
17
+ package opentelemetry.proto.common.v1;
18
+
19
+ option csharp_namespace = "OpenTelemetry.Proto.Common.V1";
20
+ option java_multiple_files = true;
21
+ option java_package = "io.opentelemetry.proto.common.v1";
22
+ option java_outer_classname = "CommonProto";
23
+ option go_package = "go.opentelemetry.io/proto/otlp/common/v1";
24
+
25
+ // AnyValue is used to represent any type of attribute value. AnyValue may contain a
26
+ // primitive value such as a string or integer or it may contain an arbitrary nested
27
+ // object containing arrays, key-value lists and primitives.
28
+ message AnyValue {
29
+ // The value is one of the listed fields. It is valid for all values to be unspecified
30
+ // in which case this AnyValue is considered to be "empty".
31
+ oneof value {
32
+ string string_value = 1;
33
+ bool bool_value = 2;
34
+ int64 int_value = 3;
35
+ double double_value = 4;
36
+ ArrayValue array_value = 5;
37
+ KeyValueList kvlist_value = 6;
38
+ bytes bytes_value = 7;
39
+ }
40
+ }
41
+
42
+ // ArrayValue is a list of AnyValue messages. We need ArrayValue as a message
43
+ // since oneof in AnyValue does not allow repeated fields.
44
+ message ArrayValue {
45
+ // Array of values. The array may be empty (contain 0 elements).
46
+ repeated AnyValue values = 1;
47
+ }
48
+
49
+ // KeyValueList is a list of KeyValue messages. We need KeyValueList as a message
50
+ // since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need
51
+ // a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to
52
+ // avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches
53
+ // are semantically equivalent.
54
+ message KeyValueList {
55
+ // A collection of key/value pairs of key-value pairs. The list may be empty (may
56
+ // contain 0 elements).
57
+ // The keys MUST be unique (it is not allowed to have more than one
58
+ // value with the same key).
59
+ repeated KeyValue values = 1;
60
+ }
61
+
62
+ // KeyValue is a key-value pair that is used to store Span attributes, Link
63
+ // attributes, etc.
64
+ message KeyValue {
65
+ string key = 1;
66
+ AnyValue value = 2;
67
+ }
68
+
69
+ // InstrumentationScope is a message representing the instrumentation scope information
70
+ // such as the fully qualified name and version.
71
+ message InstrumentationScope {
72
+ // An empty instrumentation scope name means the name is unknown.
73
+ string name = 1;
74
+ string version = 2;
75
+
76
+ // Additional attributes that describe the scope. [Optional].
77
+ // Attribute keys MUST be unique (it is not allowed to have more than one
78
+ // attribute with the same key).
79
+ repeated KeyValue attributes = 3;
80
+ uint32 dropped_attributes_count = 4;
81
+ }
82
+
83
+ // A reference to an Entity.
84
+ // Entity represents an object of interest associated with produced telemetry: e.g spans, metrics, profiles, or logs.
85
+ //
86
+ // Status: [Development]
87
+ message EntityRef {
88
+ // The Schema URL, if known. This is the identifier of the Schema that the entity data
89
+ // is recorded in. To learn more about Schema URL see
90
+ // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
91
+ //
92
+ // This schema_url applies to the data in this message and to the Resource attributes
93
+ // referenced by id_keys and description_keys.
94
+ // TODO: discuss if we are happy with this somewhat complicated definition of what
95
+ // the schema_url applies to.
96
+ //
97
+ // This field obsoletes the schema_url field in ResourceMetrics/ResourceSpans/ResourceLogs.
98
+ string schema_url = 1;
99
+
100
+ // Defines the type of the entity. MUST not change during the lifetime of the entity.
101
+ // For example: "service" or "host". This field is required and MUST not be empty
102
+ // for valid entities.
103
+ string type = 2;
104
+
105
+ // Attribute Keys that identify the entity.
106
+ // MUST not change during the lifetime of the entity. The Id must contain at least one attribute.
107
+ // These keys MUST exist in the containing {message}.attributes.
108
+ repeated string id_keys = 3;
109
+
110
+ // Descriptive (non-identifying) attribute keys of the entity.
111
+ // MAY change over the lifetime of the entity. MAY be empty.
112
+ // These attribute keys are not part of entity's identity.
113
+ // These keys MUST exist in the containing {message}.attributes.
114
+ repeated string description_keys = 4;
115
+ }
@@ -0,0 +1,44 @@
1
+ // Copyright 2019, 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
+ syntax = "proto3";
16
+
17
+ package opentelemetry.proto.resource.v1;
18
+
19
+ import "opentelemetry/proto/common/v1/common.proto";
20
+
21
+ option csharp_namespace = "OpenTelemetry.Proto.Resource.V1";
22
+ option java_multiple_files = true;
23
+ option java_package = "io.opentelemetry.proto.resource.v1";
24
+ option java_outer_classname = "ResourceProto";
25
+ option go_package = "go.opentelemetry.io/proto/otlp/resource/v1";
26
+
27
+ // Resource information.
28
+ message Resource {
29
+ // Set of attributes that describe the resource.
30
+ // Attribute keys MUST be unique (it is not allowed to have more than one
31
+ // attribute with the same key).
32
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;
33
+
34
+ // dropped_attributes_count is the number of dropped attributes. If the value is 0, then
35
+ // no attributes were dropped.
36
+ uint32 dropped_attributes_count = 2;
37
+
38
+ // Set of entities that participate in this Resource.
39
+ //
40
+ // Note: keys in the references MUST exist in attributes of this message.
41
+ //
42
+ // Status: [Development]
43
+ repeated opentelemetry.proto.common.v1.EntityRef entity_refs = 3;
44
+ }
@@ -0,0 +1,357 @@
1
+ // Copyright 2019, 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
+ syntax = "proto3";
16
+
17
+ package opentelemetry.proto.trace.v1;
18
+
19
+ import "opentelemetry/proto/common/v1/common.proto";
20
+ import "opentelemetry/proto/resource/v1/resource.proto";
21
+
22
+ option csharp_namespace = "OpenTelemetry.Proto.Trace.V1";
23
+ option java_multiple_files = true;
24
+ option java_package = "io.opentelemetry.proto.trace.v1";
25
+ option java_outer_classname = "TraceProto";
26
+ option go_package = "go.opentelemetry.io/proto/otlp/trace/v1";
27
+
28
+ // TracesData represents the traces data that can be stored in a persistent storage,
29
+ // OR can be embedded by other protocols that transfer OTLP traces data but do
30
+ // not implement the OTLP protocol.
31
+ //
32
+ // The main difference between this message and collector protocol is that
33
+ // in this message there will not be any "control" or "metadata" specific to
34
+ // OTLP protocol.
35
+ //
36
+ // When new fields are added into this message, the OTLP request MUST be updated
37
+ // as well.
38
+ message TracesData {
39
+ // An array of ResourceSpans.
40
+ // For data coming from a single resource this array will typically contain
41
+ // one element. Intermediary nodes that receive data from multiple origins
42
+ // typically batch the data before forwarding further and in that case this
43
+ // array will contain multiple elements.
44
+ repeated ResourceSpans resource_spans = 1;
45
+ }
46
+
47
+ // A collection of ScopeSpans from a Resource.
48
+ message ResourceSpans {
49
+ reserved 1000;
50
+
51
+ // The resource for the spans in this message.
52
+ // If this field is not set then no resource info is known.
53
+ opentelemetry.proto.resource.v1.Resource resource = 1;
54
+
55
+ // A list of ScopeSpans that originate from a resource.
56
+ repeated ScopeSpans scope_spans = 2;
57
+
58
+ // The Schema URL, if known. This is the identifier of the Schema that the resource data
59
+ // is recorded in. Notably, the last part of the URL path is the version number of the
60
+ // schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see
61
+ // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
62
+ // This schema_url applies to the data in the "resource" field. It does not apply
63
+ // to the data in the "scope_spans" field which have their own schema_url field.
64
+ string schema_url = 3;
65
+ }
66
+
67
+ // A collection of Spans produced by an InstrumentationScope.
68
+ message ScopeSpans {
69
+ // The instrumentation scope information for the spans in this message.
70
+ // Semantically when InstrumentationScope isn't set, it is equivalent with
71
+ // an empty instrumentation scope name (unknown).
72
+ opentelemetry.proto.common.v1.InstrumentationScope scope = 1;
73
+
74
+ // A list of Spans that originate from an instrumentation scope.
75
+ repeated Span spans = 2;
76
+
77
+ // The Schema URL, if known. This is the identifier of the Schema that the span data
78
+ // is recorded in. Notably, the last part of the URL path is the version number of the
79
+ // schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see
80
+ // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
81
+ // This schema_url applies to all spans and span events in the "spans" field.
82
+ string schema_url = 3;
83
+ }
84
+
85
+ // A Span represents a single operation performed by a single component of the system.
86
+ //
87
+ // The next available field id is 17.
88
+ message Span {
89
+ // A unique identifier for a trace. All spans from the same trace share
90
+ // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR
91
+ // of length other than 16 bytes is considered invalid (empty string in OTLP/JSON
92
+ // is zero-length and thus is also invalid).
93
+ //
94
+ // This field is required.
95
+ bytes trace_id = 1;
96
+
97
+ // A unique identifier for a span within a trace, assigned when the span
98
+ // is created. The ID is an 8-byte array. An ID with all zeroes OR of length
99
+ // other than 8 bytes is considered invalid (empty string in OTLP/JSON
100
+ // is zero-length and thus is also invalid).
101
+ //
102
+ // This field is required.
103
+ bytes span_id = 2;
104
+
105
+ // trace_state conveys information about request position in multiple distributed tracing graphs.
106
+ // It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header
107
+ // See also https://github.com/w3c/distributed-tracing for more details about this field.
108
+ string trace_state = 3;
109
+
110
+ // The `span_id` of this span's parent span. If this is a root span, then this
111
+ // field must be empty. The ID is an 8-byte array.
112
+ bytes parent_span_id = 4;
113
+
114
+ // Flags, a bit field.
115
+ //
116
+ // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
117
+ // Context specification. To read the 8-bit W3C trace flag, use
118
+ // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
119
+ //
120
+ // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
121
+ //
122
+ // Bits 8 and 9 represent the 3 states of whether a span's parent
123
+ // is remote. The states are (unknown, is not remote, is remote).
124
+ // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
125
+ // To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
126
+ //
127
+ // When creating span messages, if the message is logically forwarded from another source
128
+ // with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD
129
+ // be copied as-is. If creating from a source that does not have an equivalent flags field
130
+ // (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST
131
+ // be set to zero.
132
+ // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
133
+ //
134
+ // [Optional].
135
+ fixed32 flags = 16;
136
+
137
+ // A description of the span's operation.
138
+ //
139
+ // For example, the name can be a qualified method name or a file name
140
+ // and a line number where the operation is called. A best practice is to use
141
+ // the same display name at the same call point in an application.
142
+ // This makes it easier to correlate spans in different traces.
143
+ //
144
+ // This field is semantically required to be set to non-empty string.
145
+ // Empty value is equivalent to an unknown span name.
146
+ //
147
+ // This field is required.
148
+ string name = 5;
149
+
150
+ // SpanKind is the type of span. Can be used to specify additional relationships between spans
151
+ // in addition to a parent/child relationship.
152
+ enum SpanKind {
153
+ // Unspecified. Do NOT use as default.
154
+ // Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED.
155
+ SPAN_KIND_UNSPECIFIED = 0;
156
+
157
+ // Indicates that the span represents an internal operation within an application,
158
+ // as opposed to an operation happening at the boundaries. Default value.
159
+ SPAN_KIND_INTERNAL = 1;
160
+
161
+ // Indicates that the span covers server-side handling of an RPC or other
162
+ // remote network request.
163
+ SPAN_KIND_SERVER = 2;
164
+
165
+ // Indicates that the span describes a request to some remote service.
166
+ SPAN_KIND_CLIENT = 3;
167
+
168
+ // Indicates that the span describes a producer sending a message to a broker.
169
+ // Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
170
+ // between producer and consumer spans. A PRODUCER span ends when the message was accepted
171
+ // by the broker while the logical processing of the message might span a much longer time.
172
+ SPAN_KIND_PRODUCER = 4;
173
+
174
+ // Indicates that the span describes consumer receiving a message from a broker.
175
+ // Like the PRODUCER kind, there is often no direct critical path latency relationship
176
+ // between producer and consumer spans.
177
+ SPAN_KIND_CONSUMER = 5;
178
+ }
179
+
180
+ // Distinguishes between spans generated in a particular context. For example,
181
+ // two spans with the same name may be distinguished using `CLIENT` (caller)
182
+ // and `SERVER` (callee) to identify queueing latency associated with the span.
183
+ SpanKind kind = 6;
184
+
185
+ // start_time_unix_nano is the start time of the span. On the client side, this is the time
186
+ // kept by the local machine where the span execution starts. On the server side, this
187
+ // is the time when the server's application handler starts running.
188
+ // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
189
+ //
190
+ // This field is semantically required and it is expected that end_time >= start_time.
191
+ fixed64 start_time_unix_nano = 7;
192
+
193
+ // end_time_unix_nano is the end time of the span. On the client side, this is the time
194
+ // kept by the local machine where the span execution ends. On the server side, this
195
+ // is the time when the server application handler stops running.
196
+ // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
197
+ //
198
+ // This field is semantically required and it is expected that end_time >= start_time.
199
+ fixed64 end_time_unix_nano = 8;
200
+
201
+ // attributes is a collection of key/value pairs. Note, global attributes
202
+ // like server name can be set using the resource API. Examples of attributes:
203
+ //
204
+ // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
205
+ // "/http/server_latency": 300
206
+ // "example.com/myattribute": true
207
+ // "example.com/score": 10.239
208
+ //
209
+ // The OpenTelemetry API specification further restricts the allowed value types:
210
+ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute
211
+ // Attribute keys MUST be unique (it is not allowed to have more than one
212
+ // attribute with the same key).
213
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;
214
+
215
+ // dropped_attributes_count is the number of attributes that were discarded. Attributes
216
+ // can be discarded because their keys are too long or because there are too many
217
+ // attributes. If this value is 0, then no attributes were dropped.
218
+ uint32 dropped_attributes_count = 10;
219
+
220
+ // Event is a time-stamped annotation of the span, consisting of user-supplied
221
+ // text description and key-value pairs.
222
+ message Event {
223
+ // time_unix_nano is the time the event occurred.
224
+ fixed64 time_unix_nano = 1;
225
+
226
+ // name of the event.
227
+ // This field is semantically required to be set to non-empty string.
228
+ string name = 2;
229
+
230
+ // attributes is a collection of attribute key/value pairs on the event.
231
+ // Attribute keys MUST be unique (it is not allowed to have more than one
232
+ // attribute with the same key).
233
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 3;
234
+
235
+ // dropped_attributes_count is the number of dropped attributes. If the value is 0,
236
+ // then no attributes were dropped.
237
+ uint32 dropped_attributes_count = 4;
238
+ }
239
+
240
+ // events is a collection of Event items.
241
+ repeated Event events = 11;
242
+
243
+ // dropped_events_count is the number of dropped events. If the value is 0, then no
244
+ // events were dropped.
245
+ uint32 dropped_events_count = 12;
246
+
247
+ // A pointer from the current span to another span in the same trace or in a
248
+ // different trace. For example, this can be used in batching operations,
249
+ // where a single batch handler processes multiple requests from different
250
+ // traces or when the handler receives a request from a different project.
251
+ message Link {
252
+ // A unique identifier of a trace that this linked span is part of. The ID is a
253
+ // 16-byte array.
254
+ bytes trace_id = 1;
255
+
256
+ // A unique identifier for the linked span. The ID is an 8-byte array.
257
+ bytes span_id = 2;
258
+
259
+ // The trace_state associated with the link.
260
+ string trace_state = 3;
261
+
262
+ // attributes is a collection of attribute key/value pairs on the link.
263
+ // Attribute keys MUST be unique (it is not allowed to have more than one
264
+ // attribute with the same key).
265
+ repeated opentelemetry.proto.common.v1.KeyValue attributes = 4;
266
+
267
+ // dropped_attributes_count is the number of dropped attributes. If the value is 0,
268
+ // then no attributes were dropped.
269
+ uint32 dropped_attributes_count = 5;
270
+
271
+ // Flags, a bit field.
272
+ //
273
+ // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
274
+ // Context specification. To read the 8-bit W3C trace flag, use
275
+ // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
276
+ //
277
+ // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
278
+ //
279
+ // Bits 8 and 9 represent the 3 states of whether the link is remote.
280
+ // The states are (unknown, is not remote, is remote).
281
+ // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
282
+ // To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
283
+ //
284
+ // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
285
+ // When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero.
286
+ //
287
+ // [Optional].
288
+ fixed32 flags = 6;
289
+ }
290
+
291
+ // links is a collection of Links, which are references from this span to a span
292
+ // in the same or different trace.
293
+ repeated Link links = 13;
294
+
295
+ // dropped_links_count is the number of dropped links after the maximum size was
296
+ // enforced. If this value is 0, then no links were dropped.
297
+ uint32 dropped_links_count = 14;
298
+
299
+ // An optional final status for this span. Semantically when Status isn't set, it means
300
+ // span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0).
301
+ Status status = 15;
302
+ }
303
+
304
+ // The Status type defines a logical error model that is suitable for different
305
+ // programming environments, including REST APIs and RPC APIs.
306
+ message Status {
307
+ reserved 1;
308
+
309
+ // A developer-facing human readable error message.
310
+ string message = 2;
311
+
312
+ // For the semantics of status codes see
313
+ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
314
+ enum StatusCode {
315
+ // The default status.
316
+ STATUS_CODE_UNSET = 0;
317
+ // The Span has been validated by an Application developer or Operator to
318
+ // have completed successfully.
319
+ STATUS_CODE_OK = 1;
320
+ // The Span contains an error.
321
+ STATUS_CODE_ERROR = 2;
322
+ };
323
+
324
+ // The status code.
325
+ StatusCode code = 3;
326
+ }
327
+
328
+ // SpanFlags represents constants used to interpret the
329
+ // Span.flags field, which is protobuf 'fixed32' type and is to
330
+ // be used as bit-fields. Each non-zero value defined in this enum is
331
+ // a bit-mask. To extract the bit-field, for example, use an
332
+ // expression like:
333
+ //
334
+ // (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)
335
+ //
336
+ // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
337
+ //
338
+ // Note that Span flags were introduced in version 1.1 of the
339
+ // OpenTelemetry protocol. Older Span producers do not set this
340
+ // field, consequently consumers should not rely on the absence of a
341
+ // particular flag bit to indicate the presence of a particular feature.
342
+ enum SpanFlags {
343
+ // The zero value for the enum. Should not be used for comparisons.
344
+ // Instead use bitwise "and" with the appropriate mask as shown above.
345
+ SPAN_FLAGS_DO_NOT_USE = 0;
346
+
347
+ // Bits 0-7 are used for trace flags.
348
+ SPAN_FLAGS_TRACE_FLAGS_MASK = 0x000000FF;
349
+
350
+ // Bits 8 and 9 are used to indicate that the parent span or link span is remote.
351
+ // Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
352
+ // Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
353
+ SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x00000100;
354
+ SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x00000200;
355
+
356
+ // Bits 10-31 are reserved for future use.
357
+ }