Service metrics like Response Time and failure rate are gathered from the OneAgent when it instruments an application process.
For example if you had a Java application running with the Dynatrace OneAgent Instrumented, Dynatrace would gather data from the sensors placed within the application code. These sensors are pre configured by the Dynatrace development team and return the response time when methods are called.
Failure rate is gathered by the agent detecting application exceptions, http error codes and application error pages.
These response times and failures for individual transactions are used to create the "service" metrics you are listing.
Hope this helps answer your question.
Most metrics are calculated based off of other data. Like connectivity is based off of the amount or refused, retransmitted requests etc. Failure rate is the same thing, its the percentage of requests factored against the number of failed requests.