Cognite is a quickly growing industrial data company based in Oslo, Norway, with offices around the globe. The company’s main product, Cognite Data Fusion, contextualizes data for asset-heavy industries to deliver customer value.
Senior Principal Architect Robert Collins joined when Cognite had just begun experimenting with a new programming language.
“When I joined Cognite, Rust was already in use, but not systematically,” Robert shares. “At that point, it was mostly being used to accelerate projects already in progress.”
For example, one of Cognite’s applications is its Reveal 3D viewer, which downloads 3D models to a browser.
“An impressive thing you can do, for example, is sit on your mobile phone and look at a 3D model of an oil rig, showing you which route you needed to follow,” says Robert. “It worked, but it wasn’t fast enough. So the team decided to use Rust to make it work faster.”
The company was also an open source user of Unleash, but had yet to apply the solution to applications like Reveal 3D.
“At that point, Unleash was, for the most part, only backend services,” Robert says. “The languages available were mostly Java, C++, and JVM languages.”
Cognite’s Seismic team was very interested in building a Rust-based service, which was a first for Cognite. They were using one Cognite’s internal components, but it wasn’t fast enough.
“As I got my head around the situation, I realized this team was trailblazing, but they didn’t have all the affordances of other teams like tracing and feature flags,” says Robert. “So I offered to write a client for them.”
“A chunk of it was looking at the idea, and seeing if it was feasible or not,” says Robert. “By the time I had looked about it, thought about it, and decided that a Rust SDK was, in fact, feasible, there weren’t a lot of unknowns.”
The bulk creating and implementing the new Rust SDK took Robert a couple of days.
“I sat down to write some code to match the API following the behavior that is mandated for Unleash clients, and I did it in a reasonably Rust-ish fashion,” says Robert. “So it was quite quick, and quite smooth to implement.”
While Unleash’s Slack community was an available resource to Robert, he didn’t find it necessary to reach out for this project.
“I didn’t reach out to the Slack community at all,” says Robert. “I figured out the semantics well enough to just do the thing, so I wrote it quite quickly, and that’s pretty much it.”
With the SDK written and working for Cognite, Robert thought about the next steps.
“Internally I had written this thing,” says Robert. “It seemed to be clean. I thought, how about we open source it? So I did.”
The Rust SDK was brought in as one of Unleash’s community SDKs for a year and a half. During that time, Rust as a programming language had grown in popularity, and Unleash’s platform itself had been growing.
“So I was asked to bring the Rust SDK into Unleash’s official fold,” says Robert. “We transferred the repository and the history, which we were happy to do. Just like that, it became an official Unleash SDK.”
Cognite immediately saw results from the Unleash Rust SDK.
“After we implemented Rust in Cognite, Unleash didn’t change or look any different,” says Robert. “But it did allow that team to link to Unleash in an instant using feature flags for managing their changes.”
Robert and his team use Rust to measure performance and resource consumption.
“Some of the things we try and do in the Rust client is to really perform. So we’re measuring how many nanoseconds it takes to evaluate a feature flag and trying to really drive constant costs down.”
Robert has now taken on a maintenance role for the Rust SDK.
“Updating the Rust SDK is entirely my responsibility,” says Robert. “There’s nothing wrong with the code, but, like a house, it has to be kept up to date. Standards change.”
It is through this maintenance that Robert interacts with Cognite’s open source community.
“Every now and then there will be a new community patch, often from another Cogniter,” Robert shares. “But in terms of looking after hygiene in the repository, it’s not a huge amount of work.”
Robert also works with the Unleash team to make sure the Rust SDK continues to function with each update.
“So if Unleash releases a new feature, I let the Unleash team know if it’s going to work in Rust. If it won’t work, I tell the team I’m going to implement a fix.”
At the same time, more and more Cognite teams have switched to using Rust.
“The auth team has written two services now. The Seismic team still uses Rust, of course, and we have a number of projects here and there that are really taking root,” says Robert.
Through the Rust SDK, each one of those teams now has access to feature flags, and all the included benefits.
“Feature flags are well known for their broad development effects,” says Robert. “They give you the ability to experiment more safely to build stuff during a release freeze. And they give you access to things like incremental delivery and progressive delivery.”
As Cognite itself grows as a company, more and more teams are taking advantage of Unleash.
“Occasionally you’ll find a team that doesn’t know that feature flags were a capability we have, and it solves a problem they were having,” says Robert. “So it’s good that we have these things. As Cognite expands its use of Rust, I imagine we’ll expand our use of Unleash as well.”