Logs that show size of upload

Is there a log somewhere that tells me how many bytes my upload of a new app contains? To be more specific, the build tool tells me the size of the image, but I have heard that only the delta is actually sent over the air for an update. Is there a way to see how many bytes of data are actually sent on an update? Thanks.

Hey, I actually put together a script for this, not too long ago:

release1 = <OLD_RELEASE_ID>
release2 = <NEW_RELEASE_ID>

sdk.pine.get({
    resource: 'release',
    options: {
        $filter: {
            id:{ $in: [ release1, release2 ]},
        },
        $orderby: 'id asc',
        $expand: {
            image__is_part_of__release: {
                $select: 'id',
                $expand: {
                    image: {
                        $select: [
                            'id'
                        ],
                        $expand: {
                            is_a_build_of__service: {
                                $select: 'service_name'
                            }
                        }
                    }
                }
            }
        }
    }
}).then(([r1, r2]) => {
    r1services = { }
    _.each(r1.image__is_part_of__release, (ipr) => {
        r1services[ ipr.image[0].is_a_build_of__service[0].service_name] = ipr.image[0].id;
    })
    r2services = { }
    _.each(r2.image__is_part_of__release, (ipr) => {
        r2services[ ipr.image[0].is_a_build_of__service[0].service_name] = ipr.image[0].id;
    })

    deltaSizes = { }
    return Promise.all(_.map(r1services, (id, name) => { 
        return sdk.pine.get({ resource: 'delta', options: { $filter: { originates_from__image: id, produces__image: r2services[name] }, $select: 'size' } }).then(([ img ]) => { if (img != null) { deltaSizes[name] = img.size } else { deltaSizes[name] = 0 }});
    })).then(() => console.log(deltaSizes))
})

Replace the releaseIds with the one currently running on a device, and the one you want to move to, and execute this in the developer console whilst on the dashboard (so that your permissions are automatically loaded).

Let me know if you need any further help!

1 Like

Hi thanks for sharing the script. Sorry it took me so long to get around to trying it. I am not sure what you mean by “execute this in the developer console”. Could you further clarify? I am on a mac, I do have node installed. I use npm to install the balena cli. I have been using the cli to login, and also to git push balena to my devices. Thats about all I know about using the developer console. I copied your script into a local file and named it delta-size.js. I am not sure what to do from here. Can you show me a screen shot of how to execute from the command line? Thanks very much.

Hi @chetferry. You can run the above from the developer console of your browser. Just log in to the dashboard.balena-cloud.com with your account, then open the developer console. Some more info for doing that on:

Getting

vendor~scripts.ce8d4690c4b150510932.chunk.js:87 Unhandled rejection e: Request error: Database error    at https://dashboard.balena-cloud.com/vendor~scripts.ce8d4690c4b150510932.chunk.js:87:266672

I’m logged into my dashboard and on the page of the application I’m interested in, I’m in Brave Browser which is Chromium based.

I’ve tried both the short and the full release id.

@cnr it sounds like you’re possibly not using the correct ID; the one to use for this command is the one from the end of the URL when you’re on the page in the dashboard for that release. It will be a number only (not alphanumeric). Let me know if this helps!

1 Like

Ahhh, gotcha.

Yes, that worked, I think. It returns “2499524”, is that bits or bytes? OP asked for bytes, but just want to make sure.

Can you disambiguate the two release identifiers for me?

The long release number is the release git commit level, and the release id is how balenaCloud keeps track of it on your side?

@cnr my colleague and I working right now are reasonably sure that it’s bytes, but we can ping someone from the API team to double check if you’d like.

You’re right about the release identifiers!

1 Like

Cool, accurate by a factor of 8 is good enough for right now, but it would be good to be confident in the future :slight_smile: Thanks!

@cnr we have confirmed that it’s bytes

1 Like