Challenge
Cognite is a globally recognized leader in industrial software, empowering industrial companies with accessible, trustworthy, and contextualized data through its marketing-leading Industrial DataOps platform, Cognite Data Fusion®. Cognite Data Fusion®, and its comprehensive suite of Industrial generative AI capabilities, Cognite AI, makes it easy for decision-makers to access and understand complex industrial data.
Senior Principal Architect Robert Collins has been with Cognite for 4 years and has supported the continued optimization of the company’s programming services.
“When I joined Cognite, Rust was already in use, but not systematically,” Robert shares. “At that point, it was mostly being used to optimize 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 is an incredible application, but at Cognite we always want to make things even better. So the team decided to use Rust to make the application even 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, Python, C++, and JVM.”
Cognite’s Seismic team was in the process of rewriting a JVM-based service into Rust, which was a first for Cognite.The goal of the rewrite was to deliver the performance the team needed in this heavily numerical domain.
“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.”
Solution
“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.
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 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.”
Results
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.”
In building the client, the goal was to not be much more expensive than an “if” statement.
“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 now takes part in the maintenance of Unleash’s 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 Unleash’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.”
Other Cognite teams have switched to using Rust and are now using Unleash.
“The auth team has written two services now. The Seismic team still uses Rust, of course,” 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, I imagine we’ll expand our use of Unleash as well.”
Robert’s advice to companies who are new to feature flags
- Start today.
- Don’t overthink it.
- Once you have been using feature flags for a few months, the patterns relevant to your organization will emerge.