ubiquity-os / ubiquity-os-kernel

1 stars 19 forks source link

Improve Cloudflare Worker `postComment` metadata #180

Open gentlementlegen opened 3 days ago

gentlementlegen commented 3 days ago
          @whilefoo A thing we could do for Workers is to put the url to the logs, that would look like

https://dash.cloudflare.com/${env.CLOUDFLARE_ACCOUNT_ID}/workers/services/view/${env.CLOUDFLARE_WORKER_NAME}/production/observability/logs?granularity=0&time=${timeParam}

However this would require worker deployments to upload these values as they are not accessible through a worker by default. What do you think?

If yes, it should be its own task I believe.

_Originally posted by @gentlementlegen in https://github.com/ubiquity-os/ubiquity-os-kernel/pull/169#discussion_r1821942110_

postComment can post the url for an Action worker, but doesn't not have context for a Worker run. What could be done is adding a url to the dashboard with the time of the run as a filter so that we instantly have the related logs displayed.

Code snippet:

const toTime = Date.now() + 60000;
    const fromTime = Date.now() - 60000;
    const timeParam = encodeURIComponent(`{"type":"absolute","to":${toTime},"from":${fromTime}}`);

    console.log(
      `https://dash.cloudflare.com/${env.CLOUDFLARE_ACCOUNT_ID}/workers/services/view/${env.CLOUDFLARE_WORKER_NAME}/production/observability/logs?granularity=0&time=${timeParam}`
    );

This would imply uploading CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_WORKER_NAME during worker deployment as these values are not available by default.

To achieve this, a new reusable GitHub action could be created to avoid having to modify each upload script from every worker plugin. This would greatly benefit all the projects and make deployment simpler.

gentlementlegen commented 3 days ago

/help

ubiquity-os[bot] commented 3 days ago

Available Commands

Command Description Example
/help List all available commands. /help
ubiquity-os-beta[bot] commented 3 days ago

Available Commands

Command Description Example
/help List all available commands. /help
/allow Allows the user to modify the given label. /allow @user1 label
/query Returns the user's wallet, access, and multiplier information. /query @UbiquityOS
/start Assign yourself to the issue. /start
/stop Unassign yourself from the issue. /stop
/wallet Register your wallet address for payments. /wallet ubq.eth