Skip to content

Conversation

@oshmyheliuk
Copy link
Contributor

@oshmyheliuk oshmyheliuk commented Aug 21, 2025

Purpose of this pull request

This pull request (PR) adds information on how to use Commerce Observability in connection with App Builder.
https://jira.corp.adobe.com/browse/CEXT-5047

Affected pages

  • new pages

Links to Magento Open Source code

  • ...

@jhadobe jhadobe self-assigned this Aug 21, 2025
@jhadobe jhadobe self-requested a review August 21, 2025 21:01
@jhadobe jhadobe added the new-topic A major update published as an entirely new document label Aug 26, 2025
@jhadobe
Copy link
Contributor

jhadobe commented Aug 26, 2025

@oshmyheliuk i've made a few changes, if you could review the last few commits and make sure everything still looks good to you.

"destination": "NewRelic",
"destination_endpoint": "https:\/\/log-api.newrelic.com\/log\/v1 ",
"destination_api_key": "********",
"destination_api_key": "abcd1234-abcdabc-afs",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it would actually be "********" as we are masking secrets in the REST response with asterics.

@oshmyheliuk
Copy link
Contributor Author

@jhadobe changes look good, thank you. I left one comment.

As @keharper mentioned, this documentation is planned to be combined with the APP Builder observability documentation (probably this PR https://github.com/AdobeDocs/commerce-extensibility/pull/413/files). So, I don't know if the structure of the pages in this PR is compatible with that PR.

@jhadobe
Copy link
Contributor

jhadobe commented Aug 26, 2025

@jhadobe changes look good, thank you. I left one comment.

As @keharper mentioned, this documentation is planned to be combined with the APP Builder observability documentation (probably this PR https://github.com/AdobeDocs/commerce-extensibility/pull/413/files). So, I don't know if the structure of the pages in this PR is compatible with that PR.

Thanks @oshmyheliuk I've addressed your comment. Regarding #413 we are not sure right now where that PR will actually go. It may end up as part of a completely different repo in the App Builder documentation, because it is not specific to Commerce (unlike this PR). Wherever it ends up, I'll make sure it is integrated with the content from this PR.

@jhadobe jhadobe marked this pull request as draft August 26, 2025 20:28
@jhadobe
Copy link
Contributor

jhadobe commented Aug 26, 2025

Converting this to a draft until the functionality is moved to production.

Comment on lines +107 to +126
const instrumentedMain = instrumentEntrypoint(main, {
...telemetryConfig,
propagation: {
getContextCarrier: (params) => {
if (params && params.__ow_headers && params.__ow_headers["traceparent"]) {
return {
carrier: {
traceparent: params && params.__ow_headers && params.__ow_headers["traceparent"] || "",
tracestate: params && params.__ow_headers && params.__ow_headers["tracestate"] || ""
}
}
} else {
return {
carrier: {}
}
}
}
}
});
exports.main = instrumentedMain
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before making this recommendation I'd actually prefer to build this directly in aio-lib-telemetry, following the specification we spoke about. Please let me know if this is prioritary and I'll let my managers know so they can help prioritize that change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add this example for now. And to remove this example after the implementation of that logic in aio-lib-telemetry.
If the implementation would be compatible with this current approach.

Comment on lines +160 to +179
const instrumentedMain = instrumentEntrypoint(main, {
...telemetryConfig,
propagation: {
getContextCarrier: (params) => {
if (params.data._metadata && params.data._metadata["traceparent"]) {
return {
carrier: {
traceparent: params.data._metadata["traceparent"] || "",
tracestate: params.data._metadata["tracestate"] || ""
}
}
} else {
return {
carrier: {}
}
}
}
}
});
exports.main = instrumentedMain
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This other example I'm okay with, as I don't feel comfortable baking Commerce-specific features (params.data._metadata) into aio-lib-telemetry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with not adding it to aio-lib-telemetry.
However, on the other hand, aio-lib-telemetry was created for Commerce, and I don't see it as a significant issue to add a check for event metadata. But it's totally up to you.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We created it in the Commerce org as an experiment that's true, but it's usage it's not limited to it, that's why I'd prefer not. But I think we can abstract it away in multiple other ways without actually coupling the two.

Comment on lines 184 to 192
You can run observability locally to test Commerce extensibility tools and their connection to App Builder. Refer to the [how to run Grafana locally](https://github.com/adobe/aio-lib-telemetry/blob/main/docs/use-cases/grafana.md#local-development) example for more information.

You can use a tunneling service to forward logs to your local development machine from the Commerce instance and deployed App Builder action. For example, you can use [Ngrok](https://ngrok.com/) to expose your local development environment to the internet. For more information, refer to [tunnel forwarding](https://github.com/adobe/aio-lib-telemetry/blob/main/docs/use-cases/support/tunnel-forwarding.md).

![Grafana logs](../../_images/observability/grafana-all-logs.png)

To filter logs for a single request you can use the `trace_id` filter. The `trace_id` is propagated from Commerce to App Builder. Use the `trace_id` to correlate logs from both systems.

![Grafana filtered logs](../../_images/observability/grafana-filtered-logs.png)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it's best to directly reference or forward to the full explanation in the aio-lib-telemetry, this way we don't have fragmented and duplicated docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I thought to update it with a link to a public documentation for aio-lib-telemetry in devdocs when it would be published.

@oshmyheliuk oshmyheliuk marked this pull request as ready for review October 30, 2025 16:28
@github-project-automation github-project-automation bot moved this from 📋 Needs Review to 👍 Approved in Commerce - Pull Requests Oct 31, 2025
@keharper keharper changed the base branch from main to observability-develop October 31, 2025 21:25
@keharper keharper merged commit 84f90ba into AdobeDocs:observability-develop Oct 31, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from 👍 Approved to 🏁 Done in Commerce - Pull Requests Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-topic A major update published as an entirely new document

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants