[Inference] Move tracing config to @kbn/tracing#225417
[Inference] Move tracing config to @kbn/tracing#225417dgieselaar merged 10 commits intoelastic:mainfrom
Conversation
844e9ee to
bb55e90
Compare
|
@elasticmachine merge upstream |
rudolf
left a comment
There was a problem hiding this comment.
If any clusters have values set for xpack.inference.tracing.exporter.{phoenix,langfuse} upgrading will cause their cluster to fail to start. It would be safer to deprecate these settings.
afharo
left a comment
There was a problem hiding this comment.
LGTM! I think that the breaking change is assumable since the original configs were introduced in 8.19 and 9.1, and they haven't been released yet. Let's make sure to backport these changes before the releases.
nit: I think that we should start grouping OTel packages in a directory (platform/packags/shared/opentelemetry/*). WDYT?
| * and is temporary until we fully migrate to [OpenTelemetry | ||
| * tracing](https://github.com/elastic/kibana/issues/220914). | ||
| */ | ||
| const ctx = propagation.extract(context.active(), request.headers, defaultTextMapGetter); |
There was a problem hiding this comment.
I wonder if it's worth moving this to a previous handler. This way, the context can be reused for any previous lifecycle steps like authentication/authorization, validation, etc.
I don't think that it should block the PR, though. We can move it in a follow-up PR.
WDYT?
There was a problem hiding this comment.
sorry, replied to the wrong comment - wdym with:
I wonder if it's worth moving this to a previous handler.
It should definitely happen as early as possible. where would I need to put it then?
There was a problem hiding this comment.
I was thinking about something similar to
.Maybe we can store the context in the request.app in a similar fashion (only if it makes sense).
There was a problem hiding this comment.
ah that does not actually work I think, you need to be able to wrap a callback
| export const RESOURCE_ATTR_SERVICE_NODE_NAME = 'service.node.name'; | ||
| export const RESOURCE_ATTR_SERVICE_ENVIRONMENT = 'service.environment'; |
There was a problem hiding this comment.
Do these conform to SemConv?
AFAIK, service.environment should be deployment.environment.name: https://opentelemetry.io/docs/specs/semconv/resource/deployment-environment/
Based on the definition of ServiceNodeName, should service.node.name be `container.name?
There was a problem hiding this comment.
cheers, will rename!
There was a problem hiding this comment.
I've changed to service.instance.id and service.namespace (which are both in development, so I'm defining them in @kbn/opentelemetry-attributes.
src/platform/packages/shared/kbn-opentelemetry-utils/src/flatten_to_attributes.ts
Show resolved
Hide resolved
| // Helpers to check if ID is not all zeros (spec prohibits all-zero ids) | ||
| const isAllZeros = (str: string) => /^0+$/.test(str); | ||
|
|
||
| export function fromTraceparent(traceparent: string): SpanContext | undefined { |
There was a problem hiding this comment.
😮 I'm surprised that this helper is not provided in the @opentelemetry libraries
There was a problem hiding this comment.
me too, I'll have another look to see if I haven't missed anything.
| "id": "@kbn/tracing-config", | ||
| "owner": "@elastic/kibana-core", | ||
| "group": "platform", | ||
| "visibility": "shared" |
There was a problem hiding this comment.
nit: I wonder if this should be "private"
There was a problem hiding this comment.
tbh I really don't get the point of private packages. Why should everything in x-pack/platform be able to import it, but nothing in x-pack/solutions/observability? but a topic for another day.. 😄
…ana into move-inference-processors
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Public APIs missing exports
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
|
peteharverson
left a comment
There was a problem hiding this comment.
AI infra owned changes LGTM
|
Starting backport for target branches: 8.19, 9.1 https://github.com/elastic/kibana/actions/runs/15994035227 |
This moves the initialization of phoenix/langfuse processors+exporters
to @kbn/tracing. Previously the Inference plugin initialized and
registered them.
## Why
We need to use the tracing spans outside of the Kibana application as
well - for instance when running evaluations or other CLI-based
workflows. This doesn't work if Kibana server manages the exporter, as
it has no visibility in spans created outside of the process.
**The configuration path moves from
`xpack.inference.tracing.exporter.{phoenix,langfuse}` to
`telemetry.tracing.exporter.{phoenix,langfuse}`, without backwards
compatibility.**
## Notes
- These are registered as _exporters_ but implemented as _processors_.
The reason is that they need to use baggage to make sure all spans
created in the context of an LLM workflow get marked and exported. So
`exporters` are somewhat of a misnomer but it seems overkill to me to
register both `exporters` and `processors` separately.
- I'm backporting to 8.19 as well, given A) the risk of merge conflicts,
B) the fact that this is disabled by default.
- I'm assuming this is not a breaking change because this is not on by
default and not document. If it _is_ a breaking change I would need some
guidance on how to use the
- I used o3 to write documentation for @kbn/tracing and
@kbn/inference-tracing.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit cbd3a97)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
) # Backport This will backport the following commits from `main` to `9.1`: - [[Inference] Move tracing config to @kbn/tracing (#225417)](#225417) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dario Gieselaar","email":"dario.gieselaar@elastic.co"},"sourceCommit":{"committedDate":"2025-07-01T08:28:51Z","message":"[Inference] Move tracing config to @kbn/tracing (#225417)\n\nThis moves the initialization of phoenix/langfuse processors+exporters\nto @kbn/tracing. Previously the Inference plugin initialized and\nregistered them.\n\n## Why\n\nWe need to use the tracing spans outside of the Kibana application as\nwell - for instance when running evaluations or other CLI-based\nworkflows. This doesn't work if Kibana server manages the exporter, as\nit has no visibility in spans created outside of the process.\n\n**The configuration path moves from\n`xpack.inference.tracing.exporter.{phoenix,langfuse}` to\n`telemetry.tracing.exporter.{phoenix,langfuse}`, without backwards\ncompatibility.**\n\n## Notes\n\n- These are registered as _exporters_ but implemented as _processors_.\nThe reason is that they need to use baggage to make sure all spans\ncreated in the context of an LLM workflow get marked and exported. So\n`exporters` are somewhat of a misnomer but it seems overkill to me to\nregister both `exporters` and `processors` separately.\n- I'm backporting to 8.19 as well, given A) the risk of merge conflicts,\nB) the fact that this is disabled by default.\n- I'm assuming this is not a breaking change because this is not on by\ndefault and not document. If it _is_ a breaking change I would need some\nguidance on how to use the\n- I used o3 to write documentation for @kbn/tracing and\n@kbn/inference-tracing.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"cbd3a97eb241e09e63049842518df83b1c64bebd","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Inference] Move tracing config to @kbn/tracing","number":225417,"url":"https://github.com/elastic/kibana/pull/225417","mergeCommit":{"message":"[Inference] Move tracing config to @kbn/tracing (#225417)\n\nThis moves the initialization of phoenix/langfuse processors+exporters\nto @kbn/tracing. Previously the Inference plugin initialized and\nregistered them.\n\n## Why\n\nWe need to use the tracing spans outside of the Kibana application as\nwell - for instance when running evaluations or other CLI-based\nworkflows. This doesn't work if Kibana server manages the exporter, as\nit has no visibility in spans created outside of the process.\n\n**The configuration path moves from\n`xpack.inference.tracing.exporter.{phoenix,langfuse}` to\n`telemetry.tracing.exporter.{phoenix,langfuse}`, without backwards\ncompatibility.**\n\n## Notes\n\n- These are registered as _exporters_ but implemented as _processors_.\nThe reason is that they need to use baggage to make sure all spans\ncreated in the context of an LLM workflow get marked and exported. So\n`exporters` are somewhat of a misnomer but it seems overkill to me to\nregister both `exporters` and `processors` separately.\n- I'm backporting to 8.19 as well, given A) the risk of merge conflicts,\nB) the fact that this is disabled by default.\n- I'm assuming this is not a breaking change because this is not on by\ndefault and not document. If it _is_ a breaking change I would need some\nguidance on how to use the\n- I used o3 to write documentation for @kbn/tracing and\n@kbn/inference-tracing.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"cbd3a97eb241e09e63049842518df83b1c64bebd"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225417","number":225417,"mergeCommit":{"message":"[Inference] Move tracing config to @kbn/tracing (#225417)\n\nThis moves the initialization of phoenix/langfuse processors+exporters\nto @kbn/tracing. Previously the Inference plugin initialized and\nregistered them.\n\n## Why\n\nWe need to use the tracing spans outside of the Kibana application as\nwell - for instance when running evaluations or other CLI-based\nworkflows. This doesn't work if Kibana server manages the exporter, as\nit has no visibility in spans created outside of the process.\n\n**The configuration path moves from\n`xpack.inference.tracing.exporter.{phoenix,langfuse}` to\n`telemetry.tracing.exporter.{phoenix,langfuse}`, without backwards\ncompatibility.**\n\n## Notes\n\n- These are registered as _exporters_ but implemented as _processors_.\nThe reason is that they need to use baggage to make sure all spans\ncreated in the context of an LLM workflow get marked and exported. So\n`exporters` are somewhat of a misnomer but it seems overkill to me to\nregister both `exporters` and `processors` separately.\n- I'm backporting to 8.19 as well, given A) the risk of merge conflicts,\nB) the fact that this is disabled by default.\n- I'm assuming this is not a breaking change because this is not on by\ndefault and not document. If it _is_ a breaking change I would need some\nguidance on how to use the\n- I used o3 to write documentation for @kbn/tracing and\n@kbn/inference-tracing.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"cbd3a97eb241e09e63049842518df83b1c64bebd"}}]}] BACKPORT--> Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This moves the initialization of phoenix/langfuse processors+exporters
to @kbn/tracing. Previously the Inference plugin initialized and
registered them.
## Why
We need to use the tracing spans outside of the Kibana application as
well - for instance when running evaluations or other CLI-based
workflows. This doesn't work if Kibana server manages the exporter, as
it has no visibility in spans created outside of the process.
**The configuration path moves from
`xpack.inference.tracing.exporter.{phoenix,langfuse}` to
`telemetry.tracing.exporter.{phoenix,langfuse}`, without backwards
compatibility.**
## Notes
- These are registered as _exporters_ but implemented as _processors_.
The reason is that they need to use baggage to make sure all spans
created in the context of an LLM workflow get marked and exported. So
`exporters` are somewhat of a misnomer but it seems overkill to me to
register both `exporters` and `processors` separately.
- I'm backporting to 8.19 as well, given A) the risk of merge conflicts,
B) the fact that this is disabled by default.
- I'm assuming this is not a breaking change because this is not on by
default and not document. If it _is_ a breaking change I would need some
guidance on how to use the
- I used o3 to write documentation for @kbn/tracing and
@kbn/inference-tracing.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit cbd3a97)
# Conflicts:
# .github/CODEOWNERS
# src/core/packages/http/router-server-internal/src/router.ts
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…6224) # Backport This will backport the following commits from `main` to `8.19`: - [[Inference] Move tracing config to @kbn/tracing (#225417)](#225417) <!--- Backport version: 10.0.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dario Gieselaar","email":"dario.gieselaar@elastic.co"},"sourceCommit":{"committedDate":"2025-07-01T08:28:51Z","message":"[Inference] Move tracing config to @kbn/tracing (#225417)\n\nThis moves the initialization of phoenix/langfuse processors+exporters\nto @kbn/tracing. Previously the Inference plugin initialized and\nregistered them.\n\n## Why\n\nWe need to use the tracing spans outside of the Kibana application as\nwell - for instance when running evaluations or other CLI-based\nworkflows. This doesn't work if Kibana server manages the exporter, as\nit has no visibility in spans created outside of the process.\n\n**The configuration path moves from\n`xpack.inference.tracing.exporter.{phoenix,langfuse}` to\n`telemetry.tracing.exporter.{phoenix,langfuse}`, without backwards\ncompatibility.**\n\n## Notes\n\n- These are registered as _exporters_ but implemented as _processors_.\nThe reason is that they need to use baggage to make sure all spans\ncreated in the context of an LLM workflow get marked and exported. So\n`exporters` are somewhat of a misnomer but it seems overkill to me to\nregister both `exporters` and `processors` separately.\n- I'm backporting to 8.19 as well, given A) the risk of merge conflicts,\nB) the fact that this is disabled by default.\n- I'm assuming this is not a breaking change because this is not on by\ndefault and not document. If it _is_ a breaking change I would need some\nguidance on how to use the\n- I used o3 to write documentation for @kbn/tracing and\n@kbn/inference-tracing.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"cbd3a97eb241e09e63049842518df83b1c64bebd","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[Inference] Move tracing config to @kbn/tracing","number":225417,"url":"https://github.com/elastic/kibana/pull/225417","mergeCommit":{"message":"[Inference] Move tracing config to @kbn/tracing (#225417)\n\nThis moves the initialization of phoenix/langfuse processors+exporters\nto @kbn/tracing. Previously the Inference plugin initialized and\nregistered them.\n\n## Why\n\nWe need to use the tracing spans outside of the Kibana application as\nwell - for instance when running evaluations or other CLI-based\nworkflows. This doesn't work if Kibana server manages the exporter, as\nit has no visibility in spans created outside of the process.\n\n**The configuration path moves from\n`xpack.inference.tracing.exporter.{phoenix,langfuse}` to\n`telemetry.tracing.exporter.{phoenix,langfuse}`, without backwards\ncompatibility.**\n\n## Notes\n\n- These are registered as _exporters_ but implemented as _processors_.\nThe reason is that they need to use baggage to make sure all spans\ncreated in the context of an LLM workflow get marked and exported. So\n`exporters` are somewhat of a misnomer but it seems overkill to me to\nregister both `exporters` and `processors` separately.\n- I'm backporting to 8.19 as well, given A) the risk of merge conflicts,\nB) the fact that this is disabled by default.\n- I'm assuming this is not a breaking change because this is not on by\ndefault and not document. If it _is_ a breaking change I would need some\nguidance on how to use the\n- I used o3 to write documentation for @kbn/tracing and\n@kbn/inference-tracing.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"cbd3a97eb241e09e63049842518df83b1c64bebd"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/225953","number":225953,"state":"MERGED","mergeCommit":{"sha":"eacd7e491663394e39ce410b1629da769b416b26","message":"[9.1] [Inference] Move tracing config to @kbn/tracing (#225417) (#225953)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.1`:\n- [[Inference] Move tracing config to @kbn/tracing\n(#225417)](https://github.com/elastic/kibana/pull/225417)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225417","number":225417,"mergeCommit":{"message":"[Inference] Move tracing config to @kbn/tracing (#225417)\n\nThis moves the initialization of phoenix/langfuse processors+exporters\nto @kbn/tracing. Previously the Inference plugin initialized and\nregistered them.\n\n## Why\n\nWe need to use the tracing spans outside of the Kibana application as\nwell - for instance when running evaluations or other CLI-based\nworkflows. This doesn't work if Kibana server manages the exporter, as\nit has no visibility in spans created outside of the process.\n\n**The configuration path moves from\n`xpack.inference.tracing.exporter.{phoenix,langfuse}` to\n`telemetry.tracing.exporter.{phoenix,langfuse}`, without backwards\ncompatibility.**\n\n## Notes\n\n- These are registered as _exporters_ but implemented as _processors_.\nThe reason is that they need to use baggage to make sure all spans\ncreated in the context of an LLM workflow get marked and exported. So\n`exporters` are somewhat of a misnomer but it seems overkill to me to\nregister both `exporters` and `processors` separately.\n- I'm backporting to 8.19 as well, given A) the risk of merge conflicts,\nB) the fact that this is disabled by default.\n- I'm assuming this is not a breaking change because this is not on by\ndefault and not document. If it _is_ a breaking change I would need some\nguidance on how to use the\n- I used o3 to write documentation for @kbn/tracing and\n@kbn/inference-tracing.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"cbd3a97eb241e09e63049842518df83b1c64bebd"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This moves the initialization of phoenix/langfuse processors+exporters to @kbn/tracing. Previously the Inference plugin initialized and registered them.
Why
We need to use the tracing spans outside of the Kibana application as well - for instance when running evaluations or other CLI-based workflows. This doesn't work if Kibana server manages the exporter, as it has no visibility in spans created outside of the process.
The configuration path moves from
xpack.inference.tracing.exporter.{phoenix,langfuse}totelemetry.tracing.exporter.{phoenix,langfuse}, without backwards compatibility.Notes
exportersare somewhat of a misnomer but it seems overkill to me to register bothexportersandprocessorsseparately.